diff --git a/ibm_vpc/vpc_v1.py b/ibm_vpc/vpc_v1.py
index aed6bad..10f581d 100644
--- a/ibm_vpc/vpc_v1.py
+++ b/ibm_vpc/vpc_v1.py
@@ -14,14 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# IBM OpenAPI SDK Code Generator Version: 3.105.1-067d600b-20250616-154447
+# IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732
"""
The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision
and manage virtual server instances, along with subnets, volumes, load balancers, and
more.
-API Version: 2025-07-08
+API Version: 2025-09-23
"""
from datetime import datetime
@@ -67,7 +67,7 @@ class VpcV1(BaseService):
@classmethod
def new_instance(
cls,
- version: Optional[str] = "2025-07-08",
+ version: Optional[str] = "2025-09-23",
service_name: str = DEFAULT_SERVICE_NAME,
generation: Optional[int] = 2,
) -> 'VpcV1':
@@ -76,8 +76,8 @@ def new_instance(
external configuration.
:param str version: The API version, in format `YYYY-MM-DD`. For the API
- behavior documented here, specify any date between `2025-06-30` and
- `2025-07-10`.
+ behavior documented here, specify any date between `2025-09-16` and
+ `2025-09-24`.
"""
if version is None:
raise ValueError('version must be provided')
@@ -107,7 +107,7 @@ def get_service_url_for_region(
def __init__(
self,
- version: Optional[str] = "2025-07-08",
+ version: Optional[str] = "2025-09-23",
authenticator: Authenticator = None,
generation: Optional[int] = 2,
) -> None:
@@ -115,8 +115,8 @@ def __init__(
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 `2025-06-30` and
- `2025-07-10`.
+ behavior documented here, specify any date between `2025-09-16` and
+ `2025-09-24`.
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
@@ -130,25 +130,25 @@ def __init__(
self.version = version
#########################
- # VPCs
+ # Backup policies
#########################
- def list_vpcs(
+ def list_backup_policies(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
- classic_access: Optional[bool] = None,
+ name: Optional[str] = None,
+ tag: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List VPCs.
+ List backup policies.
- This request lists VPCs in the region. A VPC is a virtual network that belongs to
- an account and provides logical isolation from other networks. A VPC is made up of
- resources in one or more zones. VPCs are regional, and each VPC can contain
- resources in multiple zones in a region.
+ This request lists 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.
@@ -156,18 +156,20 @@ def list_vpcs(
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param bool classic_access: (optional) Filters the collection to VPCs with
- a `classic_access` property matching the specified value.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str tag: (optional) Filters the collection to resources with an item
+ in the `tags` property matching the exact specified tag.
: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 `VPCCollection` object
+ :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_vpcs',
+ operation_id='list_backup_policies',
)
headers.update(sdk_headers)
@@ -177,7 +179,8 @@ def list_vpcs(
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
- 'classic_access': classic_access,
+ 'name': name,
+ 'tag': tag,
}
if 'headers' in kwargs:
@@ -185,7 +188,7 @@ def list_vpcs(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/vpcs'
+ url = '/backup_policies'
request = self.prepare_request(
method='GET',
url=url,
@@ -196,75 +199,34 @@ def list_vpcs(
response = self.send(request, **kwargs)
return response
- def create_vpc(
+ def create_backup_policy(
self,
- *,
- address_prefix_management: Optional[str] = None,
- classic_access: Optional[bool] = None,
- dns: Optional['VPCDNSPrototype'] = None,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
+ backup_policy_prototype: 'BackupPolicyPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a VPC.
+ Create a backup policy.
- This request creates a new VPC from a VPC prototype object. The prototype object
- is structured in the same way as a retrieved VPC, and contains the information
- necessary to create the new VPC.
- The system will automatically create the following additional resources for the
- VPC:
- - Unless `address_prefix_management` is `manual`, a [default address
- prefix](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-address-prefix) for
- each zone
- - A [default network
- ACL](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-network-acl)
- - A [default routing
- table](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-routing-table)
- - A [default security
- group](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-security-group).
+ 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 str address_prefix_management: (optional) Indicates whether a
- [default address
- prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes)
- will be automatically created for each zone in this VPC. If `manual`, this
- VPC will be created with no default address prefixes.
- Since address prefixes are managed identically regardless of whether they
- were automatically created, the value is not preserved as a VPC property.
- :param bool classic_access: (optional) Deprecated: Indicates whether this
- VPC will be connected to Classic Infrastructure. If true, this VPC's
- resources will 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.
- This property has been deprecated. Instead, use a [Transit
- Gateway](https://cloud.ibm.com/docs/transit-gateway) to connect this VPC to
- Classic Infrastructure. For more information, see [upcoming
- changes](https://cloud.ibm.com/docs/vpc?topic=vpc-api-change-log#upcoming-changes).
- :param VPCDNSPrototype dns: (optional) The DNS configuration for this VPC.
- If unspecified, the system will assign DNS servers capable of resolving
- hosts and endpoint
- gateways within this VPC, and hosts on the internet.
- :param str name: (optional) The name for this VPC. The name must not be
- used by another VPC in the region. 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) will be
- used.
+ :param BackupPolicyPrototype backup_policy_prototype: The backup policy
+ prototype object.
: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 `VPC` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object
"""
- if dns is not None:
- dns = convert_model(dns)
- if resource_group is not None:
- resource_group = convert_model(resource_group)
+ if backup_policy_prototype is None:
+ raise ValueError('backup_policy_prototype must be provided')
+ if isinstance(backup_policy_prototype, BackupPolicyPrototype):
+ backup_policy_prototype = convert_model(backup_policy_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpc',
+ operation_id='create_backup_policy',
)
headers.update(sdk_headers)
@@ -273,15 +235,7 @@ def create_vpc(
'generation': self.generation,
}
- data = {
- 'address_prefix_management': address_prefix_management,
- 'classic_access': classic_access,
- 'dns': dns,
- 'name': name,
- 'resource_group': resource_group,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(backup_policy_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -289,7 +243,7 @@ def create_vpc(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/vpcs'
+ url = '/backup_policies'
request = self.prepare_request(
method='POST',
url=url,
@@ -301,62 +255,87 @@ def create_vpc(
response = self.send(request, **kwargs)
return response
- def delete_vpc(
+ def list_backup_policy_jobs(
self,
- id: str,
+ backup_policy_id: str,
*,
- if_match: Optional[str] = None,
+ status: Optional[str] = None,
+ backup_policy_plan_id: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ sort: Optional[str] = None,
+ source_id: Optional[str] = None,
+ target_snapshots_id: Optional[str] = None,
+ target_snapshots_crn: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPC.
+ List jobs for a backup policy.
- This request deletes a VPC. This operation cannot be reversed.
- For this request to succeed:
- - Instances, subnets, public gateways, endpoint gateways, and private path service
- gateways must not reside in this VPC
- - The VPC must not be providing DNS resolution for any other VPCs
- - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero
- All security groups and network ACLs associated with the VPC are automatically
- deleted. All flow log collectors with `auto_delete` set to `true` targeting the
- VPC or any resource in the VPC are automatically deleted. All public address
- ranges attached to the VPC are automatically detached.
+ This request retrieves jobs for a backup policy. A backup job represents the
+ execution of a backup policy plan for a resource matching the policy's criteria.
- :param str id: The VPC 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 str backup_policy_id: The backup policy identifier.
+ :param str status: (optional) Filters the collection to backup policy jobs
+ with a `status` property matching the specified value.
+ :param str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching the
+ specified 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 str source_id: (optional) Filters the collection to backup policy
+ jobs with a `source.id` property matching the specified identifier.
+ :param str target_snapshots_id: (optional) Filters the collection to backup
+ policy jobs with an item in the `target_snapshots` property with an `id`
+ property matching the specified identifier.
+ :param str target_snapshots_crn: (optional) Filters the collection to
+ backup policy jobs with an item in the `target_snapshots` property with a
+ `crn` property matching the specified CRN.
: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 `BackupPolicyJobCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ if not backup_policy_id:
+ 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='delete_vpc',
+ operation_id='list_backup_policy_jobs',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'status': status,
+ 'backup_policy_plan.id': backup_policy_plan_id,
+ 'start': start,
+ 'limit': limit,
+ 'sort': sort,
+ 'source.id': source_id,
+ 'target_snapshots[].id': target_snapshots_id,
+ 'target_snapshots[].crn': target_snapshots_crn,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/vpcs/{id}'.format(**path_param_dict)
+ url = '/backup_policies/{backup_policy_id}/jobs'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -365,29 +344,34 @@ def delete_vpc(
response = self.send(request, **kwargs)
return response
- def get_vpc(
+ def get_backup_policy_job(
self,
+ backup_policy_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC.
+ Retrieve a backup policy job.
- This request retrieves a single VPC specified by the identifier in the URL.
+ This request retrieves a single backup policy job specified by the identifier in
+ the URL.
- :param str id: The VPC identifier.
+ :param str backup_policy_id: The backup policy identifier.
+ :param str id: The backup policy job 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 `VPC` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicyJob` object
"""
+ if not backup_policy_id:
+ raise ValueError('backup_policy_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc',
+ operation_id='get_backup_policy_job',
)
headers.update(sdk_headers)
@@ -401,10 +385,10 @@ def get_vpc(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/vpcs/{id}'.format(**path_param_dict)
+ url = '/backup_policies/{backup_policy_id}/jobs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -415,44 +399,129 @@ def get_vpc(
response = self.send(request, **kwargs)
return response
- def update_vpc(
+ def list_backup_policy_plans(
self,
- id: str,
- vpc_patch: 'VPCPatch',
+ backup_policy_id: str,
*,
- if_match: Optional[str] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a VPC.
+ List plans for a backup policy.
- This request updates a VPC with the information provided in a VPC patch object.
- The patch object is structured in the same way as a retrieved VPC and needs to
- contain only the information to be updated.
+ This request retrieves plans for a backup policy. Backup plans provide the backup
+ schedule and deletion triggers.
- :param str id: The VPC identifier.
- :param VPCPatch vpc_patch: The VPC 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 str backup_policy_id: The backup policy identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 `VPC` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlanCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
- if vpc_patch is None:
- raise ValueError('vpc_patch must be provided')
- if isinstance(vpc_patch, VPCPatch):
- vpc_patch = convert_model(vpc_patch)
- headers = {
- 'If-Match': if_match,
+ if not backup_policy_id:
+ 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'))
+ del kwargs['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: Optional[bool] = None,
+ attach_user_tags: Optional[List[str]] = None,
+ clone_policy: Optional['BackupPolicyPlanClonePolicyPrototype'] = None,
+ copy_user_tags: Optional[bool] = None,
+ deletion_trigger: Optional['BackupPolicyPlanDeletionTriggerPrototype'] = None,
+ name: Optional[str] = None,
+ remote_region_policies: Optional[List['BackupPolicyPlanRemoteRegionPolicyPrototype']] = 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) The user tags to attach to
+ each backup (snapshot) created by this plan.
+ :param BackupPolicyPlanClonePolicyPrototype clone_policy: (optional)
+ :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 name for this backup policy plan. The name
+ must not be used by another plan for the backup policy. If unspecified, the
+ name will be a hyphenated list of randomly-selected words.
+ :param List[BackupPolicyPlanRemoteRegionPolicyPrototype]
+ remote_region_policies: (optional) The policies for additional backups in
+ remote regions.
+ :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 not backup_policy_id:
+ raise ValueError('backup_policy_id must be provided')
+ if cron_spec is None:
+ raise ValueError('cron_spec must be provided')
+ if clone_policy is not None:
+ clone_policy = convert_model(clone_policy)
+ if deletion_trigger is not None:
+ deletion_trigger = convert_model(deletion_trigger)
+ if remote_region_policies is not None:
+ remote_region_policies = [convert_model(x) for x in remote_region_policies]
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpc',
+ operation_id='create_backup_policy_plan',
)
headers.update(sdk_headers)
@@ -461,20 +530,31 @@ def update_vpc(
'generation': self.generation,
}
- data = json.dumps(vpc_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = {
+ 'cron_spec': cron_spec,
+ 'active': active,
+ 'attach_user_tags': attach_user_tags,
+ 'clone_policy': clone_policy,
+ 'copy_user_tags': copy_user_tags,
+ 'deletion_trigger': deletion_trigger,
+ 'name': name,
+ 'remote_region_policies': remote_region_policies,
+ }
+ 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/vpcs/{id}'.format(**path_param_dict)
+ url = '/backup_policies/{backup_policy_id}/plans'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -484,31 +564,45 @@ def update_vpc(
response = self.send(request, **kwargs)
return response
- def get_vpc_default_network_acl(
+ def delete_backup_policy_plan(
self,
+ backup_policy_id: str,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC's default network ACL.
+ Delete a backup policy plan.
- This request retrieves the default network ACL for the VPC specified by the
- identifier in the URL. The default network ACL is applied to any new subnets in
- the VPC which do not specify a network ACL.
+ 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 id: The VPC identifier.
+ :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 `DefaultNetworkACL` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object
"""
+ if not backup_policy_id:
+ raise ValueError('backup_policy_id must be provided')
if not id:
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='get_vpc_default_network_acl',
+ operation_id='delete_backup_policy_plan',
)
headers.update(sdk_headers)
@@ -522,12 +616,12 @@ def get_vpc_default_network_acl(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/vpcs/{id}/default_network_acl'.format(**path_param_dict)
+ url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -536,31 +630,34 @@ def get_vpc_default_network_acl(
response = self.send(request, **kwargs)
return response
- def get_vpc_default_routing_table(
+ def get_backup_policy_plan(
self,
+ backup_policy_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC's default routing table.
+ Retrieve a backup policy plan.
- This request retrieves the default routing table for the VPC specified by the
- identifier in the URL. The default routing table is associated with any subnets in
- the VPC which have not been explicitly associated with another routing table.
+ This request retrieves a single backup policy plan specified by the identifier in
+ the URL.
- :param str id: The VPC identifier.
+ :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 `DefaultRoutingTable` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object
"""
+ if not backup_policy_id:
+ raise ValueError('backup_policy_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc_default_routing_table',
+ operation_id='get_backup_policy_plan',
)
headers.update(sdk_headers)
@@ -574,10 +671,10 @@ def get_vpc_default_routing_table(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/vpcs/{id}/default_routing_table'.format(**path_param_dict)
+ url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -588,31 +685,49 @@ def get_vpc_default_routing_table(
response = self.send(request, **kwargs)
return response
- def get_vpc_default_security_group(
+ def update_backup_policy_plan(
self,
+ backup_policy_id: str,
id: str,
+ backup_policy_plan_patch: 'BackupPolicyPlanPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC's default security group.
+ Update a backup policy plan.
- This request retrieves the default security group for the VPC specified by the
- identifier in the URL. Resources created in this VPC that allow a security group
- to be optionally specified will use this security group by default.
+ 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 id: The VPC identifier.
+ :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 `DefaultSecurityGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object
"""
+ if not backup_policy_id:
+ raise ValueError('backup_policy_id must be provided')
if not id:
raise ValueError('id must be provided')
- headers = {}
+ 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='get_vpc_default_security_group',
+ operation_id='update_backup_policy_plan',
)
headers.update(sdk_headers)
@@ -621,62 +736,67 @@ def get_vpc_default_security_group(
'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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/vpcs/{id}/default_security_group'.format(**path_param_dict)
+ url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_vpc_address_prefixes(
+ def delete_backup_policy(
self,
- vpc_id: str,
+ id: str,
*,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List address prefixes for a VPC.
+ Delete a backup policy.
- This request lists address pool prefixes for a VPC.
+ 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 vpc_id: The VPC 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 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 `AddressPrefixCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- headers = {}
+ if not id:
+ 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='list_vpc_address_prefixes',
+ operation_id='delete_backup_policy',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -684,12 +804,12 @@ def list_vpc_address_prefixes(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_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 = '/vpcs/{vpc_id}/address_prefixes'.format(**path_param_dict)
+ url = '/backup_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -698,58 +818,30 @@ def list_vpc_address_prefixes(
response = self.send(request, **kwargs)
return response
- def create_vpc_address_prefix(
+ def get_backup_policy(
self,
- vpc_id: str,
- cidr: str,
- zone: 'ZoneIdentity',
- *,
- is_default: Optional[bool] = None,
- name: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create an address prefix for a VPC.
+ Retrieve a backup policy.
- This request creates a new prefix from a prefix prototype object. The prototype
- object is structured in the same way as a retrieved prefix, and contains the
- information necessary to create the new prefix.
+ This request retrieves a single backup policy specified by the identifier in the
+ URL.
- :param str vpc_id: The VPC identifier.
- :param str cidr: The IPv4 range of the address prefix, expressed in CIDR
- format. The range 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 address prefix's CIDR must be between `/9`
- (8,388,608 addresses) and `/29` (8 addresses).
- :param ZoneIdentity zone: The zone this address prefix will reside in.
- :param bool is_default: (optional) Indicates whether this will be the
- default address prefix for this zone in this VPC. If `true`, the VPC must
- not have a default address prefix for this zone.
- :param str name: (optional) The name for this address prefix. The name must
- not be used by another address prefix for the VPC. If unspecified, the name
- will be a hyphenated list of randomly-selected words.
+ :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 `AddressPrefix` object
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if cidr is None:
- raise ValueError('cidr must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- zone = convert_model(zone)
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpc_address_prefix',
+ operation_id='get_backup_policy',
)
headers.update(sdk_headers)
@@ -758,64 +850,63 @@ def create_vpc_address_prefix(
'generation': self.generation,
}
- data = {
- 'cidr': cidr,
- 'zone': zone,
- 'is_default': is_default,
- '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_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 = '/vpcs/{vpc_id}/address_prefixes'.format(**path_param_dict)
+ url = '/backup_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_vpc_address_prefix(
+ def update_backup_policy(
self,
- vpc_id: str,
id: str,
+ backup_policy_patch: 'BackupPolicyPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete an address prefix.
+ Update a backup policy.
- This request deletes a prefix. This operation cannot be reversed. The request will
- fail if any subnets use addresses from this prefix.
+ 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 vpc_id: The VPC identifier.
- :param str id: The prefix identifier.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
if not id:
raise ValueError('id must be provided')
- headers = {}
+ 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='delete_vpc_address_prefix',
+ operation_id='update_backup_policy',
)
headers.update(sdk_headers)
@@ -824,57 +915,69 @@ def delete_vpc_address_prefix(
'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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_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 = '/vpcs/{vpc_id}/address_prefixes/{id}'.format(**path_param_dict)
+ url = '/backup_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_vpc_address_prefix(
+ #########################
+ # Bare metal servers
+ #########################
+
+ def list_bare_metal_server_profiles(
self,
- vpc_id: str,
- id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an address prefix.
+ List bare metal server profiles.
- This request retrieves a single prefix specified by the identifier in the URL.
+ This request lists [bare metal server
+ profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
+ available in the region. A bare metal server profile specifies the performance
+ characteristics and pricing model for a bare metal server.
- :param str vpc_id: The VPC identifier.
- :param str id: The prefix 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 `AddressPrefix` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerProfileCollection` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc_address_prefix',
+ operation_id='list_bare_metal_server_profiles',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -882,10 +985,7 @@ def get_vpc_address_prefix(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/address_prefixes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_server/profiles'
request = self.prepare_request(
method='GET',
url=url,
@@ -896,41 +996,30 @@ def get_vpc_address_prefix(
response = self.send(request, **kwargs)
return response
- def update_vpc_address_prefix(
+ def get_bare_metal_server_profile(
self,
- vpc_id: str,
- id: str,
- address_prefix_patch: 'AddressPrefixPatch',
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Update an address prefix.
+ Retrieve a bare metal server profile.
- This request updates a prefix with the information in a provided prefix patch. The
- prefix patch object is structured in the same way as a retrieved prefix and
- contains only the information to be updated.
+ This request retrieves a single bare metal server profile specified by the name in
+ the URL.
- :param str vpc_id: The VPC identifier.
- :param str id: The prefix identifier.
- :param AddressPrefixPatch address_prefix_patch: The prefix patch.
+ :param str name: The bare metal server 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 `AddressPrefix` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerProfile` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if address_prefix_patch is None:
- raise ValueError('address_prefix_patch must be provided')
- if isinstance(address_prefix_patch, AddressPrefixPatch):
- address_prefix_patch = convert_model(address_prefix_patch)
+ if not name:
+ raise ValueError('name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpc_address_prefix',
+ operation_id='get_bare_metal_server_profile',
)
headers.update(sdk_headers)
@@ -939,106 +1028,91 @@ def update_vpc_address_prefix(
'generation': self.generation,
}
- data = json.dumps(address_prefix_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, 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 = '/vpcs/{vpc_id}/address_prefixes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_server/profiles/{name}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_vpc_dns_resolution_bindings(
+ def list_bare_metal_servers(
self,
- vpc_id: str,
*,
- sort: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
name: Optional[str] = None,
+ reservation_id: Optional[str] = None,
+ reservation_crn: Optional[str] = None,
+ reservation_name: Optional[str] = None,
+ vpc_id: Optional[str] = None,
vpc_crn: Optional[str] = None,
vpc_name: Optional[str] = None,
- account_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List DNS resolution bindings for a VPC.
+ List bare metal servers.
- This request lists DNS resolution bindings for a VPC. A DNS resolution binding
- represents an association with another VPC for centralizing DNS name resolution.
- If the VPC specified by the identifier in the URL is a DNS hub VPC (has
- `dns.enable_hub` set to `true`) then there is one binding for each VPC bound to
- the hub VPC. The endpoint gateways in the bound VPCs can allow (using
- `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS
- names.
- If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there
- is at most one binding (to a hub VPC). The endpoint gateways in the VPC specified
- by the identifier in the URL can allow (using `allow_dns_resolution_binding`) its
- hub VPC to centralize resolution of their DNS names.
- To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must
- delegate DNS resolution to its hub VPC by setting `dns.resolver.type` to
- `delegate`.
- The bindings will be sorted by their `created_at` property values, with newest
- bindings first. Bindings with identical `created_at` property values will in turn
- be sorted by ascending `name` property values.
+ This request lists bare metal servers in the region.
- :param str vpc_id: The VPC 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 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 with a `resource_group.id` property matching the specified
+ identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
+ :param str reservation_id: (optional) Filters the collection to resources
+ with a `reservation.id` property matching the specified identifier.
+ :param str reservation_crn: (optional) Filters the collection to resources
+ with a `reservation.crn` property matching the specified identifier.
+ :param str reservation_name: (optional) Filters the collection to resources
+ with a `reservation.name` property matching the specified identifier.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
:param str vpc_crn: (optional) Filters the collection to resources with a
`vpc.crn` property matching the specified CRN.
:param str vpc_name: (optional) Filters the collection to resources with a
`vpc.name` property matching the exact specified name.
- :param str account_id: (optional) Filters the collection to resources with
- a `vpc.remote.account.id` property matching the specified account
- 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 `VPCDNSResolutionBindingCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerCollection` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpc_dns_resolution_bindings',
+ operation_id='list_bare_metal_servers',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'sort': sort,
'start': start,
'limit': limit,
+ 'resource_group.id': resource_group_id,
'name': name,
+ 'reservation.id': reservation_id,
+ 'reservation.crn': reservation_crn,
+ 'reservation.name': reservation_name,
+ 'vpc.id': vpc_id,
'vpc.crn': vpc_crn,
'vpc.name': vpc_name,
- 'account.id': account_id,
}
if 'headers' in kwargs:
@@ -1046,10 +1120,7 @@ def list_vpc_dns_resolution_bindings(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/dns_resolution_bindings'.format(**path_param_dict)
+ url = '/bare_metal_servers'
request = self.prepare_request(
method='GET',
url=url,
@@ -1060,61 +1131,37 @@ def list_vpc_dns_resolution_bindings(
response = self.send(request, **kwargs)
return response
- def create_vpc_dns_resolution_binding(
+ def create_bare_metal_server(
self,
- vpc_id: str,
- vpc: 'VPCIdentity',
- *,
- name: Optional[str] = None,
+ bare_metal_server_prototype: 'BareMetalServerPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a DNS resolution binding.
+ Create a bare metal server.
- This request creates a new DNS resolution binding from a DNS resolution binding
- prototype object. The prototype object is structured in the same way as a
- retrieved DNS resolution binding, and contains the information necessary to create
- the new DNS resolution binding.
- For this request to succeed:
- - The VPC specified by the identifier in the URL must not already have a DNS
- resolution
- binding
- - The VPC specified by the identifier in the URL must have `dns.enable_hub` set to
- `false`
- - The updated DNS sharing connected topology must not contain more than one
- endpoint
- gateway with `allow_dns_resolution_binding` set to `true` targeting the same
- service.
- See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-vpe-dns-sharing) for
- more information.
+ This request provisions a new bare metal server from a prototype object. The
+ prototype object is structured in the same way as a retrieved bare metal server,
+ and contains the information necessary to provision the new bare metal server. The
+ bare metal server is automatically started.
+ For this request to succeed, the properties in the request must adhere to the
+ source image's `allowed_use` property.
- :param str vpc_id: The VPC identifier.
- :param VPCIdentity vpc: The VPC to bind this VPC to for DNS resolution. The
- VPC must be different from the VPC
- specified in the URL, must have `dns.enable_hub` set to `true`, and may be
- in a
- different account (subject to IAM policies).
- Additionally, the VPC specified in the URL (this VPC) must have
- `dns.enable_hub` set
- to `false` and a `dns.resolution_binding_count` of zero.
- :param str name: (optional) The name for this DNS resolution binding. The
- name must not be used by another DNS resolution binding for the VPC. If
- unspecified, the name will be a hyphenated list of randomly-selected words.
+ :param BareMetalServerPrototype bare_metal_server_prototype: The bare metal
+ server prototype object.
: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 `VPCDNSResolutionBinding` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServer` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if vpc is None:
- raise ValueError('vpc must be provided')
- vpc = convert_model(vpc)
+ if bare_metal_server_prototype is None:
+ raise ValueError('bare_metal_server_prototype must be provided')
+ if isinstance(bare_metal_server_prototype, BareMetalServerPrototype):
+ bare_metal_server_prototype = convert_model(bare_metal_server_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpc_dns_resolution_binding',
+ operation_id='create_bare_metal_server',
)
headers.update(sdk_headers)
@@ -1123,12 +1170,7 @@ def create_vpc_dns_resolution_binding(
'generation': self.generation,
}
- data = {
- 'vpc': vpc,
- 'name': name,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(bare_metal_server_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -1136,10 +1178,7 @@ def create_vpc_dns_resolution_binding(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/dns_resolution_bindings'.format(**path_param_dict)
+ url = '/bare_metal_servers'
request = self.prepare_request(
method='POST',
url=url,
@@ -1151,36 +1190,47 @@ def create_vpc_dns_resolution_binding(
response = self.send(request, **kwargs)
return response
- def delete_vpc_dns_resolution_binding(
+ def create_bare_metal_server_console_access_token(
self,
- vpc_id: str,
- id: str,
+ bare_metal_server_id: str,
+ console_type: str,
+ *,
+ force: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a DNS resolution binding.
+ Create a console access token for a bare metal server.
- This request deletes a DNS resolution binding. This operation cannot be reversed.
- For this request to succeed, the VPC specified by the identifier in the URL must
- not have
- `dns.resolver.type` set to `delegated`.
+ This request creates a new single-use console access token for a bare metal
+ server. All console configuration is provided at token create time, and the token
+ is subsequently used in the `access_token` query parameter for the WebSocket
+ request. The access token is only valid for a short period of time, and a maximum
+ of one token is valid for a given bare metal server at a time. For this request
+ to succeed, the server must have a `status` of `stopped`, `starting`, or
+ `running`.
- :param str vpc_id: The VPC identifier.
- :param str id: The DNS resolution binding identifier.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str console_type: The bare metal server console type for which this
+ token may be used
+ Must be `serial` for bare metal servers with a `cpu.architecture` of
+ `s390x`.
+ :param bool force: (optional) Indicates whether to disconnect an existing
+ serial console session as the serial console cannot be shared. This has no
+ effect on VNC consoles.
: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 `VPCDNSResolutionBinding` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerConsoleAccessToken` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if console_type is None:
+ raise ValueError('console_type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpc_dns_resolution_binding',
+ operation_id='create_bare_metal_server_console_access_token',
)
headers.update(sdk_headers)
@@ -1189,53 +1239,59 @@ def delete_vpc_dns_resolution_binding(
'generation': self.generation,
}
+ data = {
+ 'console_type': console_type,
+ 'force': force,
+ }
+ 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/dns_resolution_bindings/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/console_access_token'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_vpc_dns_resolution_binding(
+ def list_bare_metal_server_disks(
self,
- vpc_id: str,
- id: str,
+ bare_metal_server_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a DNS resolution binding.
+ List disks on a bare metal server.
- This request retrieves a single DNS resolution binding specified by the identifier
- in the URL.
+ This request lists disks on a bare metal server. A disk is a block device that
+ is locally attached to the physical server. By default, the listed disks are
+ sorted by their `created_at` property values, with the newest disk first.
- :param str vpc_id: The VPC identifier.
- :param str id: The DNS resolution binding identifier.
+ :param str bare_metal_server_id: The bare metal 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 `VPCDNSResolutionBinding` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerDiskCollection` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc_dns_resolution_binding',
+ operation_id='list_bare_metal_server_disks',
)
headers.update(sdk_headers)
@@ -1249,10 +1305,10 @@ def get_vpc_dns_resolution_binding(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/dns_resolution_bindings/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/disks'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -1263,43 +1319,33 @@ def get_vpc_dns_resolution_binding(
response = self.send(request, **kwargs)
return response
- def update_vpc_dns_resolution_binding(
+ def get_bare_metal_server_disk(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
- vpcdns_resolution_binding_patch: 'VPCDNSResolutionBindingPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a DNS resolution binding.
+ Retrieve a bare metal server disk.
- This request updates a DNS resolution binding with the information in a provided
- DNS resolution binding patch. The DNS resolution binding patch object is
- structured in the same way as a retrieved DNS resolution binding and contains only
- the information to be updated.
+ This request retrieves a single disk specified by the identifier in the URL.
- :param str vpc_id: The VPC identifier.
- :param str id: The DNS resolution binding identifier.
- :param VPCDNSResolutionBindingPatch vpcdns_resolution_binding_patch: The
- DNS resolution binding patch.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server disk 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 `VPCDNSResolutionBinding` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerDisk` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
- if vpcdns_resolution_binding_patch is None:
- raise ValueError('vpcdns_resolution_binding_patch must be provided')
- if isinstance(vpcdns_resolution_binding_patch, VPCDNSResolutionBindingPatch):
- vpcdns_resolution_binding_patch = convert_model(vpcdns_resolution_binding_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpc_dns_resolution_binding',
+ operation_id='get_bare_metal_server_disk',
)
headers.update(sdk_headers)
@@ -1308,191 +1354,190 @@ def update_vpc_dns_resolution_binding(
'generation': self.generation,
}
- data = json.dumps(vpcdns_resolution_binding_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/dns_resolution_bindings/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/disks/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_vpc_routes(
+ def update_bare_metal_server_disk(
self,
- vpc_id: str,
- *,
- zone_name: Optional[str] = None,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ bare_metal_server_id: str,
+ id: str,
+ bare_metal_server_disk_patch: 'BareMetalServerDiskPatch',
**kwargs,
) -> DetailedResponse:
"""
- List routes in a VPC's default routing table.
+ Update a bare metal server disk.
- This request lists routes in the VPC's default routing table. Each route is
- zone-specific and directs any packets matching its destination CIDR block to a
- `next_hop` IP address. The most specific route matching a packet's destination
- will be used. If multiple equally-specific routes exist, traffic will be
- distributed across them.
+ This request updates the bare metal server disk with the information in a provided
+ patch.
- :param str vpc_id: The VPC identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching 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 bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server disk identifier.
+ :param BareMetalServerDiskPatch bare_metal_server_disk_patch: The bare
+ metal server disk 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 `RouteCollectionVPCContext` object
-
- Deprecated: this method is deprecated and may be removed in a future release.
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerDisk` object
"""
- logging.warning('A deprecated operation has been invoked: list_vpc_routes')
-
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- headers = {}
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if bare_metal_server_disk_patch is None:
+ raise ValueError('bare_metal_server_disk_patch must be provided')
+ if isinstance(bare_metal_server_disk_patch, BareMetalServerDiskPatch):
+ bare_metal_server_disk_patch = convert_model(bare_metal_server_disk_patch)
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpc_routes',
+ operation_id='update_bare_metal_server_disk',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'zone.name': zone_name,
- 'start': start,
- 'limit': limit,
}
+ data = json.dumps(bare_metal_server_disk_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routes'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/disks/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_vpc_route(
+ def list_bare_metal_server_network_attachments(
self,
- vpc_id: str,
- destination: str,
- zone: 'ZoneIdentity',
+ bare_metal_server_id: str,
*,
- action: Optional[str] = None,
- advertise: Optional[bool] = None,
- name: Optional[str] = None,
- next_hop: Optional['RouteNextHopPrototype'] = None,
- priority: Optional[int] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a route in a VPC's default routing table.
+ List network attachments on a bare metal server.
- This request creates a new route in the VPC's default routing table. The route
- prototype object is structured in the same way as a retrieved route, and contains
- the information necessary to create the new route. The request will fail if the
- new route will cause a loop.
+ This request lists network attachments on a bare metal server. A bare metal server
+ network attachment is an abstract representation of a network device and attaches
+ a bare metal server to a single subnet. Each network interface on a bare metal
+ server can attach to any subnet in the zone, including subnets that are already
+ attached to the bare metal server.
+ The network attachments will be sorted by their `created_at` property values, with
+ newest network attachments first. Network attachments with identical `created_at`
+ property values will in turn be sorted by ascending `name` property values.
- :param str vpc_id: The VPC identifier.
- :param str destination: The destination CIDR of the route. The host
- identifier in the CIDR must be zero.
- At most two routes per `zone` in a table can have the same `destination`
- and
- `priority`, 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.
- If subnets are attached to the route's routing table, egress traffic from
- those
- subnets in this zone will be subject to this route. If this route's routing
- table
- has any of `route_direct_link_ingress`, `route_internet_ingress`,
- `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`,
- traffic
- from those ingress sources arriving 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 system-provided routes
- - `delegate_vpc`: delegate to system-provided routes, ignoring
- Internet-bound routes
- - `deliver`: deliver the packet to the specified `next_hop`
- - `drop`: drop the packet.
- :param bool advertise: (optional) Indicates whether this route will be
- advertised to the ingress sources specified by the `advertise_routes_to`
- routing table property.
- All routes in a routing table with the same `destination` and `zone` must
- have the same
- `advertise` value.
- :param str name: (optional) The name for this route. The name must not be
- used by another route in the routing table. Names starting with `ibm-` are
- reserved for system-provided routes, and are not allowed. If unspecified,
- the name will be a hyphenated list of randomly-selected words.
- :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`,
- the next hop that packets will be delivered to (must not be
- `0.0.0.0`). For other `action` values, it must be omitted or specified as
- `0.0.0.0`.
- At most two routes per `zone` in a table can have the same `destination`
- and `priority`,
- and only when each route has an `action` of `deliver` and `next_hop` is an
- IP address.
- :param int priority: (optional) The priority of this route. Smaller values
- have higher priority.
- If a routing table contains multiple routes with the same `zone` and
- `destination`, the route with the highest priority (smallest value) is
- selected. If two routes have the same `destination` and `priority`, traffic
- is distributed between them.
+ :param str bare_metal_server_id: The bare metal 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 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
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkAttachmentCollection` object
+ """
- Deprecated: this method is deprecated and may be removed in a future release.
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_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_attachments',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+ headers['Accept'] = 'application/json'
+
+ path_param_keys = ['bare_metal_server_id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments'.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_bare_metal_server_network_attachment(
+ self,
+ bare_metal_server_id: str,
+ bare_metal_server_network_attachment_prototype: 'BareMetalServerNetworkAttachmentPrototype',
+ **kwargs,
+ ) -> DetailedResponse:
"""
+ Create a network attachment on a bare metal server.
- logging.warning('A deprecated operation has been invoked: create_vpc_route')
+ This request creates a new bare metal server network attachment from a bare metal
+ server network attachment prototype object. The prototype object is structured in
+ the same way as a retrieved bare metal server network attachment, and contains the
+ information necessary to create the new bare metal server network attachment.
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if destination is None:
- raise ValueError('destination must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- zone = convert_model(zone)
- if next_hop is not None:
- next_hop = convert_model(next_hop)
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param BareMetalServerNetworkAttachmentPrototype
+ bare_metal_server_network_attachment_prototype: The bare metal server
+ network attachment prototype object.
+ :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 `BareMetalServerNetworkAttachment` object
+ """
+
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if bare_metal_server_network_attachment_prototype is None:
+ raise ValueError('bare_metal_server_network_attachment_prototype must be provided')
+ if isinstance(bare_metal_server_network_attachment_prototype, BareMetalServerNetworkAttachmentPrototype):
+ bare_metal_server_network_attachment_prototype = convert_model(bare_metal_server_network_attachment_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpc_route',
+ operation_id='create_bare_metal_server_network_attachment',
)
headers.update(sdk_headers)
@@ -1501,17 +1546,7 @@ def create_vpc_route(
'generation': self.generation,
}
- data = {
- 'destination': destination,
- 'zone': zone,
- 'action': action,
- 'advertise': advertise,
- 'name': name,
- 'next_hop': next_hop,
- 'priority': priority,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(bare_metal_server_network_attachment_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -1519,10 +1554,10 @@ def create_vpc_route(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_id)
+ path_param_keys = ['bare_metal_server_id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routes'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -1534,37 +1569,36 @@ def create_vpc_route(
response = self.send(request, **kwargs)
return response
- def delete_vpc_route(
+ def delete_bare_metal_server_network_attachment(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPC route.
+ Delete a bare metal server network attachment.
- This request deletes a route. This operation cannot be reversed.
+ This request deletes a bare metal server network attachment. This operation cannot
+ be reversed. Any floating IPs associated with the bare metal server network
+ attachment are implicitly disassociated.
+ The bare metal server's primary network attachment cannot be deleted.
- :param str vpc_id: The VPC identifier.
- :param str id: The route identifier.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server network attachment identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
-
- Deprecated: this method is deprecated and may be removed in a future release.
"""
- logging.warning('A deprecated operation has been invoked: delete_vpc_route')
-
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpc_route',
+ operation_id='delete_bare_metal_server_network_attachment',
)
headers.update(sdk_headers)
@@ -1577,10 +1611,10 @@ def delete_vpc_route(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -1591,37 +1625,34 @@ def delete_vpc_route(
response = self.send(request, **kwargs)
return response
- def get_vpc_route(
+ def get_bare_metal_server_network_attachment(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC route.
+ Retrieve a bare metal server network attachment.
- This request retrieves a single route specified by the identifier in the URL.
+ This request retrieves a single bare metal server network attachment specified by
+ the identifier in the URL.
- :param str vpc_id: The VPC identifier.
- :param str id: The route identifier.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server network attachment 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 `Route` object
-
- Deprecated: this method is deprecated and may be removed in a future release.
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkAttachment` object
"""
- logging.warning('A deprecated operation has been invoked: get_vpc_route')
-
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc_route',
+ operation_id='get_bare_metal_server_network_attachment',
)
headers.update(sdk_headers)
@@ -1635,10 +1666,10 @@ def get_vpc_route(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -1649,45 +1680,45 @@ def get_vpc_route(
response = self.send(request, **kwargs)
return response
- def update_vpc_route(
+ def update_bare_metal_server_network_attachment(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
- route_patch: 'RoutePatch',
+ bare_metal_server_network_attachment_patch: 'BareMetalServerNetworkAttachmentPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a VPC route.
+ Update a bare metal server network attachment.
- This request updates a route with the information in a provided route patch. The
- route patch object is structured in the same way as a retrieved route and contains
- only the information to be updated.
+ This request updates a bare metal server network attachment with the information
+ provided in a bare metal server network attachment patch object. The bare metal
+ server network attachment patch object is structured in the same way as a
+ retrieved bare metal server network attachment and contains only the information
+ to be updated.
- :param str vpc_id: The VPC identifier.
- :param str id: The route identifier.
- :param RoutePatch route_patch: The route patch.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server network attachment identifier.
+ :param BareMetalServerNetworkAttachmentPatch
+ bare_metal_server_network_attachment_patch: The bare metal server network
+ attachment 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 `Route` object
-
- Deprecated: this method is deprecated and may be removed in a future release.
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkAttachment` object
"""
- logging.warning('A deprecated operation has been invoked: update_vpc_route')
-
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
- if route_patch is None:
- raise ValueError('route_patch must be provided')
- if isinstance(route_patch, RoutePatch):
- route_patch = convert_model(route_patch)
+ if bare_metal_server_network_attachment_patch is None:
+ raise ValueError('bare_metal_server_network_attachment_patch must be provided')
+ if isinstance(bare_metal_server_network_attachment_patch, BareMetalServerNetworkAttachmentPatch):
+ bare_metal_server_network_attachment_patch = convert_model(bare_metal_server_network_attachment_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpc_route',
+ operation_id='update_bare_metal_server_network_attachment',
)
headers.update(sdk_headers)
@@ -1696,7 +1727,7 @@ def update_vpc_route(
'generation': self.generation,
}
- data = json.dumps(route_patch)
+ data = json.dumps(bare_metal_server_network_attachment_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -1704,10 +1735,10 @@ def update_vpc_route(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -1719,42 +1750,44 @@ def update_vpc_route(
response = self.send(request, **kwargs)
return response
- def list_vpc_routing_tables(
+ def list_bare_metal_server_network_interfaces(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
- is_default: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- List routing tables for a VPC.
+ List network interfaces on a bare metal server.
- This request lists routing tables for a VPC. Each subnet in a VPC is associated
- with a routing table, which controls delivery of packets sent on that subnet
- according to the action of the most specific matching route in the table. If
- multiple equally-specific routes exist, traffic will be distributed across them.
- If no routes match, delivery will be controlled by the system's built-in routes.
+ This request lists network interfaces on a bare metal server. A bare metal server
+ network interface is an abstract representation of a network device and attaches a
+ bare metal server to a single subnet. Each network interface on a bare metal
+ server can attach to any subnet in the zone, including subnets that are already
+ attached to the bare metal server.
+ If this bare metal server has network attachments, each returned network interface
+ is a [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface.
- :param str vpc_id: The VPC identifier.
+ :param str bare_metal_server_id: The bare metal 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 bool is_default: (optional) Filters the collection to routing tables
- with an `is_default` property matching the specified 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 `RoutingTableCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkInterfaceCollection` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpc_routing_tables',
+ operation_id='list_bare_metal_server_network_interfaces',
)
headers.update(sdk_headers)
@@ -1763,7 +1796,6 @@ def list_vpc_routing_tables(
'generation': self.generation,
'start': start,
'limit': limit,
- 'is_default': is_default,
}
if 'headers' in kwargs:
@@ -1771,10 +1803,10 @@ def list_vpc_routing_tables(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_id)
+ path_param_keys = ['bare_metal_server_id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routing_tables'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -1785,109 +1817,48 @@ def list_vpc_routing_tables(
response = self.send(request, **kwargs)
return response
- def create_vpc_routing_table(
+ def create_bare_metal_server_network_interface(
self,
- vpc_id: str,
- *,
- accept_routes_from: Optional[List['ResourceFilter']] = None,
- advertise_routes_to: Optional[List[str]] = None,
- name: Optional[str] = None,
- route_direct_link_ingress: Optional[bool] = None,
- route_internet_ingress: Optional[bool] = None,
- route_transit_gateway_ingress: Optional[bool] = None,
- route_vpc_zone_ingress: Optional[bool] = None,
- routes: Optional[List['RoutePrototype']] = None,
+ bare_metal_server_id: str,
+ bare_metal_server_network_interface_prototype: 'BareMetalServerNetworkInterfacePrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a routing table for a VPC.
+ Create a network interface on a bare metal server.
- This request creates a routing table from a routing table prototype object. The
- prototype object is structured in the same way as a retrieved routing table, and
- contains the information necessary to create the new routing table.
- At present, the routing table's `resource_group` will be inherited from its VPC,
- but may be specifiable in the future.
+ This request creates a new bare metal server network interface from a bare metal
+ server network interface prototype object. The prototype object is structured in
+ the same way as a retrieved bare metal server network interface, and contains the
+ information necessary to create the new bare metal server network interface. Any
+ subnet in the bare metal server's VPC may be specified, even if it is already
+ attached to another bare metal server network interface. Addresses on the bare
+ metal server network interface must be within the specified subnet's CIDR blocks.
+ If this bare metal server has network attachments, each network interface is a
+ [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and new network interfaces are not allowed to be created.
- :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.
- If specified, `resource_type` must be `vpn_gateway` or `vpn_server`.
- :param List[str] advertise_routes_to: (optional) The ingress sources to
- advertise routes to. Routes in the table with `advertise` enabled will be
- advertised to these sources.
- :param str name: (optional) The name for this routing table. The name must
- not be used by another routing table in the VPC. If unspecified, the name
- will be a hyphenated list of randomly-selected words.
- :param bool route_direct_link_ingress: (optional) If set to `true`, this
- routing table will be used to route traffic that originates from [Direct
- Link](https://cloud.ibm.com/docs/dl) to this VPC. The VPC must not already
- have a routing table with this property set to `true`.
- 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 in a subnet in the route's `zone`
- that is able to accept traffic. Therefore, if an incoming packet matches a
- route with a `next_hop` of 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_internet_ingress: (optional) If set to `true`, this
- routing table will be used to route traffic that originates from the
- internet. For this to succeed, the VPC must not already have a routing
- table with this property set to `true`.
- Incoming traffic will be routed according to the routing table with two
- exceptions:
- - Traffic destined for IP addresses associated with public gateways will
- not be
- subject to routes in this routing table.
- - Routes with an `action` of `deliver` are treated as `drop` unless the
- `next_hop` is
- an IP address in a subnet in the route's `zone` that is able to accept
- traffic.
- Therefore, if an incoming packet matches a route with a `next_hop` of a
- VPN gateway
- connection, the packet will be dropped.
- :param bool route_transit_gateway_ingress: (optional) If set to `true`,
- this routing table will be used to route traffic that originates from
- [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC.
- The VPC must not already have a routing table with this property set to
- `true`.
- 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 in a subnet in the route's `zone`
- that is able to accept traffic. Therefore, if an incoming packet matches a
- route with a `next_hop` of a VPN gateway connection, the packet will be
- dropped.
- :param bool route_vpc_zone_ingress: (optional) If set to `true`, this
- routing table will be used to route traffic that originates from subnets in
- other zones in this VPC. The VPC must not already have a routing table with
- this property set to `true`.
- 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 in a subnet in the route's `zone`
- that is able to accept traffic. Therefore, if an incoming packet matches a
- route with a `next_hop` of a VPN gateway connection, the packet will be
- dropped.
- :param List[RoutePrototype] routes: (optional) The prototype objects for
- routes to create for this routing table. If unspecified, the routing table
- will be created with no routes.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param BareMetalServerNetworkInterfacePrototype
+ bare_metal_server_network_interface_prototype: The bare metal server
+ network interface prototype object.
: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
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkInterface` object
"""
- if not vpc_id:
- 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]
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if bare_metal_server_network_interface_prototype is None:
+ raise ValueError('bare_metal_server_network_interface_prototype must be provided')
+ if isinstance(bare_metal_server_network_interface_prototype, BareMetalServerNetworkInterfacePrototype):
+ bare_metal_server_network_interface_prototype = convert_model(bare_metal_server_network_interface_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpc_routing_table',
+ operation_id='create_bare_metal_server_network_interface',
)
headers.update(sdk_headers)
@@ -1896,18 +1867,7 @@ def create_vpc_routing_table(
'generation': self.generation,
}
- data = {
- 'accept_routes_from': accept_routes_from,
- 'advertise_routes_to': advertise_routes_to,
- 'name': name,
- 'route_direct_link_ingress': route_direct_link_ingress,
- 'route_internet_ingress': route_internet_ingress,
- 'route_transit_gateway_ingress': route_transit_gateway_ingress,
- 'route_vpc_zone_ingress': route_vpc_zone_ingress,
- 'routes': routes,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(bare_metal_server_network_interface_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -1915,10 +1875,10 @@ def create_vpc_routing_table(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id']
- path_param_values = self.encode_path_vars(vpc_id)
+ path_param_keys = ['bare_metal_server_id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routing_tables'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -1930,41 +1890,41 @@ def create_vpc_routing_table(
response = self.send(request, **kwargs)
return response
- def delete_vpc_routing_table(
+ def delete_bare_metal_server_network_interface(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPC routing table.
+ Delete a bare metal server network interface.
- This request deletes a routing table. A routing table cannot be deleted if it is
- associated with any subnets in the VPC. Additionally, a VPC's default routing
- table cannot be deleted. This operation cannot be reversed.
+ This request deletes a bare metal server network interface. This operation cannot
+ be reversed. Any floating IPs associated with the bare metal server network
+ interface are implicitly disassociated. The primary bare metal server network
+ interface is not allowed to be deleted.
+ If this bare metal server has network attachments, this network interface is a
+ [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and is not allowed to be deleted.
- :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 str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server 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
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpc_routing_table',
+ operation_id='delete_bare_metal_server_network_interface',
)
headers.update(sdk_headers)
@@ -1977,10 +1937,10 @@ def delete_vpc_routing_table(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routing_tables/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -1991,34 +1951,39 @@ def delete_vpc_routing_table(
response = self.send(request, **kwargs)
return response
- def get_vpc_routing_table(
+ def get_bare_metal_server_network_interface(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC routing table.
+ Retrieve a bare metal server network interface.
- This request retrieves a single routing table specified by the identifier in the
- URL.
+ This request retrieves a single bare metal server network interface specified by
+ the identifier in the URL.
+ If this bare metal server has network attachments, the retrieved network interface
+ is a [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface.
- :param str vpc_id: The VPC identifier.
- :param str id: The routing table identifier.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server 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 `RoutingTable` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkInterface` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc_routing_table',
+ operation_id='get_bare_metal_server_network_interface',
)
headers.update(sdk_headers)
@@ -2032,10 +1997,10 @@ def get_vpc_routing_table(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routing_tables/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -2046,48 +2011,50 @@ def get_vpc_routing_table(
response = self.send(request, **kwargs)
return response
- def update_vpc_routing_table(
+ def update_bare_metal_server_network_interface(
self,
- vpc_id: str,
+ bare_metal_server_id: str,
id: str,
- routing_table_patch: 'RoutingTablePatch',
- *,
- if_match: Optional[str] = None,
+ bare_metal_server_network_interface_patch: 'BareMetalServerNetworkInterfacePatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a VPC routing table.
+ Update a bare metal server network interface.
- This request updates a routing table with the information in a provided routing
- table patch. The patch object is structured in the same way as a retrieved table
- and contains only the information to be updated.
+ This request updates a bare metal server network interface with the information
+ provided in a bare metal server network interface patch object. The bare metal
+ server network interface patch object is structured in the same way as a retrieved
+ bare metal server network interface and needs to contain only the information to
+ be updated.
+ If this bare metal server has network attachments, this network interface is a
+ [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and is not allowed to be updated.
- :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 str bare_metal_server_id: The bare metal server identifier.
+ :param str id: The bare metal server network interface identifier.
+ :param BareMetalServerNetworkInterfacePatch
+ bare_metal_server_network_interface_patch: The bare metal server network
+ interface 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 `RoutingTable` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerNetworkInterface` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
if not id:
raise ValueError('id must be provided')
- if routing_table_patch is None:
- raise ValueError('routing_table_patch must be provided')
- if isinstance(routing_table_patch, RoutingTablePatch):
- routing_table_patch = convert_model(routing_table_patch)
- headers = {
- 'If-Match': if_match,
- }
+ if bare_metal_server_network_interface_patch is None:
+ raise ValueError('bare_metal_server_network_interface_patch must be provided')
+ if isinstance(bare_metal_server_network_interface_patch, BareMetalServerNetworkInterfacePatch):
+ bare_metal_server_network_interface_patch = convert_model(bare_metal_server_network_interface_patch)
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpc_routing_table',
+ operation_id='update_bare_metal_server_network_interface',
)
headers.update(sdk_headers)
@@ -2096,7 +2063,7 @@ def update_vpc_routing_table(
'generation': self.generation,
}
- data = json.dumps(routing_table_patch)
+ data = json.dumps(bare_metal_server_network_interface_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -2104,10 +2071,10 @@ def update_vpc_routing_table(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_keys = ['bare_metal_server_id', 'id']
+ path_param_values = self.encode_path_vars(bare_metal_server_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpcs/{vpc_id}/routing_tables/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -2119,53 +2086,41 @@ def update_vpc_routing_table(
response = self.send(request, **kwargs)
return response
- def list_vpc_routing_table_routes(
+ def list_bare_metal_server_network_interface_floating_ips(
self,
- vpc_id: str,
- routing_table_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ bare_metal_server_id: str,
+ network_interface_id: str,
**kwargs,
) -> DetailedResponse:
"""
- List routes in a VPC routing table.
+ List floating IPs associated with a bare metal server network interface.
- This request lists routes in a VPC routing table. If subnets are associated with
- this routing table, delivery of packets sent on a subnet is performed according to
- the action of the most specific matching route in the table (provided the subnet
- and route are in the same zone). If multiple equally-specific routes exist, the
- route with the highest priority will be used. If two matching routes have the same
- destination and priority, traffic will be distributed between them. If no routes
- match, delivery will be controlled by the system's built-in routes.
+ This request lists floating IPs associated with a bare metal server network
+ interface.
- :param str vpc_id: The VPC identifier.
- :param str routing_table_id: The routing table 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 bare_metal_server_id: The bare metal server identifier.
+ :param str network_interface_id: The bare metal server 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 `RouteCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIPUnpaginatedCollection` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not routing_table_id:
- raise ValueError('routing_table_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not network_interface_id:
+ 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_vpc_routing_table_routes',
+ operation_id='list_bare_metal_server_network_interface_floating_ips',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -2173,10 +2128,10 @@ def list_vpc_routing_table_routes(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'routing_table_id']
- path_param_values = self.encode_path_vars(vpc_id, routing_table_id)
+ 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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -2187,97 +2142,39 @@ def list_vpc_routing_table_routes(
response = self.send(request, **kwargs)
return response
- def create_vpc_routing_table_route(
+ def remove_bare_metal_server_network_interface_floating_ip(
self,
- vpc_id: str,
- routing_table_id: str,
- destination: str,
- zone: 'ZoneIdentity',
- *,
- action: Optional[str] = None,
- advertise: Optional[bool] = None,
- name: Optional[str] = None,
- next_hop: Optional['RouteNextHopPrototype'] = None,
- priority: Optional[int] = None,
+ bare_metal_server_id: str,
+ network_interface_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a route in a VPC routing table.
+ Disassociate a floating IP from a bare metal server network interface.
- This request creates a new VPC route from a VPC route prototype object. The
- prototype object is structured in the same way as a retrieved VPC route and
- contains the information necessary to create the route.
+ This request disassociates the specified floating IP from the specified bare metal
+ server network interface.
- :param str vpc_id: The VPC identifier.
- :param str routing_table_id: The routing table identifier.
- :param str destination: The destination CIDR of the route. The host
- identifier in the CIDR must be zero.
- At most two routes per `zone` in a table can have the same `destination`
- and
- `priority`, 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.
- If subnets are attached to the route's routing table, egress traffic from
- those
- subnets in this zone will be subject to this route. If this route's routing
- table
- has any of `route_direct_link_ingress`, `route_internet_ingress`,
- `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`,
- traffic
- from those ingress sources arriving 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 system-provided routes
- - `delegate_vpc`: delegate to system-provided routes, ignoring
- Internet-bound routes
- - `deliver`: deliver the packet to the specified `next_hop`
- - `drop`: drop the packet.
- :param bool advertise: (optional) Indicates whether this route will be
- advertised to the ingress sources specified by the `advertise_routes_to`
- routing table property.
- All routes in a routing table with the same `destination` and `zone` must
- have the same
- `advertise` value.
- :param str name: (optional) The name for this route. The name must not be
- used by another route in the routing table. Names starting with `ibm-` are
- reserved for system-provided routes, and are not allowed. If unspecified,
- the name will be a hyphenated list of randomly-selected words.
- :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`,
- the next hop that packets will be delivered to (must not be
- `0.0.0.0`). For other `action` values, it must be omitted or specified as
- `0.0.0.0`.
- At most two routes per `zone` in a table can have the same `destination`
- and `priority`,
- and only when each route has an `action` of `deliver` and `next_hop` is an
- IP address.
- :param int priority: (optional) The priority of this route. Smaller values
- have higher priority.
- If a routing table contains multiple routes with the same `zone` and
- `destination`, the route with the highest priority (smallest value) is
- selected. If two routes have the same `destination` and `priority`, traffic
- is distributed between them.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str network_interface_id: The bare metal server network interface
+ identifier.
+ :param str id: The floating 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 `Route` object
+ :rtype: DetailedResponse
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not routing_table_id:
- raise ValueError('routing_table_id must be provided')
- if destination is None:
- raise ValueError('destination must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- zone = convert_model(zone)
- if next_hop is not None:
- next_hop = convert_model(next_hop)
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpc_routing_table_route',
+ operation_id='remove_bare_metal_server_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -2286,71 +2183,57 @@ def create_vpc_routing_table_route(
'generation': self.generation,
}
- data = {
- 'destination': destination,
- 'zone': zone,
- 'action': action,
- 'advertise': advertise,
- 'name': name,
- 'next_hop': next_hop,
- 'priority': priority,
- }
- 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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'routing_table_id']
- path_param_values = self.encode_path_vars(vpc_id, routing_table_id)
+ 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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_vpc_routing_table_route(
+ def get_bare_metal_server_network_interface_floating_ip(
self,
- vpc_id: str,
- routing_table_id: str,
+ bare_metal_server_id: str,
+ network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPC routing table route.
+ Retrieve associated floating IP.
- This request deletes a VPC route. This operation cannot be reversed. Only VPC
- routes with an `origin` of `user` are allowed to be deleted.
+ This request retrieves a specified floating IP if it is associated with the bare
+ metal server network interface specified in the URL.
- :param str vpc_id: The VPC identifier.
- :param str routing_table_id: The routing table identifier.
- :param str id: The VPC routing table route identifier.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str network_interface_id: The bare metal server network interface
+ identifier.
+ :param str id: The floating IP 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 `FloatingIP` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not routing_table_id:
- raise ValueError('routing_table_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpc_routing_table_route',
+ operation_id='get_bare_metal_server_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -2362,13 +2245,14 @@ def delete_vpc_routing_table_route(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'routing_table_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, routing_table_id, id)
+ 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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -2377,38 +2261,45 @@ def delete_vpc_routing_table_route(
response = self.send(request, **kwargs)
return response
- def get_vpc_routing_table_route(
+ def add_bare_metal_server_network_interface_floating_ip(
self,
- vpc_id: str,
- routing_table_id: str,
+ bare_metal_server_id: str,
+ network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPC routing table route.
+ Associate a floating IP with a bare metal server network interface.
- This request retrieves a single VPC route specified by the identifier in the URL
- path.
+ This request associates the specified floating IP with the specified bare metal
+ server network interface. If `enable_infrastructure_nat` is `false`, this adds the
+ IP to any existing associations. If `enable_infrastructure_nat` is `true`, this
+ replaces any existing association.
+ The existing floating IP must:
+ - not be required by another resource, such as a public gateway
+ - be in the same `zone` as the bare metal server
+ A request body is not required, and if provided, is ignored.
- :param str vpc_id: The VPC identifier.
- :param str routing_table_id: The routing table identifier.
- :param str id: The VPC routing table route identifier.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str network_interface_id: The bare metal server network interface
+ identifier.
+ :param str id: The floating 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 `Route` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIP` object
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not routing_table_id:
- raise ValueError('routing_table_id must be provided')
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpc_routing_table_route',
+ operation_id='add_bare_metal_server_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -2422,12 +2313,12 @@ def get_vpc_routing_table_route(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'routing_table_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, routing_table_id, id)
+ 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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PUT',
url=url,
headers=headers,
params=params,
@@ -2436,46 +2327,39 @@ def get_vpc_routing_table_route(
response = self.send(request, **kwargs)
return response
- def update_vpc_routing_table_route(
+ def list_bare_metal_server_network_interface_ips(
self,
- vpc_id: str,
- routing_table_id: str,
- id: str,
- route_patch: 'RoutePatch',
+ bare_metal_server_id: str,
+ network_interface_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Update a VPC routing table route.
+ List the primary reserved IP for a bare metal server network interface.
- This request updates a VPC route with the information provided in a route patch
- object. The patch object is structured in the same way as a retrieved VPC route
- and needs to contain only the information to be updated. Only VPC routes with an
- `origin` of `user` are allowed to be updated.
+ This request lists the primary reserved IP for a bare metal server network
+ interface.
- :param str vpc_id: The VPC identifier.
- :param str routing_table_id: The routing table identifier.
- :param str id: The VPC routing table route identifier.
- :param RoutePatch route_patch: The VPC route patch.
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str network_interface_id: The bare metal server 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 `Route` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollectionBareMetalServerNetworkInterfaceContext` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
- if not vpc_id:
- raise ValueError('vpc_id must be provided')
- if not routing_table_id:
- raise ValueError('routing_table_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if route_patch is None:
- raise ValueError('route_patch must be provided')
- if isinstance(route_patch, RoutePatch):
- route_patch = convert_model(route_patch)
+ logging.warning('A deprecated operation has been invoked: list_bare_metal_server_network_interface_ips')
+
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not network_interface_id:
+ 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='update_vpc_routing_table_route',
+ operation_id='list_bare_metal_server_network_interface_ips',
)
headers.update(sdk_headers)
@@ -2484,97 +2368,68 @@ def update_vpc_routing_table_route(
'generation': self.generation,
}
- data = json.dumps(route_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpc_id', 'routing_table_id', 'id']
- path_param_values = self.encode_path_vars(vpc_id, routing_table_id, id)
+ 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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Subnets
- #########################
-
- def list_subnets(
+ def get_bare_metal_server_network_interface_ip(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- zone_name: Optional[str] = None,
- vpc_id: Optional[str] = None,
- vpc_crn: Optional[str] = None,
- vpc_name: Optional[str] = None,
- routing_table_id: Optional[str] = None,
- routing_table_name: Optional[str] = None,
+ bare_metal_server_id: str,
+ network_interface_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List subnets.
+ Retrieve the primary reserved IP.
- This request lists subnets in the region. Subnets are contiguous ranges of IP
- addresses specified in CIDR block notation. Each subnet is within a particular
- zone and cannot span multiple zones or regions.
+ This request retrieves the primary reserved IP for a bare metal server network
+ interface.
- :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 with a `resource_group.id` property matching the specified
+ :param str bare_metal_server_id: The bare metal server identifier.
+ :param str network_interface_id: The bare metal server network interface
identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
- :param str routing_table_id: (optional) Filters the collection to subnets
- with a `routing_table.id` property matching the specified identifier.
- :param str routing_table_name: (optional) Filters the collection to subnets
- with a `routing_table.name` property matching the exact specified name.
+ :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 `SubnetCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
+ logging.warning('A deprecated operation has been invoked: get_bare_metal_server_network_interface_ip')
+
+ if not bare_metal_server_id:
+ raise ValueError('bare_metal_server_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_subnets',
+ operation_id='get_bare_metal_server_network_interface_ip',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
- 'zone.name': zone_name,
- 'vpc.id': vpc_id,
- 'vpc.crn': vpc_crn,
- 'vpc.name': vpc_name,
- 'routing_table.id': routing_table_id,
- 'routing_table.name': routing_table_name,
}
if 'headers' in kwargs:
@@ -2582,7 +2437,10 @@ def list_subnets(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/subnets'
+ 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,
@@ -2593,34 +2451,31 @@ def list_subnets(
response = self.send(request, **kwargs)
return response
- def create_subnet(
+ def delete_bare_metal_server(
self,
- subnet_prototype: 'SubnetPrototype',
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a subnet.
-
- This request creates a new subnet from a subnet prototype object. The prototype
- object is structured in the same way as a retrieved subnet, and contains the
- information necessary to create the new subnet. For this request to succeed, the
- prototype's CIDR block must not overlap with an existing subnet in the VPC.
+ Delete a bare metal server.
- :param SubnetPrototype subnet_prototype: The subnet prototype object.
+ This request deletes a bare metal server. This operation cannot be reversed. Any
+ floating IPs associated with the bare metal server network interfaces are
+ implicitly disassociated.
+
+ :param str id: The bare metal 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 `Subnet` object
+ :rtype: DetailedResponse
"""
- if subnet_prototype is None:
- raise ValueError('subnet_prototype must be provided')
- if isinstance(subnet_prototype, SubnetPrototype):
- subnet_prototype = convert_model(subnet_prototype)
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_subnet',
+ operation_id='delete_bare_metal_server',
)
headers.update(sdk_headers)
@@ -2629,46 +2484,39 @@ def create_subnet(
'generation': self.generation,
}
- data = json.dumps(subnet_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/subnets'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/bare_metal_servers/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_subnet(
+ def get_bare_metal_server(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a subnet.
+ Retrieve a bare metal server.
- This request deletes a subnet. This operation cannot be reversed. For this request
- to succeed, the subnet must not be referenced by any bare metal server network
- interfaces, instance network interfaces, virtual network interfaces, VPN gateways,
- or load balancers. A delete operation automatically detaches the subnet from any
- network ACLs, public gateways, or endpoint gateways. All flow log collectors with
- `auto_delete` set to `true` targeting the subnet or any resource in the subnet are
- automatically deleted.
+ This request retrieves a single bare metal server specified by the identifier in
+ the URL.
- :param str id: The subnet identifier.
+ :param str id: The bare metal server 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 `BareMetalServer` object
"""
if not id:
@@ -2677,7 +2525,7 @@ def delete_subnet(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_subnet',
+ operation_id='get_bare_metal_server',
)
headers.update(sdk_headers)
@@ -2689,13 +2537,14 @@ def delete_subnet(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/subnets/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -2704,29 +2553,40 @@ def delete_subnet(
response = self.send(request, **kwargs)
return response
- def get_subnet(
+ def update_bare_metal_server(
self,
id: str,
+ bare_metal_server_patch: 'BareMetalServerPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a subnet.
+ Update a bare metal server.
- This request retrieves a single subnet specified by the identifier in the URL.
+ This request updates a bare metal server with the information in a provided patch.
+ The bare metal server patch object is structured in the same way as a retrieved
+ bare metal server and contains only the information to be updated.
+ For this request to succeed, the properties in the request must adhere to the
+ `allowed_use` property of the disk referenced in the server's `boot_target`.
- :param str id: The subnet identifier.
+ :param str id: The bare metal server identifier.
+ :param BareMetalServerPatch bare_metal_server_patch: The bare metal server
+ 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 `Subnet` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServer` object
"""
if not id:
raise ValueError('id must be provided')
+ if bare_metal_server_patch is None:
+ raise ValueError('bare_metal_server_patch must be provided')
+ if isinstance(bare_metal_server_patch, BareMetalServerPatch):
+ bare_metal_server_patch = convert_model(bare_metal_server_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_subnet',
+ operation_id='update_bare_metal_server',
)
headers.update(sdk_headers)
@@ -2735,6 +2595,9 @@ def get_subnet(
'generation': self.generation,
}
+ data = json.dumps(bare_metal_server_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
@@ -2743,48 +2606,46 @@ def get_subnet(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_subnet(
+ def update_firmware_for_bare_metal_server(
self,
id: str,
- subnet_patch: 'SubnetPatch',
+ *,
+ auto_start: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a subnet.
+ Update firmware for a bare metal server.
- This request updates a subnet with the information in a provided subnet patch. The
- subnet patch object is structured in the same way as a retrieved subnet and
- contains only the information to be updated.
+ This request updates a bare metal server to the latest available firmware. The
+ server must be stopped.
- :param str id: The subnet identifier.
- :param SubnetPatch subnet_patch: The subnet patch.
+ :param str id: The bare metal server identifier.
+ :param bool auto_start: (optional) Indicates whether to automatically start
+ the bare metal server after the firmware update is successfully completed.
: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 `Subnet` object
+ :rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
- if subnet_patch is None:
- raise ValueError('subnet_patch must be provided')
- if isinstance(subnet_patch, SubnetPatch):
- subnet_patch = convert_model(subnet_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_subnet',
+ operation_id='update_firmware_for_bare_metal_server',
)
headers.update(sdk_headers)
@@ -2793,20 +2654,23 @@ def update_subnet(
'generation': self.generation,
}
- data = json.dumps(subnet_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = {
+ 'auto_start': auto_start,
+ }
+ 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'))
del kwargs['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 = '/subnets/{id}'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}/firmware/update'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -2816,21 +2680,22 @@ def update_subnet(
response = self.send(request, **kwargs)
return response
- def get_subnet_network_acl(
+ def get_bare_metal_server_initialization(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a subnet's attached network ACL.
+ Retrieve initialization configuration for a bare metal server.
- This request retrieves the network ACL attached to the subnet specified by the
- identifier in the URL.
+ This request retrieves configuration used to initialize the bare metal server,
+ such as the image used, SSH keys, and any configured usernames and passwords.
+ These can subsequently be changed on the server and therefore may not be current.
- :param str id: The subnet identifier.
+ :param str id: The bare metal 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 `NetworkACL` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerInitialization` object
"""
if not id:
@@ -2839,7 +2704,7 @@ def get_subnet_network_acl(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_subnet_network_acl',
+ operation_id='get_bare_metal_server_initialization',
)
headers.update(sdk_headers)
@@ -2856,7 +2721,7 @@ def get_subnet_network_acl(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{id}/network_acl'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}/initialization'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -2867,36 +2732,63 @@ def get_subnet_network_acl(
response = self.send(request, **kwargs)
return response
- def replace_subnet_network_acl(
+ def replace_bare_metal_server_initialization(
self,
id: str,
- network_acl_identity: 'NetworkACLIdentity',
+ image: 'ImageIdentity',
+ keys: List['KeyIdentity'],
+ *,
+ default_trusted_profile: Optional['BareMetalServerInitializationDefaultTrustedProfilePrototype'] = None,
+ user_data: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Replace the network ACL for a subnet.
+ Reinitialize a bare metal server.
- This request replaces the existing network ACL for a subnet with the network ACL
- specified in the request body.
+ This request reinitializes a bare metal server with the specified image and SSH
+ keys. The server must be stopped. Upon successful reinitiatilization, the bare
+ metal server will be started automatically.
+ For this request to succeed, the properties of the server which would result from
+ the reinitialization must adhere to the specified image's `allowed_use` property.
- :param str id: The subnet identifier.
- :param NetworkACLIdentity network_acl_identity: The network ACL identity.
+ :param str id: The bare metal server identifier.
+ :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 [default
+ user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
+ For Windows images, at least one key must be specified, and one will be
+ selected to encrypt the administrator password. Keys are optional for other
+ images, but if no keys are specified, the bare metal server will be
+ inaccessible unless the specified image provides another means of access.
+ :param BareMetalServerInitializationDefaultTrustedProfilePrototype
+ default_trusted_profile: (optional) The default trusted profile to be used
+ when initializing the bare metal server.
+ If unspecified, no default trusted profile will be made available.
+ :param str user_data: (optional) The user data to be made available when
+ initializing the bare metal server.
: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 `NetworkACL` object
+ :rtype: DetailedResponse with `dict` result representing a `BareMetalServerInitialization` object
"""
if not id:
raise ValueError('id must be provided')
- if network_acl_identity is None:
- raise ValueError('network_acl_identity must be provided')
- if isinstance(network_acl_identity, NetworkACLIdentity):
- network_acl_identity = convert_model(network_acl_identity)
+ if image is None:
+ raise ValueError('image must be provided')
+ if keys is None:
+ raise ValueError('keys must be provided')
+ image = convert_model(image)
+ keys = [convert_model(x) for x in keys]
+ if default_trusted_profile is not None:
+ default_trusted_profile = convert_model(default_trusted_profile)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='replace_subnet_network_acl',
+ operation_id='replace_bare_metal_server_initialization',
)
headers.update(sdk_headers)
@@ -2905,7 +2797,14 @@ def replace_subnet_network_acl(
'generation': self.generation,
}
- data = json.dumps(network_acl_identity)
+ data = {
+ 'image': image,
+ 'keys': keys,
+ 'default_trusted_profile': default_trusted_profile,
+ 'user_data': user_data,
+ }
+ 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:
@@ -2916,7 +2815,7 @@ def replace_subnet_network_acl(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{id}/network_acl'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}/initialization'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
@@ -2928,18 +2827,18 @@ def replace_subnet_network_acl(
response = self.send(request, **kwargs)
return response
- def unset_subnet_public_gateway(
+ def restart_bare_metal_server(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Detach a public gateway from a subnet.
+ Restart a bare metal server.
- This request detaches the public gateway from the subnet specified by the subnet
- identifier in the URL.
+ This request immediately restarts a bare metal server. For this request to
+ succeed, the server must have a `status` of `running`.
- :param str id: The subnet identifier.
+ :param str id: The bare metal server identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
@@ -2951,7 +2850,7 @@ def unset_subnet_public_gateway(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='unset_subnet_public_gateway',
+ operation_id='restart_bare_metal_server',
)
headers.update(sdk_headers)
@@ -2967,9 +2866,9 @@ def unset_subnet_public_gateway(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{id}/public_gateway'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}/restart'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -2978,21 +2877,21 @@ def unset_subnet_public_gateway(
response = self.send(request, **kwargs)
return response
- def get_subnet_public_gateway(
+ def start_bare_metal_server(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a subnet's attached public gateway.
+ Start a bare metal server.
- This request retrieves the public gateway attached to the subnet specified by the
- identifier in the URL.
+ This request starts a bare metal server. It will run immediately provided the
+ server is stopped.
- :param str id: The subnet identifier.
+ :param str id: The bare metal 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 `PublicGateway` object
+ :rtype: DetailedResponse
"""
if not id:
@@ -3001,7 +2900,7 @@ def get_subnet_public_gateway(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_subnet_public_gateway',
+ operation_id='start_bare_metal_server',
)
headers.update(sdk_headers)
@@ -3013,14 +2912,13 @@ def get_subnet_public_gateway(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/subnets/{id}/public_gateway'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}/start'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -3029,38 +2927,37 @@ def get_subnet_public_gateway(
response = self.send(request, **kwargs)
return response
- def set_subnet_public_gateway(
+ def stop_bare_metal_server(
self,
id: str,
- public_gateway_identity: 'PublicGatewayIdentity',
+ type: str,
**kwargs,
) -> DetailedResponse:
"""
- Attach a public gateway to a subnet.
+ Stop a bare metal server.
- This request attaches the public gateway, specified in the request body, to the
- subnet specified by the subnet identifier in the URL. The public gateway must have
- the same VPC and zone as the subnet.
+ This request stops a bare metal server. It will run immediately provided the
+ server is running. Note: A soft stop may not complete as it relies on the
+ operating system to perform the operation.
- :param str id: The subnet identifier.
- :param PublicGatewayIdentity public_gateway_identity: The public gateway
- identity.
+ :param str id: The bare metal server identifier.
+ :param str type: The type of stop operation:
+ - `soft`: signal running operating system to quiesce and shutdown cleanly
+ - `hard`: immediately stop the server.
: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 `PublicGateway` object
+ :rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
- if public_gateway_identity is None:
- raise ValueError('public_gateway_identity must be provided')
- if isinstance(public_gateway_identity, PublicGatewayIdentity):
- public_gateway_identity = convert_model(public_gateway_identity)
+ if type is None:
+ raise ValueError('type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='set_subnet_public_gateway',
+ operation_id='stop_bare_metal_server',
)
headers.update(sdk_headers)
@@ -3069,20 +2966,23 @@ def set_subnet_public_gateway(
'generation': self.generation,
}
- data = json.dumps(public_gateway_identity)
+ data = {
+ 'type': type,
+ }
+ 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'))
del kwargs['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 = '/subnets/{id}/public_gateway'.format(**path_param_dict)
+ url = '/bare_metal_servers/{id}/stop'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -3092,36 +2992,45 @@ def set_subnet_public_gateway(
response = self.send(request, **kwargs)
return response
- def get_subnet_routing_table(
+ #########################
+ # Cluster networks
+ #########################
+
+ def list_cluster_network_profiles(
self,
- id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a subnet's attached routing table.
+ List cluster network profiles.
- This request retrieves the routing table attached to the subnet specified by the
- identifier in the URL.
+ This request lists cluster network profiles available in the region. A cluster
+ network profile specifies the performance characteristics and capabilities for a
+ cluster network.
- :param str id: The subnet 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 `RoutingTable` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkProfileCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_subnet_routing_table',
+ operation_id='list_cluster_network_profiles',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -3129,10 +3038,7 @@ def get_subnet_routing_table(
del kwargs['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 = '/subnets/{id}/routing_table'.format(**path_param_dict)
+ url = '/cluster_network/profiles'
request = self.prepare_request(
method='GET',
url=url,
@@ -3143,40 +3049,30 @@ def get_subnet_routing_table(
response = self.send(request, **kwargs)
return response
- def replace_subnet_routing_table(
+ def get_cluster_network_profile(
self,
- id: str,
- routing_table_identity: 'RoutingTableIdentity',
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Replace the routing table for a subnet.
+ Retrieve a cluster network profile.
- This request replaces the existing routing table for a subnet with the routing
- table specified in the request body.
- For this request to succeed, the routing table `route_direct_link_ingress`,
- `route_internet_ingress`, `route_transit_gateway_ingress`, and
- `route_vpc_zone_ingress` properties must be `false`.
+ This request retrieves a single cluster network profile specified by the name in
+ the URL.
- :param str id: The subnet identifier.
- :param RoutingTableIdentity routing_table_identity: The routing table
- identity.
+ :param str name: The cluster network 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 `RoutingTable` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkProfile` object
"""
- if not id:
- raise ValueError('id must be provided')
- if routing_table_identity is None:
- raise ValueError('routing_table_identity must be provided')
- if isinstance(routing_table_identity, RoutingTableIdentity):
- routing_table_identity = convert_model(routing_table_identity)
+ if not name:
+ raise ValueError('name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='replace_subnet_routing_table',
+ operation_id='get_cluster_network_profile',
)
headers.update(sdk_headers)
@@ -3185,78 +3081,75 @@ def replace_subnet_routing_table(
'generation': self.generation,
}
- data = json.dumps(routing_table_identity)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/subnets/{id}/routing_table'.format(**path_param_dict)
+ url = '/cluster_network/profiles/{name}'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_subnet_reserved_ips(
+ def list_cluster_networks(
self,
- subnet_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ name: Optional[str] = None,
sort: Optional[str] = None,
- target_id: Optional[str] = None,
- target_crn: Optional[str] = None,
- target_name: Optional[str] = None,
- target_resource_type: Optional[str] = None,
+ vpc_id: Optional[str] = None,
+ vpc_crn: Optional[str] = None,
+ vpc_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List reserved IPs in a subnet.
+ List cluster networks.
- This request lists reserved IPs in a subnet. A reserved IP resource will exist for
- every address in the subnet which is not available for use.
+ This request lists [cluster
+ networks](https://cloud.ibm.com/docs/vpc?topic=vpc-about-cluster-network) in the
+ region. A cluster network is a grouping of resources in a separate networking
+ space for high performance computing and networking.
- :param str subnet_id: The subnet 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 resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
: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 str target_id: (optional) Filters the collection to resources with a
- `target.id` property matching the specified identifier.
- :param str target_crn: (optional) Filters the collection to resources with
- a `target.crn` property matching the specified CRN.
- :param str target_name: (optional) Filters the collection to resources with
- a `target.name` property matching the exact specified name.
- :param str target_resource_type: (optional) Filters the collection to
- resources with a `target.resource_type` property matching the specified
- value.
+ :param str vpc_id: (optional) Filters the collection to cluster networks
+ with a `vpc.id` property matching the specified id.
+ :param str vpc_crn: (optional) Filters the collection to cluster networks
+ with a `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to cluster networks
+ with a `vpc.name` property matching the 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 `ReservedIPCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkCollection` object
"""
- if not subnet_id:
- raise ValueError('subnet_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_subnet_reserved_ips',
+ operation_id='list_cluster_networks',
)
headers.update(sdk_headers)
@@ -3265,11 +3158,12 @@ def list_subnet_reserved_ips(
'generation': self.generation,
'start': start,
'limit': limit,
+ 'resource_group.id': resource_group_id,
+ 'name': name,
'sort': sort,
- 'target.id': target_id,
- 'target.crn': target_crn,
- 'target.name': target_name,
- 'target.resource_type': target_resource_type,
+ 'vpc.id': vpc_id,
+ 'vpc.crn': vpc_crn,
+ 'vpc.name': vpc_name,
}
if 'headers' in kwargs:
@@ -3277,10 +3171,7 @@ def list_subnet_reserved_ips(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['subnet_id']
- path_param_values = self.encode_path_vars(subnet_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{subnet_id}/reserved_ips'.format(**path_param_dict)
+ url = '/cluster_networks'
request = self.prepare_request(
method='GET',
url=url,
@@ -3291,56 +3182,64 @@ def list_subnet_reserved_ips(
response = self.send(request, **kwargs)
return response
- def create_subnet_reserved_ip(
+ def create_cluster_network(
self,
- subnet_id: str,
+ profile: 'ClusterNetworkProfileIdentity',
+ vpc: 'VPCIdentity',
+ zone: 'ZoneIdentity',
*,
- address: Optional[str] = None,
- auto_delete: Optional[bool] = None,
name: Optional[str] = None,
- target: Optional['ReservedIPTargetPrototype'] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ subnet_prefixes: Optional[List['ClusterNetworkSubnetPrefixPrototype']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Reserve an IP in a subnet.
+ Create a cluster network.
- This request reserves an IP address in a subnet. If the provided prototype object
- includes an `address`, the address must not already be reserved.
+ This request creates a new cluster network from a cluster network prototype
+ object. The prototype object is structured in the same way as a retrieved cluster
+ network, and contains the information necessary to create the new cluster network.
- :param str subnet_id: The subnet identifier.
- :param str address: (optional) The IP address to reserve, which must not
- already be reserved on the subnet.
- If unspecified, an available address on the subnet will automatically be
- selected.
- :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 name for this reserved IP. The name must
- not be used by another reserved IP in the subnet. Names starting with
- `ibm-` are reserved for provider-owned resources, and are not allowed. If
- unspecified, the name will be a hyphenated list of randomly-selected words.
- :param ReservedIPTargetPrototype target: (optional) The target to bind this
- reserved IP to. The target must be in the same VPC.
- The following targets are supported:
- - An endpoint gateway not already bound to a reserved IP in the subnet's
- zone.
- - A virtual network interface.
- If unspecified, the reserved IP will be created unbound.
+ :param ClusterNetworkProfileIdentity profile: The profile to use for this
+ cluster network.
+ :param VPCIdentity vpc: The VPC this cluster network will reside in.
+ :param ZoneIdentity zone: The zone this cluster network will reside in. The
+ zone must be listed
+ as supported on the specified cluster network profile.
+ :param str name: (optional) The name for this cluster network. The name
+ must not be used by another cluster network in the region. Names starting
+ with `ibm-` are reserved for provider-owned resources, and 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) will be
+ used.
+ :param List[ClusterNetworkSubnetPrefixPrototype] subnet_prefixes:
+ (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 `ReservedIP` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetwork` object
"""
- if not subnet_id:
- raise ValueError('subnet_id must be provided')
- if target is not None:
- target = convert_model(target)
+ if profile is None:
+ raise ValueError('profile must be provided')
+ if vpc is None:
+ raise ValueError('vpc must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ profile = convert_model(profile)
+ vpc = convert_model(vpc)
+ zone = convert_model(zone)
+ if resource_group is not None:
+ resource_group = convert_model(resource_group)
+ if subnet_prefixes is not None:
+ subnet_prefixes = [convert_model(x) for x in subnet_prefixes]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_subnet_reserved_ip',
+ operation_id='create_cluster_network',
)
headers.update(sdk_headers)
@@ -3350,10 +3249,12 @@ def create_subnet_reserved_ip(
}
data = {
- 'address': address,
- 'auto_delete': auto_delete,
+ 'profile': profile,
+ 'vpc': vpc,
+ 'zone': zone,
'name': name,
- 'target': target,
+ 'resource_group': resource_group,
+ 'subnet_prefixes': subnet_prefixes,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -3364,10 +3265,7 @@ def create_subnet_reserved_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['subnet_id']
- path_param_values = self.encode_path_vars(subnet_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{subnet_id}/reserved_ips'.format(**path_param_dict)
+ url = '/cluster_networks'
request = self.prepare_request(
method='POST',
url=url,
@@ -3379,55 +3277,74 @@ def create_subnet_reserved_ip(
response = self.send(request, **kwargs)
return response
- def delete_subnet_reserved_ip(
+ def list_cluster_network_interfaces(
self,
- subnet_id: str,
- id: str,
+ cluster_network_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ name: Optional[str] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a reserved IP.
+ List cluster network interfaces.
- This request releases a reserved IP. This operation cannot be reversed.
- For this request to succeed, the reserved IP must not be required by another
- resource, such as a bare metal server network interface, instance network
- interface or virtual network interface for which it is the primary IP. A
- provider-owned reserved IP is not allowed to be deleted.
+ This request lists cluster network interfaces in the region. A cluster network
+ interface is a logical abstraction of a cluster network interface in a subnet, and
+ may be attached to a target resource.
+ The cluster network interfaces will be sorted by their `created_at` property
+ values, with newest cluster network interfaces first. Cluster network interfaces
+ with identical
+ `created_at` property values will in turn be sorted by ascending `name` property
+ values.
- :param str subnet_id: The subnet identifier.
- :param str id: The reserved IP identifier.
+ :param str cluster_network_id: The cluster network 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 name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkInterfaceCollection` object
"""
- if not subnet_id:
- raise ValueError('subnet_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_subnet_reserved_ip',
+ operation_id='list_cluster_network_interfaces',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'name': name,
+ 'sort': sort,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['subnet_id', 'id']
- path_param_values = self.encode_path_vars(subnet_id, id)
+ path_param_keys = ['cluster_network_id']
+ path_param_values = self.encode_path_vars(cluster_network_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/interfaces'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -3436,34 +3353,64 @@ def delete_subnet_reserved_ip(
response = self.send(request, **kwargs)
return response
- def get_subnet_reserved_ip(
+ def create_cluster_network_interface(
self,
- subnet_id: str,
- id: str,
+ cluster_network_id: str,
+ *,
+ name: Optional[str] = None,
+ primary_ip: Optional['ClusterNetworkInterfacePrimaryIPPrototype'] = None,
+ subnet: Optional['ClusterNetworkSubnetIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a reserved IP.
+ Create a cluster network interface.
- This request retrieves a single reserved IP specified by the identifier in the
- URL.
+ This request creates a new cluster network interface from a cluster network
+ interface prototype object. The prototype object is structured in the same way as
+ a retrieved cluster network interface, and contains the information necessary to
+ create the new cluster network interface.
- :param str subnet_id: The subnet identifier.
- :param str id: The reserved IP identifier.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str name: (optional) The name for this cluster network interface.
+ The name must not be used by another interface in the cluster network.
+ Names beginning with `ibm-` are reserved for provider-owned resources, and
+ are not allowed. If unspecified, the name will be a hyphenated list of
+ randomly-selected words.
+ :param ClusterNetworkInterfacePrimaryIPPrototype primary_ip: (optional) The
+ primary IP address to bind to the cluster network interface. May be either
+ a cluster network subnet reserved IP identity, or a cluster network subnet
+ reserved IP
+ prototype object which will be used to create a new cluster network subnet
+ reserved IP.
+ If a cluster network subnet reserved IP identity is provided, the specified
+ cluster
+ network subnet reserved IP must be unbound.
+ If a cluster network subnet reserved IP prototype object with an address is
+ provided,
+ the address must be available on the cluster network interface's cluster
+ network
+ subnet. If no address is specified, an available address on the cluster
+ network subnet
+ will be automatically selected and reserved.
+ :param ClusterNetworkSubnetIdentity subnet: (optional) The associated
+ cluster network subnet. Required if `primary_ip` does not specify a cluster
+ network subnet reserved IP identity.
: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 `ClusterNetworkInterface` object
"""
- if not subnet_id:
- raise ValueError('subnet_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if primary_ip is not None:
+ primary_ip = convert_model(primary_ip)
+ if subnet is not None:
+ subnet = convert_model(subnet)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_subnet_reserved_ip',
+ operation_id='create_cluster_network_interface',
)
headers.update(sdk_headers)
@@ -3472,61 +3419,71 @@ def get_subnet_reserved_ip(
'generation': self.generation,
}
+ data = {
+ 'name': name,
+ 'primary_ip': primary_ip,
+ 'subnet': subnet,
+ }
+ 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['subnet_id', 'id']
- path_param_values = self.encode_path_vars(subnet_id, id)
+ path_param_keys = ['cluster_network_id']
+ path_param_values = self.encode_path_vars(cluster_network_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/interfaces'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_subnet_reserved_ip(
+ def delete_cluster_network_interface(
self,
- subnet_id: str,
+ cluster_network_id: str,
id: str,
- reserved_ip_patch: 'ReservedIPPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a reserved IP.
+ Delete a cluster network interface.
- This request updates a reserved IP with the information in a provided reserved IP
- patch. The reserved IP patch object is structured in the same way as a retrieved
- reserved IP and contains only the information to be updated.
- A provider-owned reserved IP is not allowed to be updated.
+ This request deletes a cluster network interface. This operation cannot be
+ reversed. For this request to succeed, the cluster network interface must not be
+ required by another resource, such as a cluster network attachment for a virtual
+ server instance.
- :param str subnet_id: The subnet identifier.
- :param str id: The reserved IP identifier.
- :param ReservedIPPatch reserved_ip_patch: The reserved IP patch.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str id: The cluster network interface 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 `ReservedIP` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkInterface` object
"""
- if not subnet_id:
- raise ValueError('subnet_id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
if not id:
raise ValueError('id must be provided')
- if reserved_ip_patch is None:
- raise ValueError('reserved_ip_patch must be provided')
- if isinstance(reserved_ip_patch, ReservedIPPatch):
- reserved_ip_patch = convert_model(reserved_ip_patch)
- headers = {}
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_subnet_reserved_ip',
+ operation_id='delete_cluster_network_interface',
)
headers.update(sdk_headers)
@@ -3535,98 +3492,59 @@ def update_subnet_reserved_ip(
'generation': self.generation,
}
- data = json.dumps(reserved_ip_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['subnet_id', 'id']
- path_param_values = self.encode_path_vars(subnet_id, id)
+ path_param_keys = ['cluster_network_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/subnets/{subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Images
- #########################
-
- def list_images(
+ def get_cluster_network_interface(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- status: Optional[List[str]] = None,
- visibility: Optional[str] = None,
- user_data_format: Optional[List[str]] = None,
- remote_account_id: Optional[str] = None,
+ cluster_network_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List images.
+ Retrieve a cluster network interface.
- This request lists images available in the region. An image provides source data
- for a volume. Images are either system-provided, or created from another source,
- such as importing from Cloud Object Storage.
+ This request retrieves a single cluster network interface specified by the
+ identifier in the URL.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param List[str] status: (optional) Filters the collection to images with a
- `status` property matching one of the specified comma-separated values.
- :param str visibility: (optional) Filters the collection to images with a
- `visibility` property matching the specified value.
- :param List[str] user_data_format: (optional) Filters the collection to
- images with a `user_data_format` property matching one of the specified
- comma-separated values.
- :param str remote_account_id: (optional) Filters the collection to images
- with a `remote.account.id` property matching the specified account
- identifier.
- This parameter also supports the values null and not:null which filter the
- collection to resources which have no remote account identifier or any
- remote account identifier, respectively.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str id: The cluster 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 `ImageCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkInterface` object
"""
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_images',
+ operation_id='get_cluster_network_interface',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
- 'name': name,
- 'status': convert_list(status),
- 'visibility': visibility,
- 'user_data_format': convert_list(user_data_format),
- 'remote.account.id': remote_account_id,
}
if 'headers' in kwargs:
@@ -3634,7 +3552,10 @@ def list_images(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/images'
+ path_param_keys = ['cluster_network_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/cluster_networks/{cluster_network_id}/interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -3645,35 +3566,50 @@ def list_images(
response = self.send(request, **kwargs)
return response
- def create_image(
+ def update_cluster_network_interface(
self,
- image_prototype: 'ImagePrototype',
+ cluster_network_id: str,
+ id: str,
+ cluster_network_interface_patch: 'ClusterNetworkInterfacePatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create an image.
+ Update a cluster network interface.
- This request creates a new image from an image prototype object. The prototype
- object is structured in the same way as a retrieved image, and contains the
- information necessary to create the new image. If an image is being imported, a
- URL to the image file on object storage must be specified. If an image is being
- created from an existing volume, that volume must be specified.
+ This request updates a cluster network interface with the information provided in
+ a cluster network interface patch object. The patch object is structured in the
+ same way as a retrieved cluster network interface and needs to contain only the
+ information to be updated.
- :param ImagePrototype image_prototype: The image prototype object.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str id: The cluster network interface identifier.
+ :param ClusterNetworkInterfacePatch cluster_network_interface_patch: The
+ cluster network interface 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 `Image` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkInterface` object
"""
- if image_prototype is None:
- raise ValueError('image_prototype must be provided')
- if isinstance(image_prototype, ImagePrototype):
- image_prototype = convert_model(image_prototype)
- headers = {}
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if cluster_network_interface_patch is None:
+ raise ValueError('cluster_network_interface_patch must be provided')
+ if isinstance(cluster_network_interface_patch, ClusterNetworkInterfacePatch):
+ cluster_network_interface_patch = convert_model(cluster_network_interface_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_image',
+ operation_id='update_cluster_network_interface',
)
headers.update(sdk_headers)
@@ -3682,17 +3618,20 @@ def create_image(
'generation': self.generation,
}
- data = json.dumps(image_prototype)
- headers['content-type'] = 'application/json'
+ data = json.dumps(cluster_network_interface_patch)
+ headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/images'
+ path_param_keys = ['cluster_network_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/cluster_networks/{cluster_network_id}/interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PATCH',
url=url,
headers=headers,
params=params,
@@ -3702,53 +3641,69 @@ def create_image(
response = self.send(request, **kwargs)
return response
- def delete_image(
+ def list_cluster_network_subnets(
self,
- id: str,
+ cluster_network_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ name: Optional[str] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete an image.
+ List cluster network subnets.
- This request deletes an image. Any active image export jobs will be completed
- first. This operation cannot be reversed. An image with `remote.account` set is
- not allowed to be deleted. Additionally, an image cannot be deleted if it:
- - has a `status` of `deleting`
- - has a `status` of `pending` with a `status_reasons` code of
- `image_request_in_progress`
- - has `catalog_offering.managed` set to `true`.
+ This request lists cluster network subnets in the cluster network. A cluster
+ network subnet provides network routing between other cluster network subnets
+ within a cluster network.
- :param str id: The image identifier.
+ :param str cluster_network_id: The cluster network 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 name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnetCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_image',
+ operation_id='list_cluster_network_subnets',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'name': name,
+ 'sort': sort,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['cluster_network_id']
+ path_param_values = self.encode_path_vars(cluster_network_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -3757,29 +3712,39 @@ def delete_image(
response = self.send(request, **kwargs)
return response
- def get_image(
+ def create_cluster_network_subnet(
self,
- id: str,
+ cluster_network_id: str,
+ cluster_network_subnet_prototype: 'ClusterNetworkSubnetPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an image.
+ Create a cluster network subnet.
- This request retrieves a single image specified by the identifier in the URL.
+ This request creates a new cluster network subnet from a cluster network subnet
+ prototype object. The prototype object is structured in the same way as a
+ retrieved cluster network subnet, and contains the information necessary to create
+ the new cluster network subnet.
- :param str id: The image identifier.
+ :param str cluster_network_id: The cluster network identifier.
+ :param ClusterNetworkSubnetPrototype cluster_network_subnet_prototype: The
+ cluster network subnet prototype object.
: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 `Image` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnet` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if cluster_network_subnet_prototype is None:
+ raise ValueError('cluster_network_subnet_prototype must be provided')
+ if isinstance(cluster_network_subnet_prototype, ClusterNetworkSubnetPrototype):
+ cluster_network_subnet_prototype = convert_model(cluster_network_subnet_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_image',
+ operation_id='create_cluster_network_subnet',
)
headers.update(sdk_headers)
@@ -3788,118 +3753,146 @@ def get_image(
'generation': self.generation,
}
+ data = json.dumps(cluster_network_subnet_prototype)
+ headers['content-type'] = 'application/json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['cluster_network_id']
+ path_param_values = self.encode_path_vars(cluster_network_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_image(
+ def list_cluster_network_subnet_reserved_ips(
self,
- id: str,
- image_patch: 'ImagePatch',
+ cluster_network_id: str,
+ cluster_network_subnet_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ name: Optional[str] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update an image.
+ List cluster network subnet reserved IPs.
- This request updates an image with the information in a provided image patch. The
- image patch object is structured in the same way as a retrieved image and contains
- only the information to be updated. An image with `remote.account` set is not
- allowed to be updated. An image with a `status` of `deleting` cannot be updated.
+ This request lists cluster network subnet reserved IPs in the cluster network.
- :param str id: The image identifier.
- :param ImagePatch image_patch: The image patch.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str cluster_network_subnet_id: The cluster network subnet
+ 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 name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :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 `Image` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnetReservedIPCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
- if image_patch is None:
- raise ValueError('image_patch must be provided')
- if isinstance(image_patch, ImagePatch):
- image_patch = convert_model(image_patch)
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not cluster_network_subnet_id:
+ raise ValueError('cluster_network_subnet_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_image',
+ operation_id='list_cluster_network_subnet_reserved_ips',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'name': name,
+ 'sort': sort,
}
- data = json.dumps(image_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id']
+ path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def deprecate_image(
+ def create_cluster_network_subnet_reserved_ip(
self,
- id: str,
+ cluster_network_id: str,
+ cluster_network_subnet_id: str,
+ *,
+ address: Optional[str] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Deprecate an image.
+ Create a cluster network subnet reserved IP.
- This request deprecates an image, resulting in its `status` becoming `deprecated`
- and
- `deprecation_at` being set to the current date and time.
- The image must:
- - have a `status` of `available`
- - have `catalog_offering.managed` set to `false`
- - not have `deprecation_at` set
- An image with `remote.account` set is not allowed to be deprecated.
+ This request creates a new cluster network subnet reserved IP from a cluster
+ network subnet reserved IP prototype object. The prototype object is structured in
+ the same way as a retrieved cluster network subnet reserved IP, and contains the
+ information necessary to create the new cluster network subnet reserved IP.
- :param str id: The image identifier.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str cluster_network_subnet_id: The cluster network subnet
+ identifier.
+ :param str address: (optional) The IP address to reserve, which must not
+ already be reserved on the subnet.
+ If unspecified, an available address on the subnet will automatically be
+ selected.
+ :param str name: (optional) The name for this cluster network subnet
+ reserved IP. The name must not be used by another reserved IP in the
+ cluster network subnet. Names starting with `ibm-` are reserved for
+ provider-owned resources, and are not allowed. 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
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnetReservedIP` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not cluster_network_subnet_id:
+ raise ValueError('cluster_network_subnet_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='deprecate_image',
+ operation_id='create_cluster_network_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -3908,54 +3901,75 @@ def deprecate_image(
'generation': self.generation,
}
+ data = {
+ 'address': address,
+ '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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id']
+ path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{id}/deprecate'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips'.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 obsolete_image(
+ def delete_cluster_network_subnet_reserved_ip(
self,
+ cluster_network_id: str,
+ cluster_network_subnet_id: str,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Obsolete an image.
+ Delete a cluster network subnet reserved IP.
- This request obsoletes an image, resulting in its `status` becoming `obsolete` and
- `obsolescence_at` being set to the current date and time.
- The image must:
- - have a `status` of `available` or `deprecated`
- - have `catalog_offering.managed` set to `false`
- - not have `deprecation_at` set in the future
- - not have `obsolescence_at` set
- An image with `remote.account` set is not allowed to be obsoleted.
+ This request deletes a cluster network subnet reserved IP. This operation cannot
+ be reversed.
+ For this request to succeed, the reserved IP must be unbound. A provider-owned
+ reserved IP is not allowed to be deleted.
- :param str id: The image identifier.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str cluster_network_subnet_id: The cluster network subnet
+ identifier.
+ :param str id: The cluster network subnet reserved IP 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
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnetReservedIP` object
"""
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not cluster_network_subnet_id:
+ raise ValueError('cluster_network_subnet_id must be provided')
if not id:
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='obsolete_image',
+ operation_id='delete_cluster_network_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -3967,13 +3981,14 @@ def obsolete_image(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{id}/obsolete'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -3982,45 +3997,45 @@ def obsolete_image(
response = self.send(request, **kwargs)
return response
- def list_image_export_jobs(
+ def get_cluster_network_subnet_reserved_ip(
self,
- image_id: str,
- *,
- name: Optional[str] = None,
+ cluster_network_id: str,
+ cluster_network_subnet_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List export jobs for an image.
+ Retrieve a cluster network subnet reserved IP.
- This request lists export jobs for an image. Each job tracks the exporting of the
- image to another location, such as a bucket within cloud object storage.
- The jobs will be sorted by their `created_at` property values, with newest jobs
- first. Jobs with identical `created_at` property values will in turn be sorted by
- ascending
- `name` property values.
+ This request retrieves a single cluster network subnet reserved IP specified by
+ the identifier in the URL.
- :param str image_id: The image identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str cluster_network_subnet_id: The cluster network subnet
+ identifier.
+ :param str id: The cluster network subnet 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 `ImageExportJobUnpaginatedCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnetReservedIP` object
"""
- if not image_id:
- raise ValueError('image_id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not cluster_network_subnet_id:
+ raise ValueError('cluster_network_subnet_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_image_export_jobs',
+ operation_id='get_cluster_network_subnet_reserved_ip',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'name': name,
}
if 'headers' in kwargs:
@@ -4028,10 +4043,10 @@ def list_image_export_jobs(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['image_id']
- path_param_values = self.encode_path_vars(image_id)
+ path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{image_id}/export_jobs'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -4042,54 +4057,56 @@ def list_image_export_jobs(
response = self.send(request, **kwargs)
return response
- def create_image_export_job(
+ def update_cluster_network_subnet_reserved_ip(
self,
- image_id: str,
- storage_bucket: 'CloudObjectStorageBucketIdentity',
+ cluster_network_id: str,
+ cluster_network_subnet_id: str,
+ id: str,
+ cluster_network_subnet_reserved_ip_patch: 'ClusterNetworkSubnetReservedIPPatch',
*,
- format: Optional[str] = None,
- name: Optional[str] = None,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create an export job for an image.
+ Update a cluster network subnet reserved IP.
- This request creates and queues a new export job for the image specified in the
- URL using the image export job prototype object. The image must be owned by the
- account and be in the `available`, `deprecated`, `obsolete`, or `unusable` state.
- The prototype object is structured in the same way as a retrieved image export
- job, and contains the information necessary to create and queue the new image
- export job.
+ This request updates a cluster network subnet reserved IP with the information
+ provided in a cluster network subnet reserved IP patch object. The patch object is
+ structured in the same way as a retrieved cluster network subnet reserved IP and
+ needs to contain only the information to be updated.
- :param str image_id: The image identifier.
- :param CloudObjectStorageBucketIdentity storage_bucket: The Cloud Object
- Storage bucket to export the image to. The bucket must exist and an IAM
- service authorization must grant `Image Service for VPC` of
- `VPC Infrastructure Services` writer access to the bucket.
- :param str format: (optional) The format to use for the exported image. If
- the image is encrypted, only `qcow2` is supported.
- :param str name: (optional) The name for this image export job. The name
- must not be used by another export job for the image. If unspecified, the
- name will be a hyphenated list of randomly-selected words prefixed with the
- first 16 characters of the parent image name.
- The exported image object name in Cloud Object Storage
- (`storage_object.name` in the response) will be based on this name. The
- object name will be unique within the bucket.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str cluster_network_subnet_id: The cluster network subnet
+ identifier.
+ :param str id: The cluster network subnet reserved IP identifier.
+ :param ClusterNetworkSubnetReservedIPPatch
+ cluster_network_subnet_reserved_ip_patch: The cluster network subnet
+ reserved IP 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 `ImageExportJob` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnetReservedIP` object
"""
- if not image_id:
- raise ValueError('image_id must be provided')
- if storage_bucket is None:
- raise ValueError('storage_bucket must be provided')
- storage_bucket = convert_model(storage_bucket)
- headers = {}
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
+ if not cluster_network_subnet_id:
+ raise ValueError('cluster_network_subnet_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if cluster_network_subnet_reserved_ip_patch is None:
+ raise ValueError('cluster_network_subnet_reserved_ip_patch must be provided')
+ if isinstance(cluster_network_subnet_reserved_ip_patch, ClusterNetworkSubnetReservedIPPatch):
+ cluster_network_subnet_reserved_ip_patch = convert_model(cluster_network_subnet_reserved_ip_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_image_export_job',
+ operation_id='update_cluster_network_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -4098,26 +4115,20 @@ def create_image_export_job(
'generation': self.generation,
}
- data = {
- 'storage_bucket': storage_bucket,
- 'format': format,
- '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'
+ data = json.dumps(cluster_network_subnet_reserved_ip_patch)
+ headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['image_id']
- path_param_values = self.encode_path_vars(image_id)
+ path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{image_id}/export_jobs'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PATCH',
url=url,
headers=headers,
params=params,
@@ -4127,36 +4138,41 @@ def create_image_export_job(
response = self.send(request, **kwargs)
return response
- def delete_image_export_job(
+ def delete_cluster_network_subnet(
self,
- image_id: str,
+ cluster_network_id: str,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete an image export job.
+ Delete a cluster network subnet.
- This request deletes an image export job. This operation cannot be reversed. If
- the job has not completed, the job will be canceled, and the incomplete exported
- image object deleted. If the job has completed, the exported image object will not
- be deleted.
+ This request deletes a cluster network subnet. This operation cannot be reversed.
+ For this request to succeed, this cluster subnet must not be attached to a cluster
+ network interface.
- :param str image_id: The image identifier.
- :param str id: The image export job identifier.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str id: The cluster network subnet 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
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnet` object
"""
- if not image_id:
- raise ValueError('image_id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
if not id:
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_image_export_job',
+ operation_id='delete_cluster_network_subnet',
)
headers.update(sdk_headers)
@@ -4168,11 +4184,12 @@ def delete_image_export_job(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['image_id', 'id']
- path_param_values = self.encode_path_vars(image_id, id)
+ path_param_keys = ['cluster_network_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{image_id}/export_jobs/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -4183,34 +4200,34 @@ def delete_image_export_job(
response = self.send(request, **kwargs)
return response
- def get_image_export_job(
+ def get_cluster_network_subnet(
self,
- image_id: str,
+ cluster_network_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an image export job.
+ Retrieve a cluster network subnet.
- This request retrieves a single image export job specified by the identifier in
- the URL.
+ This request retrieves a single cluster network subnet specified by the identifier
+ in the URL.
- :param str image_id: The image identifier.
- :param str id: The image export job identifier.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str id: The cluster network subnet 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 `ImageExportJob` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnet` object
"""
- if not image_id:
- raise ValueError('image_id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_image_export_job',
+ operation_id='get_cluster_network_subnet',
)
headers.update(sdk_headers)
@@ -4224,10 +4241,10 @@ def get_image_export_job(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['image_id', 'id']
- path_param_values = self.encode_path_vars(image_id, id)
+ path_param_keys = ['cluster_network_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{image_id}/export_jobs/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -4238,42 +4255,50 @@ def get_image_export_job(
response = self.send(request, **kwargs)
return response
- def update_image_export_job(
+ def update_cluster_network_subnet(
self,
- image_id: str,
+ cluster_network_id: str,
id: str,
- image_export_job_patch: 'ImageExportJobPatch',
+ cluster_network_subnet_patch: 'ClusterNetworkSubnetPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update an image export job.
+ Update a cluster network subnet.
- This request updates an image export job with the information in a provided image
- export job patch. The image export job patch object is structured in the same way
- as a retrieved image export job and contains only the information to be updated.
+ This request updates a cluster network subnet with the information provided in a
+ cluster network subnet patch object. The patch object is structured in the same
+ way as a retrieved cluster network subnet and needs to contain only the
+ information to be updated.
- :param str image_id: The image identifier.
- :param str id: The image export job identifier.
- :param ImageExportJobPatch image_export_job_patch: The image export job
- patch.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str id: The cluster network subnet identifier.
+ :param ClusterNetworkSubnetPatch cluster_network_subnet_patch: The cluster
+ network subnet 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 `ImageExportJob` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetworkSubnet` object
"""
- if not image_id:
- raise ValueError('image_id must be provided')
+ if not cluster_network_id:
+ raise ValueError('cluster_network_id must be provided')
if not id:
raise ValueError('id must be provided')
- if image_export_job_patch is None:
- raise ValueError('image_export_job_patch must be provided')
- if isinstance(image_export_job_patch, ImageExportJobPatch):
- image_export_job_patch = convert_model(image_export_job_patch)
- headers = {}
+ if cluster_network_subnet_patch is None:
+ raise ValueError('cluster_network_subnet_patch must be provided')
+ if isinstance(cluster_network_subnet_patch, ClusterNetworkSubnetPatch):
+ cluster_network_subnet_patch = convert_model(cluster_network_subnet_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_image_export_job',
+ operation_id='update_cluster_network_subnet',
)
headers.update(sdk_headers)
@@ -4282,7 +4307,7 @@ def update_image_export_job(
'generation': self.generation,
}
- data = json.dumps(image_export_job_patch)
+ data = json.dumps(cluster_network_subnet_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -4290,10 +4315,10 @@ def update_image_export_job(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['image_id', 'id']
- path_param_values = self.encode_path_vars(image_id, id)
+ path_param_keys = ['cluster_network_id', 'id']
+ path_param_values = self.encode_path_vars(cluster_network_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/images/{image_id}/export_jobs/{id}'.format(**path_param_dict)
+ url = '/cluster_networks/{cluster_network_id}/subnets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -4305,39 +4330,43 @@ def update_image_export_job(
response = self.send(request, **kwargs)
return response
- def list_operating_systems(
+ def delete_cluster_network(
self,
+ id: str,
*,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List operating systems.
+ Delete a cluster network.
- This request lists operating systems in the region.
+ This request deletes a cluster network. This operation cannot be reversed.
+ For this request to succeed, virtual server instances must not reside in this
+ cluster network.
- :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 id: The cluster network 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 `OperatingSystemCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetwork` object
"""
- headers = {}
+ if not id:
+ 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='list_operating_systems',
+ operation_id='delete_cluster_network',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -4345,9 +4374,12 @@ def list_operating_systems(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/operating_systems'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/cluster_networks/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -4356,29 +4388,30 @@ def list_operating_systems(
response = self.send(request, **kwargs)
return response
- def get_operating_system(
+ def get_cluster_network(
self,
- name: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an operating system.
+ Retrieve a cluster network.
- This request retrieves a single operating system specified by the name in the URL.
+ This request retrieves a single cluster network specified by the identifier in the
+ URL.
- :param str name: The operating system name.
+ :param str id: The cluster network 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 `OperatingSystem` object
+ :rtype: DetailedResponse with `dict` result representing a `ClusterNetwork` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_operating_system',
+ operation_id='get_cluster_network',
)
headers.update(sdk_headers)
@@ -4392,10 +4425,10 @@ def get_operating_system(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/operating_systems/{name}'.format(**path_param_dict)
+ url = '/cluster_networks/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -4406,23 +4439,96 @@ def get_operating_system(
response = self.send(request, **kwargs)
return response
+ def update_cluster_network(
+ self,
+ id: str,
+ cluster_network_patch: 'ClusterNetworkPatch',
+ *,
+ if_match: Optional[str] = None,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Update a cluster.
+
+ This request updates a cluster network with the information provided in a cluster
+ network patch object. The patch object is structured in the same way as a
+ retrieved cluster network and needs to contain only the information to be updated.
+
+ :param str id: The cluster network identifier.
+ :param ClusterNetworkPatch cluster_network_patch: The cluster network
+ 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 `ClusterNetwork` object
+ """
+
+ if not id:
+ raise ValueError('id must be provided')
+ if cluster_network_patch is None:
+ raise ValueError('cluster_network_patch must be provided')
+ if isinstance(cluster_network_patch, ClusterNetworkPatch):
+ cluster_network_patch = convert_model(cluster_network_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='update_cluster_network',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ data = json.dumps(cluster_network_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['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 = '/cluster_networks/{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
+
#########################
- # Keys
+ # Dedicated hosts
#########################
- def list_keys(
+ def list_dedicated_host_groups(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
+ zone_name: Optional[str] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List keys.
+ List dedicated host groups.
- This request lists keys in the region. A key contains a public SSH key which may
- be installed on instances when they are created. Private keys are not stored.
+ This request lists dedicated host groups in the region. Each dedicated host must
+ belong to exactly one group, which controls placement of instances. Dedicated host
+ groups do not span zones.
:param str start: (optional) A server-provided token determining what
resource to start the page on.
@@ -4430,16 +4536,20 @@ def list_keys(
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 `KeyCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostGroupCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_keys',
+ operation_id='list_dedicated_host_groups',
)
headers.update(sdk_headers)
@@ -4449,6 +4559,8 @@ def list_keys(
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
+ 'zone.name': zone_name,
+ 'name': name,
}
if 'headers' in kwargs:
@@ -4456,7 +4568,7 @@ def list_keys(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/keys'
+ url = '/dedicated_host/groups'
request = self.prepare_request(
method='GET',
url=url,
@@ -4467,52 +4579,53 @@ def list_keys(
response = self.send(request, **kwargs)
return response
- def create_key(
+ def create_dedicated_host_group(
self,
- public_key: str,
+ class_: str,
+ family: str,
+ zone: 'ZoneIdentity',
*,
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
- type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a key.
+ Create a dedicated host group.
- This request creates a new SSH key from an key prototype object. The prototype
- object is structured in the same way as a retrieved key, and contains the
- information necessary to create the new key. The public key value must be
- provided.
+ This request creates a new dedicated host group.
- :param str public_key: The public SSH key to use, in OpenSSH format
- (consisting of three space-separated fields: the algorithm name,
- base64-encoded key value, and a comment). The algorithm and comment fields
- may be omitted, as only the key field is used.
- The key field must not match another key in the region.
- Keys of type `rsa` must be 2048 or 4096 bits in length (4096 is
- recommended). Keys of type `ed25519` must be 256 bits in length.
- :param str name: (optional) The name for this key. The name must not be
- used by another key in the region. If unspecified, the name will be a
- hyphenated list of randomly-selected words.
+ :param str class_: The dedicated host profile class for hosts in this
+ group.
+ :param str family: The dedicated host profile family for hosts in this
+ group.
+ :param ZoneIdentity zone: The zone this dedicated host group will reside
+ in.
+ :param str name: (optional) The name for this dedicated host group. The
+ name must not be used by another dedicated host group in the region. 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) will be
used.
- :param str type: (optional) The crypto-system for this key.
: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 `Key` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostGroup` object
"""
- if public_key is None:
- raise ValueError('public_key must be provided')
+ if class_ is None:
+ raise ValueError('class_ must be provided')
+ if family is None:
+ raise ValueError('family must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ zone = convert_model(zone)
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_key',
+ operation_id='create_dedicated_host_group',
)
headers.update(sdk_headers)
@@ -4522,10 +4635,11 @@ def create_key(
}
data = {
- 'public_key': public_key,
+ 'class': class_,
+ 'family': family,
+ 'zone': zone,
'name': name,
'resource_group': resource_group,
- 'type': type,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -4536,7 +4650,7 @@ def create_key(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/keys'
+ url = '/dedicated_host/groups'
request = self.prepare_request(
method='POST',
url=url,
@@ -4548,17 +4662,17 @@ def create_key(
response = self.send(request, **kwargs)
return response
- def delete_key(
+ def delete_dedicated_host_group(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a key.
+ Delete a dedicated host group.
- This request deletes a key. This operation cannot be reversed.
+ This request deletes a dedicated host group.
- :param str id: The key identifier.
+ :param str id: The dedicated host group identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
@@ -4570,7 +4684,7 @@ def delete_key(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_key',
+ operation_id='delete_dedicated_host_group',
)
headers.update(sdk_headers)
@@ -4586,7 +4700,7 @@ def delete_key(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/keys/{id}'.format(**path_param_dict)
+ url = '/dedicated_host/groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -4597,20 +4711,21 @@ def delete_key(
response = self.send(request, **kwargs)
return response
- def get_key(
+ def get_dedicated_host_group(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a key.
+ Retrieve a dedicated host group.
- This request retrieves a single key specified by the identifier in the URL.
+ This request retrieves a single dedicated host group specified by the identifier
+ in the URL.
- :param str id: The key identifier.
+ :param str id: The dedicated host group 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 `Key` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostGroup` object
"""
if not id:
@@ -4619,7 +4734,7 @@ def get_key(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_key',
+ operation_id='get_dedicated_host_group',
)
headers.update(sdk_headers)
@@ -4636,7 +4751,7 @@ def get_key(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/keys/{id}'.format(**path_param_dict)
+ url = '/dedicated_host/groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -4647,35 +4762,39 @@ def get_key(
response = self.send(request, **kwargs)
return response
- def update_key(
+ def update_dedicated_host_group(
self,
id: str,
- key_patch: 'KeyPatch',
+ dedicated_host_group_patch: 'DedicatedHostGroupPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a key.
+ Update a dedicated host group.
- This request updates a key's name.
+ This request updates a dedicated host group with the information in a provided
+ dedicated host group patch. The dedicated host group patch object is structured in
+ the same way as a retrieved dedicated host group and contains only the information
+ to be updated.
- :param str id: The key identifier.
- :param KeyPatch key_patch: The key patch.
+ :param str id: The dedicated host group identifier.
+ :param DedicatedHostGroupPatch dedicated_host_group_patch: The dedicated
+ host group 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 `Key` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostGroup` object
"""
if not id:
raise ValueError('id must be provided')
- if key_patch is None:
- raise ValueError('key_patch must be provided')
- if isinstance(key_patch, KeyPatch):
- key_patch = convert_model(key_patch)
+ if dedicated_host_group_patch is None:
+ raise ValueError('dedicated_host_group_patch must be provided')
+ if isinstance(dedicated_host_group_patch, DedicatedHostGroupPatch):
+ dedicated_host_group_patch = convert_model(dedicated_host_group_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_key',
+ operation_id='update_dedicated_host_group',
)
headers.update(sdk_headers)
@@ -4684,7 +4803,7 @@ def update_key(
'generation': self.generation,
}
- data = json.dumps(key_patch)
+ data = json.dumps(dedicated_host_group_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -4695,7 +4814,7 @@ def update_key(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/keys/{id}'.format(**path_param_dict)
+ url = '/dedicated_host/groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -4707,38 +4826,42 @@ def update_key(
response = self.send(request, **kwargs)
return response
- #########################
- # Instances
- #########################
-
- def list_instance_profiles(
+ def list_dedicated_host_profiles(
self,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List instance profiles.
+ List dedicated host profiles.
- This request lists provisionable [instance
- profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the region. An
- instance profile specifies the performance characteristics and pricing model for
- an instance.
+ This request lists provisionable [dedicated host
+ profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in the region. A
+ dedicated host profile specifies the hardware characteristics for a dedicated
+ host.
+ :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 `InstanceProfileCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostProfileCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_profiles',
+ operation_id='list_dedicated_host_profiles',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -4746,7 +4869,7 @@ def list_instance_profiles(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/instance/profiles'
+ url = '/dedicated_host/profiles'
request = self.prepare_request(
method='GET',
url=url,
@@ -4757,20 +4880,21 @@ def list_instance_profiles(
response = self.send(request, **kwargs)
return response
- def get_instance_profile(
+ def get_dedicated_host_profile(
self,
name: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance profile.
+ Retrieve a dedicated host profile.
- This request retrieves a single instance profile specified by the name in the URL.
+ This request retrieves a single dedicated host profile specified by the name in
+ the URL.
- :param str name: The instance profile name.
+ :param str name: The dedicated host 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 `InstanceProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostProfile` object
"""
if not name:
@@ -4779,7 +4903,7 @@ def get_instance_profile(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_profile',
+ operation_id='get_dedicated_host_profile',
)
headers.update(sdk_headers)
@@ -4796,7 +4920,7 @@ def get_instance_profile(
path_param_keys = ['name']
path_param_values = self.encode_path_vars(name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instance/profiles/{name}'.format(**path_param_dict)
+ url = '/dedicated_host/profiles/{name}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -4807,31 +4931,57 @@ def get_instance_profile(
response = self.send(request, **kwargs)
return response
- def list_instance_templates(
+ def list_dedicated_hosts(
self,
+ *,
+ dedicated_host_group_id: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ zone_name: Optional[str] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List instance templates.
+ List dedicated hosts.
- This request lists instance templates in the region.
+ This request lists dedicated hosts in the region.
+ :param str dedicated_host_group_id: (optional) Filters the collection to
+ dedicated hosts with a `group.id` property matching the specified
+ 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 resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 `InstanceTemplateCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_templates',
+ operation_id='list_dedicated_hosts',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'dedicated_host_group.id': dedicated_host_group_id,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
+ 'zone.name': zone_name,
+ 'name': name,
}
if 'headers' in kwargs:
@@ -4839,7 +4989,7 @@ def list_instance_templates(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/instance/templates'
+ url = '/dedicated_hosts'
request = self.prepare_request(
method='GET',
url=url,
@@ -4850,37 +5000,32 @@ def list_instance_templates(
response = self.send(request, **kwargs)
return response
- def create_instance_template(
+ def create_dedicated_host(
self,
- instance_template_prototype: 'InstanceTemplatePrototype',
+ dedicated_host_prototype: 'DedicatedHostPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create an instance template.
+ Create a dedicated host.
- This request creates a new instance template. The prototype object is structured
- in the same way as a retrieved instance template, and contains the information
- necessary to provision a new instance from the template.
- If a `source_template` is specified in the prototype object, its contents are
- copied into the new template prior to copying any other properties provided in the
- prototype object.
+ This request creates a new dedicated host.
- :param InstanceTemplatePrototype instance_template_prototype: The instance
- template prototype object.
+ :param DedicatedHostPrototype dedicated_host_prototype: The dedicated host
+ prototype object.
: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 `InstanceTemplate` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHost` object
"""
- if instance_template_prototype is None:
- raise ValueError('instance_template_prototype must be provided')
- if isinstance(instance_template_prototype, InstanceTemplatePrototype):
- instance_template_prototype = convert_model(instance_template_prototype)
+ if dedicated_host_prototype is None:
+ raise ValueError('dedicated_host_prototype must be provided')
+ if isinstance(dedicated_host_prototype, DedicatedHostPrototype):
+ dedicated_host_prototype = convert_model(dedicated_host_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_instance_template',
+ operation_id='create_dedicated_host',
)
headers.update(sdk_headers)
@@ -4889,7 +5034,7 @@ def create_instance_template(
'generation': self.generation,
}
- data = json.dumps(instance_template_prototype)
+ data = json.dumps(dedicated_host_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -4897,7 +5042,7 @@ def create_instance_template(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/instance/templates'
+ url = '/dedicated_hosts'
request = self.prepare_request(
method='POST',
url=url,
@@ -4909,29 +5054,32 @@ def create_instance_template(
response = self.send(request, **kwargs)
return response
- def delete_instance_template(
+ def list_dedicated_host_disks(
self,
- id: str,
+ dedicated_host_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an instance template.
+ List disks on a dedicated host.
- This request deletes the instance template. This operation cannot be reversed.
+ This request lists disks on a dedicated host. A disk is a physical device that is
+ locally attached to the compute node. By default, the listed disks are sorted by
+ their
+ `created_at` property values, with the newest disk first.
- :param str id: The instance template identifier.
+ :param str dedicated_host_id: The dedicated host 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 `DedicatedHostDiskCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not dedicated_host_id:
+ raise ValueError('dedicated_host_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_instance_template',
+ operation_id='list_dedicated_host_disks',
)
headers.update(sdk_headers)
@@ -4943,13 +5091,14 @@ def delete_instance_template(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['dedicated_host_id']
+ path_param_values = self.encode_path_vars(dedicated_host_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instance/templates/{id}'.format(**path_param_dict)
+ url = '/dedicated_hosts/{dedicated_host_id}/disks'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -4958,30 +5107,34 @@ def delete_instance_template(
response = self.send(request, **kwargs)
return response
- def get_instance_template(
+ def get_dedicated_host_disk(
self,
+ dedicated_host_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance template.
+ Retrieve a dedicated host disk.
- This request retrieves a single instance template specified by the identifier in
+ This request retrieves a single dedicated host disk specified by the identifier in
the URL.
- :param str id: The instance template identifier.
+ :param str dedicated_host_id: The dedicated host identifier.
+ :param str id: The dedicated host disk 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 `InstanceTemplate` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostDisk` object
"""
+ if not dedicated_host_id:
+ raise ValueError('dedicated_host_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_template',
+ operation_id='get_dedicated_host_disk',
)
headers.update(sdk_headers)
@@ -4995,10 +5148,10 @@ def get_instance_template(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['dedicated_host_id', 'id']
+ path_param_values = self.encode_path_vars(dedicated_host_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instance/templates/{id}'.format(**path_param_dict)
+ url = '/dedicated_hosts/{dedicated_host_id}/disks/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -5009,39 +5162,41 @@ def get_instance_template(
response = self.send(request, **kwargs)
return response
- def update_instance_template(
+ def update_dedicated_host_disk(
self,
+ dedicated_host_id: str,
id: str,
- instance_template_patch: 'InstanceTemplatePatch',
+ dedicated_host_disk_patch: 'DedicatedHostDiskPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an instance template.
+ Update a dedicated host disk.
- This request updates an instance template with the information provided in the
- instance template patch. The instance template patch object is structured in the
- same way as a retrieved instance template and contains only the information to be
- updated.
+ This request updates the dedicated host disk with the information in a provided
+ patch.
- :param str id: The instance template identifier.
- :param InstanceTemplatePatch instance_template_patch: The instance template
- patch.
+ :param str dedicated_host_id: The dedicated host identifier.
+ :param str id: The dedicated host disk identifier.
+ :param DedicatedHostDiskPatch dedicated_host_disk_patch: The dedicated host
+ disk 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 `InstanceTemplate` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHostDisk` object
"""
+ if not dedicated_host_id:
+ raise ValueError('dedicated_host_id must be provided')
if not id:
raise ValueError('id must be provided')
- if instance_template_patch is None:
- raise ValueError('instance_template_patch must be provided')
- if isinstance(instance_template_patch, InstanceTemplatePatch):
- instance_template_patch = convert_model(instance_template_patch)
+ if dedicated_host_disk_patch is None:
+ raise ValueError('dedicated_host_disk_patch must be provided')
+ if isinstance(dedicated_host_disk_patch, DedicatedHostDiskPatch):
+ dedicated_host_disk_patch = convert_model(dedicated_host_disk_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_instance_template',
+ operation_id='update_dedicated_host_disk',
)
headers.update(sdk_headers)
@@ -5050,7 +5205,7 @@ def update_instance_template(
'generation': self.generation,
}
- data = json.dumps(instance_template_patch)
+ data = json.dumps(dedicated_host_disk_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -5058,10 +5213,10 @@ def update_instance_template(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['dedicated_host_id', 'id']
+ path_param_values = self.encode_path_vars(dedicated_host_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instance/templates/{id}'.format(**path_param_dict)
+ url = '/dedicated_hosts/{dedicated_host_id}/disks/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -5073,130 +5228,49 @@ def update_instance_template(
response = self.send(request, **kwargs)
return response
- def list_instances(
+ def delete_dedicated_host(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- cluster_network_id: Optional[str] = None,
- cluster_network_crn: Optional[str] = None,
- cluster_network_name: Optional[str] = None,
- dedicated_host_id: Optional[str] = None,
- dedicated_host_crn: Optional[str] = None,
- dedicated_host_name: Optional[str] = None,
- placement_group_id: Optional[str] = None,
- placement_group_crn: Optional[str] = None,
- placement_group_name: Optional[str] = None,
- reservation_affinity_policy: Optional[str] = None,
- reservation_id: Optional[str] = None,
- reservation_crn: Optional[str] = None,
- reservation_name: Optional[str] = None,
- vpc_id: Optional[str] = None,
- vpc_crn: Optional[str] = None,
- vpc_name: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List instances.
+ Delete a dedicated host.
- This request lists instances in the region.
+ This request deletes a dedicated host. This operation cannot be reversed. For this
+ request to succeed, `instances` must be empty and `instance_placement_enabled`
+ must be `false`.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str cluster_network_id: (optional) Filters the collection to
- instances with a `cluster_network.id` property matching the specified
- identifier.
- :param str cluster_network_crn: (optional) Filters the collection to
- instances with a `cluster_network.crn` property matching the specified CRN.
- :param str cluster_network_name: (optional) Filters the collection to
- resources with a `cluster_network.name` property matching the exact
- specified name.
- :param str dedicated_host_id: (optional) Filters the collection to
- resources with a `dedicated_host.id` property matching the specified
- identifier.
- :param str dedicated_host_crn: (optional) Filters the collection to
- resources with a `dedicated_host.crn` property matching the specified CRN.
- :param str dedicated_host_name: (optional) Filters the collection to
- resources with a `dedicated_host.name` property matching the exact
- specified name.
- :param str placement_group_id: (optional) Filters the collection to
- resources with a `placement_target.id` property matching the specified
- placement group identifier.
- :param str placement_group_crn: (optional) Filters the collection to
- resources with a `placement_target.crn` property matching the specified
- placement group CRN.
- :param str placement_group_name: (optional) Filters the collection to
- resources with a `placement_target.name` property matching the exact
- specified placement group name.
- :param str reservation_affinity_policy: (optional) Filters the collection
- to instances with a `reservation_affinity.policy` property matching the
- specified value.
- :param str reservation_id: (optional) Filters the collection to resources
- with a `reservation.id` property matching the specified identifier.
- :param str reservation_crn: (optional) Filters the collection to resources
- with a `reservation.crn` property matching the specified identifier.
- :param str reservation_name: (optional) Filters the collection to resources
- with a `reservation.name` property matching the specified identifier.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
+ :param str id: The dedicated host 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 `InstanceCollection` object
+ :rtype: DetailedResponse
"""
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instances',
+ operation_id='delete_dedicated_host',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
- 'name': name,
- 'cluster_network.id': cluster_network_id,
- 'cluster_network.crn': cluster_network_crn,
- 'cluster_network.name': cluster_network_name,
- 'dedicated_host.id': dedicated_host_id,
- 'dedicated_host.crn': dedicated_host_crn,
- 'dedicated_host.name': dedicated_host_name,
- 'placement_group.id': placement_group_id,
- 'placement_group.crn': placement_group_crn,
- 'placement_group.name': placement_group_name,
- 'reservation_affinity.policy': reservation_affinity_policy,
- 'reservation.id': reservation_id,
- 'reservation.crn': reservation_crn,
- 'reservation.name': reservation_name,
- 'vpc.id': vpc_id,
- 'vpc.crn': vpc_crn,
- 'vpc.name': vpc_name,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/instances'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/dedicated_hosts/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -5205,34 +5279,30 @@ def list_instances(
response = self.send(request, **kwargs)
return response
- def create_instance(
+ def get_dedicated_host(
self,
- instance_prototype: 'InstancePrototype',
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create an instance.
+ Retrieve a dedicated host.
- This request provisions a new instance from an instance prototype object. The
- prototype object is structured in the same way as a retrieved instance, and
- contains the information necessary to provision the new instance. The instance is
- automatically started.
+ This request retrieves a single dedicated host specified by the identifiers in the
+ URL.
- :param InstancePrototype instance_prototype: The instance prototype object.
+ :param str id: The dedicated host 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 `Instance` object
+ :rtype: DetailedResponse with `dict` result representing a `DedicatedHost` object
"""
- if instance_prototype is None:
- raise ValueError('instance_prototype must be provided')
- if isinstance(instance_prototype, InstancePrototype):
- instance_prototype = convert_model(instance_prototype)
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_instance',
+ operation_id='get_dedicated_host',
)
headers.update(sdk_headers)
@@ -5241,62 +5311,56 @@ def create_instance(
'generation': self.generation,
}
- data = json.dumps(instance_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/instances'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/dedicated_hosts/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_instance(
+ def update_dedicated_host(
self,
id: str,
- *,
- if_match: Optional[str] = None,
+ dedicated_host_patch: 'DedicatedHostPatch',
**kwargs,
) -> DetailedResponse:
"""
- Delete an instance.
+ Update a dedicated host.
- This request deletes an instance. This operation cannot be reversed. Any floating
- IPs associated with instance network interfaces are implicitly disassociated. All
- virtual network interfaces with `auto_delete` set to `true` targeting instance
- network attachments on the instance are automatically deleted. All flow log
- collectors with
- `auto_delete` set to `true` targeting the instance, the instance network
- attachments, the instance network interfaces, or the automatically deleted virtual
- network interfaces are automatically deleted.
+ This request updates a dedicated host with the information in a provided dedicated
+ host patch. The dedicated host patch object is structured in the same way as a
+ retrieved dedicated host and contains only the information to be updated.
- :param str id: The virtual server instance 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 str id: The dedicated host identifier.
+ :param DedicatedHostPatch dedicated_host_patch: The dedicated host patch.
: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 `DedicatedHost` object
"""
if not id:
raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ if dedicated_host_patch is None:
+ raise ValueError('dedicated_host_patch must be provided')
+ if isinstance(dedicated_host_patch, DedicatedHostPatch):
+ dedicated_host_patch = convert_model(dedicated_host_patch)
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_instance',
+ operation_id='update_dedicated_host',
)
headers.update(sdk_headers)
@@ -5305,53 +5369,101 @@ def delete_instance(
'generation': self.generation,
}
+ data = json.dumps(dedicated_host_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/instances/{id}'.format(**path_param_dict)
+ url = '/dedicated_hosts/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_instance(
+ #########################
+ # Endpoint gateways
+ #########################
+
+ def list_endpoint_gateways(
self,
- id: str,
+ *,
+ name: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ lifecycle_state: Optional[List[str]] = None,
+ vpc_id: Optional[str] = None,
+ vpc_crn: Optional[str] = None,
+ vpc_name: Optional[str] = None,
+ allow_dns_resolution_binding: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance.
+ List endpoint gateways.
- This request retrieves a single instance specified by the identifier in the URL.
+ This request lists endpoint gateways in the region. An endpoint gateway maps one
+ or more reserved IPs in a VPC to a target outside the VPC.
+ The endpoint gateways will be sorted by their `created_at` property values, with
+ newest endpoint gateway first. Endpoint gateways with identical `created_at`
+ property values will in turn be sorted by ascending `name` property values.
- :param str id: The virtual server instance identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 with a `resource_group.id` property matching the specified
+ identifier.
+ :param List[str] lifecycle_state: (optional) Filters the collection to
+ resources with a `lifecycle_state` property matching one of the specified
+ comma-separated values.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param bool allow_dns_resolution_binding: (optional) Filters the collection
+ to endpoint gateways with an `allow_dns_resolution_binding` property
+ matching the specified 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 `Instance` object
+ :rtype: DetailedResponse with `dict` result representing a `EndpointGatewayCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance',
+ 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,
+ 'lifecycle_state': convert_list(lifecycle_state),
+ 'vpc.id': vpc_id,
+ 'vpc.crn': vpc_crn,
+ 'vpc.name': vpc_name,
+ 'allow_dns_resolution_binding': allow_dns_resolution_binding,
}
if 'headers' in kwargs:
@@ -5359,10 +5471,7 @@ def get_instance(
del kwargs['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 = '/instances/{id}'.format(**path_param_dict)
+ url = '/endpoint_gateways'
request = self.prepare_request(
method='GET',
url=url,
@@ -5373,44 +5482,90 @@ def get_instance(
response = self.send(request, **kwargs)
return response
- def update_instance(
+ def create_endpoint_gateway(
self,
- id: str,
- instance_patch: 'InstancePatch',
+ target: 'EndpointGatewayTargetPrototype',
+ vpc: 'VPCIdentity',
*,
- if_match: Optional[str] = None,
+ allow_dns_resolution_binding: Optional[bool] = None,
+ ips: Optional[List['EndpointGatewayReservedIP']] = None,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ security_groups: Optional[List['SecurityGroupIdentity']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update an instance.
+ Create an endpoint gateway.
- This request updates an instance with the information in a provided instance
- patch. The instance patch object is structured in the same way as a retrieved
- instance and contains only the information to be updated.
+ This request creates a new endpoint gateway from an endpoint gateway prototype
+ object. The prototype object is structured in the same way as a retrieved endpoint
+ gateway, and contains the information necessary to create a new endpoint gateway.
+ An endpoint gateway maps one or more reserved IPs in a VPC to a target service
+ outside the VPC.
- :param str id: The virtual server instance identifier.
- :param InstancePatch instance_patch: The instance 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 EndpointGatewayTargetPrototype target: The target to use for this
+ endpoint gateway. The target:
+ - Must not already be the target of another endpoint gateway in the VPC
+ - Must not have a service endpoint that overlaps with any
+ `service_endpoints` of
+ another endpoint gateway in the VPC.
+ If `allow_dns_resolution_binding` is `true`, then there must not be another
+ endpoint
+ gateway with `allow_dns_resolution_binding` set to `true` in the [DNS
+ sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that:
+ - Has the same `target` as this endpoint gateway
+ - Has `service_endpoints` that overlap with the `service_endpoints` for
+ this endpoint
+ gateway.
+ :param VPCIdentity vpc: The VPC this endpoint gateway will reside in.
+ :param bool allow_dns_resolution_binding: (optional) Indicates whether to
+ allow DNS resolution for this endpoint gateway when the VPC this endpoint
+ gateway resides in has a DNS resolution binding to a VPC with
+ `dns.enable_hub` set to `true`.
+ If `true`, then there must not be another endpoint gateway with
+ `allow_dns_resolution_binding` set to `true` in the [DNS
+ sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that:
+ - Has the same `target` as this endpoint gateway
+ - Has `service_endpoints` that overlap with the `service_endpoints` for
+ this endpoint
+ gateway.
+ Must be `true` if the VPC this endpoint gateway resides in has
+ `dns.enable_hub` set to
+ `true`.
+ :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 name for this endpoint gateway. The name
+ must not be used by another endpoint gateway in the VPC. 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) will be
+ 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 `Instance` object
+ :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object
"""
- if not id:
- raise ValueError('id must be provided')
- if instance_patch is None:
- raise ValueError('instance_patch must be provided')
- if isinstance(instance_patch, InstancePatch):
- instance_patch = convert_model(instance_patch)
- headers = {
- 'If-Match': if_match,
- }
+ 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='update_instance',
+ operation_id='create_endpoint_gateway',
)
headers.update(sdk_headers)
@@ -5419,20 +5574,27 @@ def update_instance(
'generation': self.generation,
}
- data = json.dumps(instance_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = {
+ 'target': target,
+ 'vpc': vpc,
+ 'allow_dns_resolution_binding': allow_dns_resolution_binding,
+ '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'))
del kwargs['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 = '/instances/{id}'.format(**path_param_dict)
+ url = '/endpoint_gateways'
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -5442,37 +5604,50 @@ def update_instance(
response = self.send(request, **kwargs)
return response
- def get_instance_initialization(
+ def list_endpoint_gateway_ips(
self,
- id: str,
+ endpoint_gateway_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve initialization configuration for an instance.
+ List reserved IPs bound to an endpoint gateway.
- This request retrieves configuration used to initialize the instance, such as SSH
- keys and the Windows administrator password. These can subsequently be changed on
- the instance and therefore may not be current.
+ This request lists reserved IPs bound to an endpoint gateway.
- :param str id: The instance identifier.
+ :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 `InstanceInitialization` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollectionEndpointGatewayContext` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not endpoint_gateway_id:
+ 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='get_instance_initialization',
+ 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:
@@ -5480,10 +5655,10 @@ def get_instance_initialization(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ 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 = '/instances/{id}/initialization'.format(**path_param_dict)
+ url = '/endpoint_gateways/{endpoint_gateway_id}/ips'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -5494,38 +5669,35 @@ def get_instance_initialization(
response = self.send(request, **kwargs)
return response
- def create_instance_action(
+ def remove_endpoint_gateway_ip(
self,
- instance_id: str,
- type: str,
- *,
- force: Optional[bool] = None,
+ endpoint_gateway_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create an instance action.
+ Unbind a reserved IP from an endpoint gateway.
- This request creates a new action which will be queued up to run as soon as any
- pending or running actions have completed.
+ 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 instance_id: The virtual server instance identifier.
- :param str type: The type of action.
- :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 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 `InstanceAction` object
+ :rtype: DetailedResponse
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if type is None:
- raise ValueError('type must be provided')
+ if not endpoint_gateway_id:
+ raise ValueError('endpoint_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_instance_action',
+ operation_id='remove_endpoint_gateway_ip',
)
headers.update(sdk_headers)
@@ -5534,73 +5706,58 @@ def create_instance_action(
'generation': self.generation,
}
- data = {
- 'type': type,
- 'force': force,
- }
- 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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
+ 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 = '/instances/{instance_id}/actions'.format(**path_param_dict)
+ url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_instance_cluster_network_attachments(
+ def get_endpoint_gateway_ip(
self,
- instance_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ endpoint_gateway_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List cluster network attachments on an instance.
+ Retrieve a reserved IP bound to an endpoint gateway.
- This request lists cluster network attachments on an instance. A cluster network
- attachment represents a device on the instance to which a cluster network
- interface is attached.
+ This request retrieves the specified reserved IP address if it is bound to the
+ endpoint gateway specified in the URL.
- :param str instance_id: The virtual server instance 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 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 `InstanceClusterNetworkAttachmentCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
+ if not endpoint_gateway_id:
+ raise ValueError('endpoint_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_cluster_network_attachments',
+ operation_id='get_endpoint_gateway_ip',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -5608,10 +5765,10 @@ def list_instance_cluster_network_attachments(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
+ 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 = '/instances/{instance_id}/cluster_network_attachments'.format(**path_param_dict)
+ url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -5622,66 +5779,37 @@ def list_instance_cluster_network_attachments(
response = self.send(request, **kwargs)
return response
- def create_cluster_network_attachment(
+ def add_endpoint_gateway_ip(
self,
- instance_id: str,
- cluster_network_interface: 'InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface',
- *,
- before: Optional['InstanceClusterNetworkAttachmentBeforePrototype'] = None,
- name: Optional[str] = None,
+ endpoint_gateway_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a cluster network attachment.
+ Bind a reserved IP to an endpoint gateway.
- This request creates a cluster network attachment from an instance cluster network
- attachment prototype object. A cluster network attachment will attach the instance
- to a cluster network. The cluster network attachment prototype must specify a
- cluster network interface identity or a cluster network interface prototype.
- The instance must be in a `stopped` or `stopping` state to create an instance
- cluster network attachment.
+ This request binds the specified reserved IP to the specified endpoint gateway.
+ The reserved IP:
+ - must currently be unbound, or not required by its target
+ - must not be in the same zone as any other reserved IP bound to the endpoint
+ gateway.
- :param str instance_id: The virtual server instance identifier.
- :param InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface
- cluster_network_interface: A cluster network interface for the instance
- cluster network attachment. This can be
- specified using an existing cluster network interface that does not already
- have a
- `target`, or a prototype object for a new cluster network interface.
- This instance must reside in the same VPC as the specified cluster network
- interface. The
- cluster network interface must reside in the same cluster network as the
- `cluster_network_interface` of any other `cluster_network_attachments` for
- this instance.
- :param InstanceClusterNetworkAttachmentBeforePrototype before: (optional)
- The instance cluster network attachment to insert this instance cluster
- network attachment
- immediately before.
- If unspecified, this instance cluster network attachment will be inserted
- after all
- existing instance cluster network attachments.
- :param str name: (optional) The name for this cluster network attachment.
- Names must be unique within the instance the cluster network attachment
- resides in. If unspecified, the name will be a hyphenated list of
- randomly-selected words. Names starting with `ibm-` are reserved for
- provider-owned resources, and are not allowed.
+ :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 `InstanceClusterNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if cluster_network_interface is None:
- raise ValueError('cluster_network_interface must be provided')
- cluster_network_interface = convert_model(cluster_network_interface)
- if before is not None:
- before = convert_model(before)
+ if not endpoint_gateway_id:
+ raise ValueError('endpoint_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_cluster_network_attachment',
+ operation_id='add_endpoint_gateway_ip',
)
headers.update(sdk_headers)
@@ -5690,65 +5818,50 @@ def create_cluster_network_attachment(
'generation': self.generation,
}
- data = {
- 'cluster_network_interface': cluster_network_interface,
- 'before': before,
- '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
+ 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 = '/instances/{instance_id}/cluster_network_attachments'.format(**path_param_dict)
+ url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_instance_cluster_network_attachment(
+ def delete_endpoint_gateway(
self,
- instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an instance cluster network attachment.
+ Delete an endpoint gateway.
- This request deletes an instance cluster network attachment. The instance must be
- in a
- `stopped` or `stopping` state to delete an instance cluster network attachment.
- This operation cannot be reversed.
+ 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 instance_id: The virtual server instance identifier.
- :param str id: The instance cluster network attachment identifier.
+ :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 `InstanceClusterNetworkAttachment` object
+ :rtype: DetailedResponse
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_instance_cluster_network_attachment',
+ operation_id='delete_endpoint_gateway',
)
headers.update(sdk_headers)
@@ -5760,12 +5873,11 @@ def delete_instance_cluster_network_attachment(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/cluster_network_attachments/{id}'.format(**path_param_dict)
+ url = '/endpoint_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -5776,34 +5888,30 @@ def delete_instance_cluster_network_attachment(
response = self.send(request, **kwargs)
return response
- def get_instance_cluster_network_attachment(
+ def get_endpoint_gateway(
self,
- instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance cluster network attachment.
+ Retrieve an endpoint gateway.
- This request retrieves a single instance cluster network attachment specified by
- the identifier in the URL.
+ This request retrieves a single endpoint gateway specified by the identifier in
+ the URL.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance cluster network attachment identifier.
+ :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 `InstanceClusterNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_cluster_network_attachment',
+ operation_id='get_endpoint_gateway',
)
headers.update(sdk_headers)
@@ -5817,10 +5925,10 @@ def get_instance_cluster_network_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/cluster_network_attachments/{id}'.format(**path_param_dict)
+ url = '/endpoint_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -5831,45 +5939,39 @@ def get_instance_cluster_network_attachment(
response = self.send(request, **kwargs)
return response
- def update_instance_cluster_network_attachment(
+ def update_endpoint_gateway(
self,
- instance_id: str,
id: str,
- instance_cluster_network_attachment_patch: 'InstanceClusterNetworkAttachmentPatch',
+ endpoint_gateway_patch: 'EndpointGatewayPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an instance cluster network attachment.
+ Update an endpoint gateway.
- This request updates an instance cluster network attachment with the information
- provided in an instance network interface patch object. The instance cluster
- network attachment patch object is structured in the same way as a retrieved
- instance cluster network attachment and needs to contain only the information to
- be updated.
+ This request updates an endpoint gateway with the information in a provided
+ endpoint gateway patch. The endpoint gateway patch object is structured in the
+ same way as a retrieved endpoint gateway and contains only the information to be
+ updated.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance cluster network attachment identifier.
- :param InstanceClusterNetworkAttachmentPatch
- instance_cluster_network_attachment_patch: The instance cluster network
- attachment patch.
+ :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 `InstanceClusterNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
- if instance_cluster_network_attachment_patch is None:
- raise ValueError('instance_cluster_network_attachment_patch must be provided')
- if isinstance(instance_cluster_network_attachment_patch, InstanceClusterNetworkAttachmentPatch):
- instance_cluster_network_attachment_patch = convert_model(instance_cluster_network_attachment_patch)
+ 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_instance_cluster_network_attachment',
+ operation_id='update_endpoint_gateway',
)
headers.update(sdk_headers)
@@ -5878,7 +5980,7 @@ def update_instance_cluster_network_attachment(
'generation': self.generation,
}
- data = json.dumps(instance_cluster_network_attachment_patch)
+ data = json.dumps(endpoint_gateway_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -5886,10 +5988,10 @@ def update_instance_cluster_network_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/cluster_network_attachments/{id}'.format(**path_param_dict)
+ url = '/endpoint_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -5901,57 +6003,126 @@ def update_instance_cluster_network_attachment(
response = self.send(request, **kwargs)
return response
- def create_instance_console_access_token(
+ #########################
+ # Floating IPs
+ #########################
+
+ def list_floating_ips(
self,
- instance_id: str,
- console_type: str,
*,
- force: Optional[bool] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ sort: Optional[str] = None,
+ target_id: Optional[str] = None,
+ target_crn: Optional[str] = None,
+ target_name: Optional[str] = None,
+ target_resource_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a console access token for an instance.
+ List floating IPs.
- This request creates a new single-use console access token for an instance. All
- console configuration is provided at token create time, and the token is
- subsequently used in the `access_token` query parameter for the WebSocket request.
- The access token is only valid for a short period of time, and a maximum of one
- token is valid for a given instance at a time.
+ This request lists floating IPs in the region. Floating IPs allow inbound and
+ outbound traffic from the Internet to an instance.
- :param str instance_id: The virtual server instance identifier.
- :param str console_type: The instance console type for which this token may
- be used.
- :param bool force: (optional) 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 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 with a `resource_group.id` property matching 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 str target_id: (optional) Filters the collection to resources with a
+ `target.id` property matching the specified identifier.
+ :param str target_crn: (optional) Filters the collection to resources with
+ a `target.crn` property matching the specified CRN.
+ :param str target_name: (optional) Filters the collection to resources with
+ a `target.name` property matching the exact specified name.
+ :param str target_resource_type: (optional) Filters the collection to
+ resources with a `target.resource_type` property matching the specified
+ 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 `InstanceConsoleAccessToken` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIPCollection` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if console_type is None:
- raise ValueError('console_type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_instance_console_access_token',
+ operation_id='list_floating_ips',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
+ 'sort': sort,
+ 'target.id': target_id,
+ 'target.crn': target_crn,
+ 'target.name': target_name,
+ 'target.resource_type': target_resource_type,
}
- data = {
- 'console_type': console_type,
- 'force': force,
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+ headers['Accept'] = 'application/json'
+
+ url = '/floating_ips'
+ request = self.prepare_request(
+ method='GET',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
+ def create_floating_ip(
+ self,
+ floating_ip_prototype: 'FloatingIPPrototype',
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Reserve a floating IP.
+
+ This request reserves a new floating IP.
+
+ :param FloatingIPPrototype floating_ip_prototype: The floating IP prototype
+ object.
+ :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 `FloatingIP` object
+ """
+
+ if floating_ip_prototype is None:
+ raise ValueError('floating_ip_prototype must be provided')
+ if isinstance(floating_ip_prototype, FloatingIPPrototype):
+ floating_ip_prototype = convert_model(floating_ip_prototype)
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='create_floating_ip',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
}
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+
+ data = json.dumps(floating_ip_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -5959,10 +6130,7 @@ def create_instance_console_access_token(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/console_access_token'.format(**path_param_dict)
+ url = '/floating_ips'
request = self.prepare_request(
method='POST',
url=url,
@@ -5974,32 +6142,31 @@ def create_instance_console_access_token(
response = self.send(request, **kwargs)
return response
- def list_instance_disks(
+ def delete_floating_ip(
self,
- instance_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List disks on an instance.
+ Delete a floating IP.
- This request lists disks on an instance. A disk is a block device that is locally
- attached to the instance's physical host and is also referred to as instance
- storage. By default, the listed disks are sorted by their `created_at` property
- values, with the newest disk first.
+ This request disassociates (if associated) and releases a floating IP. This
+ operation cannot be reversed. For this request to succeed, the floating IP must
+ not be required by another resource, such as a public gateway.
- :param str instance_id: The virtual server instance identifier.
+ :param str id: The floating 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 `InstanceDiskCollection` object
+ :rtype: DetailedResponse
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_disks',
+ operation_id='delete_floating_ip',
)
headers.update(sdk_headers)
@@ -6011,14 +6178,13 @@ def list_instance_disks(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/disks'.format(**path_param_dict)
+ url = '/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -6027,34 +6193,30 @@ def list_instance_disks(
response = self.send(request, **kwargs)
return response
- def get_instance_disk(
+ def get_floating_ip(
self,
- instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance disk.
+ Retrieve a floating IP.
- This request retrieves a single instance disk specified by the identifier in the
+ This request retrieves a single floating IP specified by the identifier in the
URL.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance disk identifier.
+ :param str id: The floating 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 `InstanceDisk` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIP` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_disk',
+ operation_id='get_floating_ip',
)
headers.update(sdk_headers)
@@ -6068,10 +6230,10 @@ def get_instance_disk(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/disks/{id}'.format(**path_param_dict)
+ url = '/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -6082,39 +6244,35 @@ def get_instance_disk(
response = self.send(request, **kwargs)
return response
- def update_instance_disk(
+ def update_floating_ip(
self,
- instance_id: str,
id: str,
- instance_disk_patch: 'InstanceDiskPatch',
+ floating_ip_patch: 'FloatingIPPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an instance disk.
+ Update a floating IP.
- This request updates the instance disk with the information in a provided patch.
+ This request updates a floating IP's name and/or target.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance disk identifier.
- :param InstanceDiskPatch instance_disk_patch: The instance disk patch.
+ :param str id: The floating IP identifier.
+ :param FloatingIPPatch floating_ip_patch: The floating IP 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 `InstanceDisk` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIP` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
- if instance_disk_patch is None:
- raise ValueError('instance_disk_patch must be provided')
- if isinstance(instance_disk_patch, InstanceDiskPatch):
- instance_disk_patch = convert_model(instance_disk_patch)
+ if floating_ip_patch is None:
+ raise ValueError('floating_ip_patch must be provided')
+ if isinstance(floating_ip_patch, FloatingIPPatch):
+ floating_ip_patch = convert_model(floating_ip_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_instance_disk',
+ operation_id='update_floating_ip',
)
headers.update(sdk_headers)
@@ -6123,7 +6281,7 @@ def update_instance_disk(
'generation': self.generation,
}
- data = json.dumps(instance_disk_patch)
+ data = json.dumps(floating_ip_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -6131,10 +6289,10 @@ def update_instance_disk(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/disks/{id}'.format(**path_param_dict)
+ url = '/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -6146,40 +6304,78 @@ def update_instance_disk(
response = self.send(request, **kwargs)
return response
- def list_instance_network_attachments(
+ #########################
+ # Flow log collectors
+ #########################
+
+ def list_flow_log_collectors(
self,
- instance_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ name: Optional[str] = None,
+ vpc_id: Optional[str] = None,
+ vpc_crn: Optional[str] = None,
+ vpc_name: Optional[str] = None,
+ target_id: Optional[str] = None,
+ target_resource_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List network attachments on an instance.
+ List flow log collectors.
- This request lists network attachments on an instance. A network attachment
- represents a device on the instance to which a virtual network interface is
- attached.
- The network attachments will be sorted by their `created_at` property values, with
- newest network attachments first. Network attachments with identical `created_at`
- property values will in turn be sorted by ascending `name` property values.
+ This request lists flow log collectors in the region. A [flow log
+ collector](https://cloud.ibm.com/docs/vpc?topic=vpc-flow-logs) summarizes TCP and
+ UDP data sent over the instance network interfaces and instance network
+ attachments contained within its target. The collected flow logs are written to a
+ cloud object storage bucket, where they can be
+ [viewed](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze).
- :param str instance_id: The virtual server instance 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 resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param str target_id: (optional) Filters the collection to resources with a
+ `target.id` property matching the specified identifier.
+ :param str target_resource_type: (optional) Filters the collection to
+ resources with a `target.resource_type` property matching the specified
+ 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 `InstanceNetworkAttachmentCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `FlowLogCollectorCollection` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_network_attachments',
+ 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:
@@ -6187,10 +6383,7 @@ def list_instance_network_attachments(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_attachments'.format(**path_param_dict)
+ url = '/flow_log_collectors'
request = self.prepare_request(
method='GET',
url=url,
@@ -6201,50 +6394,68 @@ def list_instance_network_attachments(
response = self.send(request, **kwargs)
return response
- def create_instance_network_attachment(
+ def create_flow_log_collector(
self,
- instance_id: str,
- virtual_network_interface: 'InstanceNetworkAttachmentPrototypeVirtualNetworkInterface',
+ storage_bucket: 'LegacyCloudObjectStorageBucketIdentity',
+ target: 'FlowLogCollectorTargetPrototype',
*,
+ active: Optional[bool] = None,
name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a network attachment on an instance.
+ Create a flow log collector.
- This request creates a new instance network attachment from an instance network
- attachment prototype object. The prototype object is structured in the same way as
- a retrieved instance network attachment, and contains the information necessary to
- create the new instance network attachment.
+ 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 str instance_id: The virtual server instance identifier.
- :param InstanceNetworkAttachmentPrototypeVirtualNetworkInterface
- virtual_network_interface: A virtual network interface for the instance
- network attachment. This can be specified
- using an existing virtual network interface, or a prototype object for a
- new virtual
- network interface.
- If an existing virtual network interface is specified,
- `enable_infrastructure_nat` must be
- `true`.
- :param str name: (optional) The name for this network attachment. Names
- must be unique within the instance the network attachment resides in. If
- unspecified, the name will be a hyphenated list of randomly-selected words.
+ :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. For more information, see [Creating a flow log
+ collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector).
+ :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
+ instance network attachments, virtual network interfaces or instance
+ network interfaces
+ within the target that are themselves the target of a more specific flow
+ log collector.
+ The target must not be a virtual network interface that is attached to a
+ bare metal server
+ network attachment or to a file share mount target.
+ :param bool active: (optional) Indicates whether this collector will be
+ active upon creation.
+ :param str name: (optional) The name for this flow log collector. The name
+ must not be used by another flow log collector in the VPC. 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) will be
+ 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 `InstanceNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if virtual_network_interface is None:
- raise ValueError('virtual_network_interface must be provided')
- virtual_network_interface = convert_model(virtual_network_interface)
+ 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_instance_network_attachment',
+ operation_id='create_flow_log_collector',
)
headers.update(sdk_headers)
@@ -6254,8 +6465,11 @@ def create_instance_network_attachment(
}
data = {
- 'virtual_network_interface': virtual_network_interface,
+ '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)
@@ -6266,10 +6480,7 @@ def create_instance_network_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_attachments'.format(**path_param_dict)
+ url = '/flow_log_collectors'
request = self.prepare_request(
method='POST',
url=url,
@@ -6281,37 +6492,32 @@ def create_instance_network_attachment(
response = self.send(request, **kwargs)
return response
- def delete_instance_network_attachment(
+ def delete_flow_log_collector(
self,
- instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an instance network attachment.
+ Delete a flow log collector.
- This request deletes an instance network attachment. This operation cannot be
- reversed. Any floating IPs associated with the instance network attachment are
- implicitly disassociated. All flow log collectors with `auto_delete` set to `true`
- targeting the instance network attachment are automatically deleted. The primary
- instance network attachment is not allowed to be deleted.
+ 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 instance_id: The virtual server instance identifier.
- :param str id: The instance network attachment identifier.
+ :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 not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_instance_network_attachment',
+ operation_id='delete_flow_log_collector',
)
headers.update(sdk_headers)
@@ -6324,10 +6530,10 @@ def delete_instance_network_attachment(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/network_attachments/{id}'.format(**path_param_dict)
+ url = '/flow_log_collectors/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -6338,34 +6544,30 @@ def delete_instance_network_attachment(
response = self.send(request, **kwargs)
return response
- def get_instance_network_attachment(
+ def get_flow_log_collector(
self,
- instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance network attachment.
+ Retrieve a flow log collector.
- This request retrieves a single instance network attachment specified by the
- identifier in the URL.
+ This request retrieves a single flow log collector specified by the identifier in
+ the URL.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance network attachment identifier.
+ :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 `InstanceNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_network_attachment',
+ operation_id='get_flow_log_collector',
)
headers.update(sdk_headers)
@@ -6379,10 +6581,10 @@ def get_instance_network_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/network_attachments/{id}'.format(**path_param_dict)
+ url = '/flow_log_collectors/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -6393,43 +6595,39 @@ def get_instance_network_attachment(
response = self.send(request, **kwargs)
return response
- def update_instance_network_attachment(
+ def update_flow_log_collector(
self,
- instance_id: str,
id: str,
- instance_network_attachment_patch: 'InstanceNetworkAttachmentPatch',
+ flow_log_collector_patch: 'FlowLogCollectorPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an instance network attachment.
+ Update a flow log collector.
- This request updates an instance network attachment with the information provided
- in an instance network interface patch object. The instance network attachment
- patch object is structured in the same way as a retrieved instance network
- attachment and needs to contain only the information to be updated.
+ 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 instance_id: The virtual server instance identifier.
- :param str id: The instance network attachment identifier.
- :param InstanceNetworkAttachmentPatch instance_network_attachment_patch:
- The instance network attachment patch.
+ :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 `InstanceNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
- if instance_network_attachment_patch is None:
- raise ValueError('instance_network_attachment_patch must be provided')
- if isinstance(instance_network_attachment_patch, InstanceNetworkAttachmentPatch):
- instance_network_attachment_patch = convert_model(instance_network_attachment_patch)
+ 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_instance_network_attachment',
+ operation_id='update_flow_log_collector',
)
headers.update(sdk_headers)
@@ -6438,7 +6636,7 @@ def update_instance_network_attachment(
'generation': self.generation,
}
- data = json.dumps(instance_network_attachment_patch)
+ data = json.dumps(flow_log_collector_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -6446,10 +6644,10 @@ def update_instance_network_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/network_attachments/{id}'.format(**path_param_dict)
+ url = '/flow_log_collectors/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -6461,39 +6659,34 @@ def update_instance_network_attachment(
response = self.send(request, **kwargs)
return response
- def list_instance_network_interfaces(
+ #########################
+ # Geography
+ #########################
+
+ def list_regions(
self,
- instance_id: str,
**kwargs,
) -> DetailedResponse:
"""
- List network interfaces on an instance.
+ List regions.
- This request lists network interfaces on an instance. An instance network
- interface is an abstract representation of a network device and attaches an
- instance to a single subnet. Each network interface on an instance can attach to
- any subnet in the zone, including subnets that are already attached to the
- instance. Multiple network interfaces on the instance may also attach to the same
- subnet.
- If this instance has network attachments, each returned network interface is a
- [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface.
+ This request lists regions. Each region is a separate geographic area that
+ contains multiple isolated zones. Resources can be provisioned into one or more
+ zones in a region. Each zone is isolated, but connected to other zones in the same
+ region with low-latency and high-bandwidth links. Regions represent the top-level
+ of fault isolation available. Resources deployed within a single region also
+ benefit from the low latency afforded by geographic proximity.
- :param str instance_id: The virtual server instance 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 `NetworkInterfaceUnpaginatedCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `RegionCollection` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_network_interfaces',
+ operation_id='list_regions',
)
headers.update(sdk_headers)
@@ -6507,10 +6700,7 @@ def list_instance_network_interfaces(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_interfaces'.format(**path_param_dict)
+ url = '/regions'
request = self.prepare_request(
method='GET',
url=url,
@@ -6521,76 +6711,29 @@ def list_instance_network_interfaces(
response = self.send(request, **kwargs)
return response
- def create_instance_network_interface(
+ def get_region(
self,
- instance_id: str,
- subnet: 'SubnetIdentity',
- *,
- allow_ip_spoofing: Optional[bool] = None,
- name: Optional[str] = None,
- primary_ip: Optional['NetworkInterfaceIPPrototype'] = None,
- security_groups: Optional[List['SecurityGroupIdentity']] = None,
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a network interface on an instance.
+ Retrieve a region.
- This request creates a new instance network interface from an instance network
- interface prototype object. The prototype object is structured in the same way as
- a retrieved instance network interface, and contains the information necessary to
- create the new instance network interface. Any subnet in the instance's VPC may be
- specified. Addresses on the instance network interface must be within the
- specified subnet's CIDR blocks.
- If this instance has network attachments, each network interface is a [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and new network interfaces are not allowed to be created.
+ This request retrieves a single region specified by the name in the URL.
- :param str instance_id: The virtual server instance identifier.
- :param SubnetIdentity subnet: The associated subnet.
- :param bool allow_ip_spoofing: (optional) Indicates whether source IP
- spoofing is allowed on this instance network interface.
- If this instance has network attachments, this network interface is a
- [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and source IP spoofing is managed on the attached virtual
- network interface.
- :param str name: (optional) The name for the instance network interface.
- The name must not be used by another network interface on the virtual
- server instance. 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 instance 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 instance 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 instance network interface. If unspecified, the
- VPC's default security group is used.
+ :param str name: The region 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 `NetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `Region` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if subnet is None:
- raise ValueError('subnet must be provided')
- subnet = convert_model(subnet)
- if primary_ip is not None:
- primary_ip = convert_model(primary_ip)
- if security_groups is not None:
- security_groups = [convert_model(x) for x in security_groups]
+ if not name:
+ raise ValueError('name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_instance_network_interface',
+ operation_id='get_region',
)
headers.update(sdk_headers)
@@ -6599,72 +6742,50 @@ def create_instance_network_interface(
'generation': self.generation,
}
- data = {
- 'subnet': subnet,
- 'allow_ip_spoofing': allow_ip_spoofing,
- 'name': name,
- 'primary_ip': primary_ip,
- '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_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 = '/instances/{instance_id}/network_interfaces'.format(**path_param_dict)
+ url = '/regions/{name}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_instance_network_interface(
+ def list_region_zones(
self,
- instance_id: str,
- id: str,
+ region_name: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an instance network interface.
+ List zones in a region.
- This request deletes an instance network interface. This operation cannot be
- reversed. Any floating IPs associated with the instance network interface are
- implicitly disassociated. All flow log collectors with `auto_delete` set to `true`
- targeting the instance network interface are automatically deleted. The primary
- instance network interface is not allowed to be deleted.
- If this instance has network attachments, this network interface is a [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and is not allowed to be deleted.
+ This request lists zones in a region. Zones represent logically-isolated data
+ centers with high-bandwidth and low-latency interconnects to other zones in the
+ same region. Faults in a zone do not affect other zones.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance network interface identifier.
+ :param str region_name: The region name.
: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 `ZoneCollection` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not region_name:
+ raise ValueError('region_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_instance_network_interface',
+ operation_id='list_region_zones',
)
headers.update(sdk_headers)
@@ -6676,13 +6797,14 @@ def delete_instance_network_interface(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_keys = ['region_name']
+ path_param_values = self.encode_path_vars(region_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_interfaces/{id}'.format(**path_param_dict)
+ url = '/regions/{region_name}/zones'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -6691,39 +6813,34 @@ def delete_instance_network_interface(
response = self.send(request, **kwargs)
return response
- def get_instance_network_interface(
+ def get_region_zone(
self,
- instance_id: str,
- id: str,
+ region_name: str,
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an instance network interface.
+ Retrieve a zone.
- This request retrieves a single instance network interface specified by the
- identifier in the URL.
- If this instance has network attachments, the retrieved network interface is a
- [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface.
+ This request retrieves a single zone specified by the region and zone names in the
+ URL.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance network interface identifier.
+ :param str region_name: The region name.
+ :param str name: The zone 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 `NetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `Zone` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not region_name:
+ raise ValueError('region_name must be provided')
+ if not name:
+ raise ValueError('name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_network_interface',
+ operation_id='get_region_zone',
)
headers.update(sdk_headers)
@@ -6737,10 +6854,10 @@ def get_instance_network_interface(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_keys = ['region_name', 'name']
+ path_param_values = self.encode_path_vars(region_name, name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_interfaces/{id}'.format(**path_param_dict)
+ url = '/regions/{region_name}/zones/{name}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -6751,105 +6868,122 @@ def get_instance_network_interface(
response = self.send(request, **kwargs)
return response
- def update_instance_network_interface(
+ #########################
+ # Images
+ #########################
+
+ def list_images(
self,
- instance_id: str,
- id: str,
- network_interface_patch: 'NetworkInterfacePatch',
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ name: Optional[str] = None,
+ status: Optional[List[str]] = None,
+ visibility: Optional[str] = None,
+ user_data_format: Optional[List[str]] = None,
+ remote_account_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update an instance network interface.
+ List images.
- This request updates an instance network interface with the information provided
- in an instance network interface patch object. The instance network interface
- patch object is structured in the same way as a retrieved instance network
- interface and needs to contain only the information to be updated.
- If this instance has network attachments, this network interface is a [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and is not allowed to be updated.
+ This request lists images available in the region. An image provides source data
+ for a volume. Images are either system-provided, or created from another source,
+ such as importing from Cloud Object Storage.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The instance network interface identifier.
- :param NetworkInterfacePatch network_interface_patch: The instance network
- interface patch.
+ :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 with a `resource_group.id` property matching the specified
+ identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param List[str] status: (optional) Filters the collection to images with a
+ `status` property matching one of the specified comma-separated values.
+ :param str visibility: (optional) Filters the collection to images with a
+ `visibility` property matching the specified value.
+ :param List[str] user_data_format: (optional) Filters the collection to
+ images with a `user_data_format` property matching one of the specified
+ comma-separated values.
+ :param str remote_account_id: (optional) Filters the collection to images
+ with a `remote.account.id` property matching the specified account
+ identifier.
+ This parameter also supports the values null and not:null which filter the
+ collection to resources which have no remote account identifier or any
+ remote account identifier, respectively.
: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 `NetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `ImageCollection` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if network_interface_patch is None:
- raise ValueError('network_interface_patch must be provided')
- if isinstance(network_interface_patch, NetworkInterfacePatch):
- network_interface_patch = convert_model(network_interface_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_instance_network_interface',
+ operation_id='list_images',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
+ 'name': name,
+ 'status': convert_list(status),
+ 'visibility': visibility,
+ 'user_data_format': convert_list(user_data_format),
+ 'remote.account.id': remote_account_id,
}
- data = json.dumps(network_interface_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_interfaces/{id}'.format(**path_param_dict)
+ url = '/images'
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_instance_network_interface_floating_ips(
+ def create_image(
self,
- instance_id: str,
- network_interface_id: str,
+ image_prototype: 'ImagePrototype',
**kwargs,
) -> DetailedResponse:
"""
- List floating IPs associated with an instance network interface.
+ Create an image.
- This request lists floating IPs associated with an instance network interface.
+ This request creates a new image from an image prototype object. The prototype
+ object is structured in the same way as a retrieved image, and contains the
+ information necessary to create the new image. If an image is being imported, a
+ URL to the image file on object storage must be specified. If an image is being
+ created from an existing volume, that volume must be specified.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
+ :param ImagePrototype image_prototype: The image prototype object.
: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 `FloatingIPUnpaginatedCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `Image` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
+ if image_prototype is None:
+ raise ValueError('image_prototype must be provided')
+ if isinstance(image_prototype, ImagePrototype):
+ image_prototype = convert_model(image_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_network_interface_floating_ips',
+ operation_id='create_image',
)
headers.update(sdk_headers)
@@ -6858,57 +6992,55 @@ def list_instance_network_interface_floating_ips(
'generation': self.generation,
}
+ data = json.dumps(image_prototype)
+ headers['content-type'] = 'application/json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'network_interface_id']
- path_param_values = self.encode_path_vars(instance_id, network_interface_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips'.format(**path_param_dict)
+ url = '/images'
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def remove_instance_network_interface_floating_ip(
+ def delete_image(
self,
- instance_id: str,
- network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Disassociate a floating IP from an instance network interface.
+ Delete an image.
- This request disassociates the specified floating IP from the specified instance
- network interface.
+ This request deletes an image. Any active image export jobs will be completed
+ first. This operation cannot be reversed. An image with `remote.account` set is
+ not allowed to be deleted. Additionally, an image cannot be deleted if it:
+ - has a `status` of `deleting`
+ - has a `status` of `pending` with a `status_reasons` code of
+ `image_request_in_progress`
+ - has `catalog_offering.managed` set to `true`.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
- :param str id: The floating IP identifier.
+ :param str id: The image identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='remove_instance_network_interface_floating_ip',
+ operation_id='delete_image',
)
headers.update(sdk_headers)
@@ -6921,10 +7053,10 @@ def remove_instance_network_interface_floating_ip(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['instance_id', 'network_interface_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, network_interface_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 = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/images/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -6935,38 +7067,29 @@ def remove_instance_network_interface_floating_ip(
response = self.send(request, **kwargs)
return response
- def get_instance_network_interface_floating_ip(
+ def get_image(
self,
- instance_id: str,
- network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve associated floating IP.
+ Retrieve an image.
- This request retrieves a specified floating IP address if it is associated with
- the instance network interface and instance specified in the URL.
+ This request retrieves a single image specified by the identifier in the URL.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
- :param str id: The floating IP identifier.
+ :param str id: The image 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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Image` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_network_interface_floating_ip',
+ operation_id='get_image',
)
headers.update(sdk_headers)
@@ -6980,10 +7103,10 @@ def get_instance_network_interface_floating_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'network_interface_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, network_interface_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 = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/images/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -6994,42 +7117,38 @@ def get_instance_network_interface_floating_ip(
response = self.send(request, **kwargs)
return response
- def add_instance_network_interface_floating_ip(
+ def update_image(
self,
- instance_id: str,
- network_interface_id: str,
id: str,
+ image_patch: 'ImagePatch',
**kwargs,
) -> DetailedResponse:
"""
- Associate a floating IP with an instance network interface.
+ Update an image.
- This request associates the specified floating IP with the specified instance
- network interface, replacing any existing association.
- The existing floating IP must:
- - not be required by another resource, such as a public gateway
- - be in the same `zone` as the instance
- A request body is not required, and if provided, is ignored.
+ This request updates an image with the information in a provided image patch. The
+ image patch object is structured in the same way as a retrieved image and contains
+ only the information to be updated. An image with `remote.account` set is not
+ allowed to be updated. An image with a `status` of `deleting` cannot be updated.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
- :param str id: The floating IP identifier.
+ :param str id: The image identifier.
+ :param ImagePatch image_patch: The image 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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Image` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if image_patch is None:
+ raise ValueError('image_patch must be provided')
+ if isinstance(image_patch, ImagePatch):
+ image_patch = convert_model(image_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='add_instance_network_interface_floating_ip',
+ operation_id='update_image',
)
headers.update(sdk_headers)
@@ -7038,62 +7157,60 @@ def add_instance_network_interface_floating_ip(
'generation': self.generation,
}
+ data = json.dumps(image_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'network_interface_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, network_interface_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 = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/images/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_instance_network_interface_ips(
+ def list_image_bare_metal_server_profiles(
self,
- instance_id: str,
- network_interface_id: str,
+ id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List the primary reserved IP for an instance network interface.
+ List bare metal server profiles compatible with an image.
- This request lists the primary reserved IP for an instance network interface.
+ This request lists bare metal server profiles compatible with an image's
+ `allowed_use.bare_metal_server`, `operating_system.architecture` and
+ `user_data_format` properties, sorted by ascending `name` property values.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
+ :param str id: The image 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 `ReservedIPCollectionInstanceNetworkInterfaceContext` object
-
- Deprecated: this method is deprecated and may be removed in a future release.
+ :rtype: DetailedResponse with `dict` result representing a `ImageBareMetalServerProfileCollection` object
"""
- logging.warning('A deprecated operation has been invoked: list_instance_network_interface_ips')
-
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_network_interface_ips',
+ operation_id='list_image_bare_metal_server_profiles',
)
headers.update(sdk_headers)
@@ -7109,10 +7226,10 @@ def list_instance_network_interface_ips(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'network_interface_id']
- path_param_values = self.encode_path_vars(instance_id, network_interface_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 = '/instances/{instance_id}/network_interfaces/{network_interface_id}/ips'.format(**path_param_dict)
+ url = '/images/{id}/bare_metal_server_profiles'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -7123,47 +7240,101 @@ def list_instance_network_interface_ips(
response = self.send(request, **kwargs)
return response
- def get_instance_network_interface_ip(
+ def deprecate_image(
self,
- instance_id: str,
- network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve the primary reserved IP.
+ Deprecate an image.
- This request retrieves the primary reserved IP for an instance network interface.
+ This request deprecates an image, resulting in its `status` becoming `deprecated`
+ and
+ `deprecation_at` being set to the current date and time.
+ The image must:
+ - have a `status` of `available`
+ - have `catalog_offering.managed` set to `false`
+ - not have `deprecation_at` set
+ An image with `remote.account` set is not allowed to be deprecated.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
- :param str id: The reserved IP identifier.
+ :param str id: The image 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
+ """
- Deprecated: this method is deprecated and may be removed in a future release.
+ if not id:
+ raise ValueError('id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='deprecate_image',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['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 = '/images/{id}/deprecate'.format(**path_param_dict)
+ request = self.prepare_request(
+ method='POST',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
+ def list_image_instance_profiles(
+ self,
+ id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ **kwargs,
+ ) -> DetailedResponse:
"""
+ List instance profiles compatible with an image.
- logging.warning('A deprecated operation has been invoked: get_instance_network_interface_ip')
+ This request lists instance profiles compatible with an image's
+ `allowed_use.instance`, `operating_system.architecture` and
+ `user_data_format` properties, sorted by ascending `name` property values.
+
+ :param str id: The image 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 `ImageInstanceProfileCollection` object
+ """
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_network_interface_ip',
+ operation_id='list_image_instance_profiles',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -7171,10 +7342,10 @@ def get_instance_network_interface_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'network_interface_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, network_interface_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 = '/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}'.format(**path_param_dict)
+ url = '/images/{id}/instance_profiles'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -7185,37 +7356,101 @@ def get_instance_network_interface_ip(
response = self.send(request, **kwargs)
return response
- def list_instance_volume_attachments(
+ def obsolete_image(
self,
- instance_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List volumes attachments on an instance.
+ Obsolete an image.
- This request lists volume attachments on an instance. A volume attachment connects
- a volume to an instance. Each instance may have many volume attachments but each
- volume attachment connects exactly one instance to exactly one volume.
+ This request obsoletes an image, resulting in its `status` becoming `obsolete` and
+ `obsolescence_at` being set to the current date and time.
+ The image must:
+ - have a `status` of `available` or `deprecated`
+ - have `catalog_offering.managed` set to `false`
+ - not have `deprecation_at` set in the future
+ - not have `obsolescence_at` set
+ An image with `remote.account` set is not allowed to be obsoleted.
- :param str instance_id: The virtual server instance identifier.
+ :param str id: The image 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 `VolumeAttachmentCollection` object
+ :rtype: DetailedResponse
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_instance_volume_attachments',
+ operation_id='obsolete_image',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['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 = '/images/{id}/obsolete'.format(**path_param_dict)
+ request = self.prepare_request(
+ method='POST',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
+ def list_image_export_jobs(
+ self,
+ image_id: str,
+ *,
+ name: Optional[str] = None,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ List export jobs for an image.
+
+ This request lists export jobs for an image. Each job tracks the exporting of the
+ image to another location, such as a bucket within cloud object storage.
+ The jobs will be sorted by their `created_at` property values, with newest jobs
+ first. Jobs with identical `created_at` property values will in turn be sorted by
+ ascending
+ `name` property values.
+
+ :param str image_id: The image identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 `ImageExportJobUnpaginatedCollection` object
+ """
+
+ if not image_id:
+ raise ValueError('image_id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='list_image_export_jobs',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'name': name,
}
if 'headers' in kwargs:
@@ -7223,10 +7458,10 @@ def list_instance_volume_attachments(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
+ path_param_keys = ['image_id']
+ path_param_values = self.encode_path_vars(image_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/volume_attachments'.format(**path_param_dict)
+ url = '/images/{image_id}/export_jobs'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -7237,48 +7472,54 @@ def list_instance_volume_attachments(
response = self.send(request, **kwargs)
return response
- def create_instance_volume_attachment(
+ def create_image_export_job(
self,
- instance_id: str,
- volume: 'VolumeAttachmentPrototypeVolume',
+ image_id: str,
+ storage_bucket: 'CloudObjectStorageBucketIdentity',
*,
- delete_volume_on_instance_delete: Optional[bool] = None,
+ format: Optional[str] = None,
name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a volume attachment on an instance.
+ Create an export job for an image.
- This request creates a new volume attachment from a volume attachment prototype
- object, connecting a volume to an instance. For this request to succeed, the
- specified volume must not be busy. The prototype object is structured in the same
- way as a retrieved volume attachment, and contains the information necessary to
- create the new volume attachment.
+ This request creates and queues a new export job for the image specified in the
+ URL using the image export job prototype object. The image must be owned by the
+ account and be in the `available`, `deprecated`, `obsolete`, or `unusable` state.
+ The prototype object is structured in the same way as a retrieved image export
+ job, and contains the information necessary to create and queue the new image
+ export job.
- :param str instance_id: The virtual server instance identifier.
- :param VolumeAttachmentPrototypeVolume volume: The volume to use for this
- attachment. This can be specified as an existing unattached
- volume, or a prototype object for a new volume.
- :param bool delete_volume_on_instance_delete: (optional) Indicates whether
- deleting the instance will also delete the attached volume.
- :param str name: (optional) The name for this volume attachment. The name
- must not be used by another volume attachment on the instance. If
- unspecified, the name will be a hyphenated list of randomly-selected words.
+ :param str image_id: The image identifier.
+ :param CloudObjectStorageBucketIdentity storage_bucket: The Cloud Object
+ Storage bucket to export the image to. The bucket must exist and an IAM
+ service authorization must grant `Image Service for VPC` of
+ `VPC Infrastructure Services` writer access to the bucket.
+ :param str format: (optional) The format to use for the exported image. If
+ the image is encrypted, only `qcow2` is supported.
+ :param str name: (optional) The name for this image export job. The name
+ must not be used by another export job for the image. If unspecified, the
+ name will be a hyphenated list of randomly-selected words prefixed with the
+ first 16 characters of the parent image name.
+ The exported image object name in Cloud Object Storage
+ (`storage_object.name` in the response) will be based on this name. The
+ object name will be unique within the bucket.
: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 `VolumeAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `ImageExportJob` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
- if volume is None:
- raise ValueError('volume must be provided')
- volume = convert_model(volume)
+ if not image_id:
+ raise ValueError('image_id must be provided')
+ if storage_bucket is None:
+ raise ValueError('storage_bucket must be provided')
+ storage_bucket = convert_model(storage_bucket)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_instance_volume_attachment',
+ operation_id='create_image_export_job',
)
headers.update(sdk_headers)
@@ -7288,8 +7529,8 @@ def create_instance_volume_attachment(
}
data = {
- 'volume': volume,
- 'delete_volume_on_instance_delete': delete_volume_on_instance_delete,
+ 'storage_bucket': storage_bucket,
+ 'format': format,
'name': name,
}
data = {k: v for (k, v) in data.items() if v is not None}
@@ -7301,10 +7542,10 @@ def create_instance_volume_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id']
- path_param_values = self.encode_path_vars(instance_id)
+ path_param_keys = ['image_id']
+ path_param_values = self.encode_path_vars(image_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/volume_attachments'.format(**path_param_dict)
+ url = '/images/{image_id}/export_jobs'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -7316,35 +7557,36 @@ def create_instance_volume_attachment(
response = self.send(request, **kwargs)
return response
- def delete_instance_volume_attachment(
+ def delete_image_export_job(
self,
- instance_id: str,
+ image_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a volume attachment.
+ Delete an image export job.
- This request deletes a volume attachment. This operation cannot be reversed, but a
- new volume attachment may subsequently be created for the volume. For this
- request to succeed, the volume must not be busy.
+ This request deletes an image export job. This operation cannot be reversed. If
+ the job has not completed, the job will be canceled, and the incomplete exported
+ image object deleted. If the job has completed, the exported image object will not
+ be deleted.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The volume attachment identifier.
+ :param str image_id: The image identifier.
+ :param str id: The image export job identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
+ if not image_id:
+ raise ValueError('image_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_instance_volume_attachment',
+ operation_id='delete_image_export_job',
)
headers.update(sdk_headers)
@@ -7357,10 +7599,10 @@ def delete_instance_volume_attachment(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_keys = ['image_id', 'id']
+ path_param_values = self.encode_path_vars(image_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/volume_attachments/{id}'.format(**path_param_dict)
+ url = '/images/{image_id}/export_jobs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -7371,34 +7613,34 @@ def delete_instance_volume_attachment(
response = self.send(request, **kwargs)
return response
- def get_instance_volume_attachment(
+ def get_image_export_job(
self,
- instance_id: str,
+ image_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a volume attachment.
+ Retrieve an image export job.
- This request retrieves a single volume attachment specified by the identifier in
+ This request retrieves a single image export job specified by the identifier in
the URL.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The volume attachment identifier.
+ :param str image_id: The image identifier.
+ :param str id: The image export job 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 `VolumeAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `ImageExportJob` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
+ if not image_id:
+ raise ValueError('image_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_instance_volume_attachment',
+ operation_id='get_image_export_job',
)
headers.update(sdk_headers)
@@ -7412,10 +7654,10 @@ def get_instance_volume_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_keys = ['image_id', 'id']
+ path_param_values = self.encode_path_vars(image_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/volume_attachments/{id}'.format(**path_param_dict)
+ url = '/images/{image_id}/export_jobs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -7426,43 +7668,42 @@ def get_instance_volume_attachment(
response = self.send(request, **kwargs)
return response
- def update_instance_volume_attachment(
+ def update_image_export_job(
self,
- instance_id: str,
+ image_id: str,
id: str,
- volume_attachment_patch: 'VolumeAttachmentPatch',
+ image_export_job_patch: 'ImageExportJobPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a volume attachment.
+ Update an image export job.
- This request updates a volume attachment with the information provided in a volume
- attachment patch object. The volume attachment patch object is structured in the
- same way as a retrieved volume attachment and needs to contain only the
- information to be updated.
+ This request updates an image export job with the information in a provided image
+ export job patch. The image export job patch object is structured in the same way
+ as a retrieved image export job and contains only the information to be updated.
- :param str instance_id: The virtual server instance identifier.
- :param str id: The volume attachment identifier.
- :param VolumeAttachmentPatch volume_attachment_patch: The volume attachment
+ :param str image_id: The image identifier.
+ :param str id: The image export job identifier.
+ :param ImageExportJobPatch image_export_job_patch: The image export job
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 `VolumeAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `ImageExportJob` object
"""
- if not instance_id:
- raise ValueError('instance_id must be provided')
+ if not image_id:
+ raise ValueError('image_id must be provided')
if not id:
raise ValueError('id must be provided')
- if volume_attachment_patch is None:
- raise ValueError('volume_attachment_patch must be provided')
- if isinstance(volume_attachment_patch, VolumeAttachmentPatch):
- volume_attachment_patch = convert_model(volume_attachment_patch)
+ if image_export_job_patch is None:
+ raise ValueError('image_export_job_patch must be provided')
+ if isinstance(image_export_job_patch, ImageExportJobPatch):
+ image_export_job_patch = convert_model(image_export_job_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_instance_volume_attachment',
+ operation_id='update_image_export_job',
)
headers.update(sdk_headers)
@@ -7471,7 +7712,7 @@ def update_instance_volume_attachment(
'generation': self.generation,
}
- data = json.dumps(volume_attachment_patch)
+ data = json.dumps(image_export_job_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -7479,10 +7720,10 @@ def update_instance_volume_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['instance_id', 'id']
- path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_keys = ['image_id', 'id']
+ path_param_values = self.encode_path_vars(image_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/instances/{instance_id}/volume_attachments/{id}'.format(**path_param_dict)
+ url = '/images/{image_id}/export_jobs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -7494,6 +7735,107 @@ def update_instance_volume_attachment(
response = self.send(request, **kwargs)
return response
+ def list_operating_systems(
+ self,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ List operating systems.
+
+ This request lists operating systems in the region.
+
+ :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 `OperatingSystemCollection` object
+ """
+
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='list_operating_systems',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+ headers['Accept'] = 'application/json'
+
+ url = '/operating_systems'
+ request = self.prepare_request(
+ method='GET',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
+ def get_operating_system(
+ self,
+ name: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Retrieve an operating system.
+
+ This request retrieves a single operating system specified by the name in the URL.
+
+ :param str name: The operating system 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 `OperatingSystem` object
+ """
+
+ if not name:
+ raise ValueError('name must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='get_operating_system',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['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 = '/operating_systems/{name}'.format(**path_param_dict)
+ request = self.prepare_request(
+ method='GET',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
#########################
# Instance groups
#########################
@@ -9094,70 +9436,34 @@ def update_instance_group_membership(
return response
#########################
- # Reservations
+ # Instance templates
#########################
- def list_reservations(
+ def list_instance_templates(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- name: Optional[str] = None,
- profile_resource_type: Optional[str] = None,
- affinity_policy: Optional[str] = None,
- resource_group_id: Optional[str] = None,
- zone_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List reservations.
+ List instance templates.
- This request lists reservations in the region. A reservation provides reserved
- capacity for a specified profile in a specified zone. A reservation can also
- include a long-term committed use discount.
- The reservations will be sorted by their `created_at` property values, with newest
- reservations first. Reservations with identical `created_at` property values will
- in turn be sorted by ascending `name` property values.
+ This request lists instance templates in the region.
- :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 name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str profile_resource_type: (optional) Filters the collection of
- resources with a `profile.resource_type` property matching the specified
- value.
- :param str affinity_policy: (optional) Filters the collection to
- reservations with an `affinity_policy` property matching the specified
- value.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching 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 `ReservationCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceTemplateCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_reservations',
+ operation_id='list_instance_templates',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'name': name,
- 'profile.resource_type': profile_resource_type,
- 'affinity_policy': affinity_policy,
- 'resource_group.id': resource_group_id,
- 'zone.name': zone_name,
}
if 'headers' in kwargs:
@@ -9165,7 +9471,7 @@ def list_reservations(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/reservations'
+ url = '/instance/templates'
request = self.prepare_request(
method='GET',
url=url,
@@ -9176,70 +9482,37 @@ def list_reservations(
response = self.send(request, **kwargs)
return response
- def create_reservation(
+ def create_instance_template(
self,
- capacity: 'ReservationCapacityPrototype',
- committed_use: 'ReservationCommittedUsePrototype',
- profile: 'ReservationProfilePrototype',
- zone: 'ZoneIdentity',
- *,
- affinity_policy: Optional[str] = None,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
+ instance_template_prototype: 'InstanceTemplatePrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a reservation.
+ Create an instance template.
- This request creates a new reservation from a reservation prototype object. The
- prototype object is structured in the same way as a retrieved reservation, and
- contains the information necessary to create the new reservation.
+ This request creates a new instance template. The prototype object is structured
+ in the same way as a retrieved instance template, and contains the information
+ necessary to provision a new instance from the template.
+ If a `source_template` is specified in the prototype object, its contents are
+ copied into the new template prior to copying any other properties provided in the
+ prototype object.
- :param ReservationCapacityPrototype capacity: The capacity reservation
- configuration to use.
- :param ReservationCommittedUsePrototype committed_use: The committed use
- configuration to use for this reservation.
- :param ReservationProfilePrototype profile: The [instance
- profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
- [bare metal server
- profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
- to use for this reservation.
- :param ZoneIdentity zone: The zone to use for this reservation.
- :param str affinity_policy: (optional) The affinity policy to use for this
- reservation:
- - `automatic`: The reservation will be automatically selected
- - `restricted`: The reservation must be manually requested.
- :param str name: (optional) The name for this reservation. The name must
- not be used by another reservation in the region. 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) will be
- used.
+ :param InstanceTemplatePrototype instance_template_prototype: The instance
+ template prototype object.
: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 `Reservation` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceTemplate` object
"""
- if capacity is None:
- raise ValueError('capacity must be provided')
- if committed_use is None:
- raise ValueError('committed_use must be provided')
- if profile is None:
- raise ValueError('profile must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- capacity = convert_model(capacity)
- committed_use = convert_model(committed_use)
- profile = convert_model(profile)
- zone = convert_model(zone)
- if resource_group is not None:
- resource_group = convert_model(resource_group)
+ if instance_template_prototype is None:
+ raise ValueError('instance_template_prototype must be provided')
+ if isinstance(instance_template_prototype, InstanceTemplatePrototype):
+ instance_template_prototype = convert_model(instance_template_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_reservation',
+ operation_id='create_instance_template',
)
headers.update(sdk_headers)
@@ -9248,17 +9521,7 @@ def create_reservation(
'generation': self.generation,
}
- data = {
- 'capacity': capacity,
- 'committed_use': committed_use,
- 'profile': profile,
- 'zone': zone,
- 'affinity_policy': affinity_policy,
- 'name': name,
- 'resource_group': resource_group,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(instance_template_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -9266,7 +9529,7 @@ def create_reservation(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/reservations'
+ url = '/instance/templates'
request = self.prepare_request(
method='POST',
url=url,
@@ -9278,21 +9541,20 @@ def create_reservation(
response = self.send(request, **kwargs)
return response
- def delete_reservation(
+ def delete_instance_template(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a reservation.
+ Delete an instance template.
- This request deletes a reservation. This operation cannot be reversed.
- Reservations with a `status` of `active` are not allowed to be deleted.
+ This request deletes the instance template. This operation cannot be reversed.
- :param str id: The reservation identifier.
+ :param str id: The instance template 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 `Reservation` object
+ :rtype: DetailedResponse
"""
if not id:
@@ -9301,7 +9563,7 @@ def delete_reservation(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_reservation',
+ operation_id='delete_instance_template',
)
headers.update(sdk_headers)
@@ -9313,12 +9575,11 @@ def delete_reservation(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/reservations/{id}'.format(**path_param_dict)
+ url = '/instance/templates/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -9329,20 +9590,21 @@ def delete_reservation(
response = self.send(request, **kwargs)
return response
- def get_reservation(
+ def get_instance_template(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a reservation.
+ Retrieve an instance template.
- This request retrieves a single reservation specified by identifier in the URL.
+ This request retrieves a single instance template specified by the identifier in
+ the URL.
- :param str id: The reservation identifier.
+ :param str id: The instance template 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 `Reservation` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceTemplate` object
"""
if not id:
@@ -9351,7 +9613,7 @@ def get_reservation(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_reservation',
+ operation_id='get_instance_template',
)
headers.update(sdk_headers)
@@ -9368,7 +9630,7 @@ def get_reservation(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/reservations/{id}'.format(**path_param_dict)
+ url = '/instance/templates/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -9379,37 +9641,39 @@ def get_reservation(
response = self.send(request, **kwargs)
return response
- def update_reservation(
+ def update_instance_template(
self,
id: str,
- reservation_patch: 'ReservationPatch',
+ instance_template_patch: 'InstanceTemplatePatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a reservation.
+ Update an instance template.
- This request updates a reservation with the information provided in a reservation
- patch object. The patch object is structured in the same way as a retrieved
- reservation and needs to contain only the information to be updated.
+ This request updates an instance template with the information provided in the
+ instance template patch. The instance template patch object is structured in the
+ same way as a retrieved instance template and contains only the information to be
+ updated.
- :param str id: The reservation identifier.
- :param ReservationPatch reservation_patch: The reservation patch.
+ :param str id: The instance template identifier.
+ :param InstanceTemplatePatch instance_template_patch: The instance template
+ 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 `Reservation` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceTemplate` object
"""
if not id:
raise ValueError('id must be provided')
- if reservation_patch is None:
- raise ValueError('reservation_patch must be provided')
- if isinstance(reservation_patch, ReservationPatch):
- reservation_patch = convert_model(reservation_patch)
+ if instance_template_patch is None:
+ raise ValueError('instance_template_patch must be provided')
+ if isinstance(instance_template_patch, InstanceTemplatePatch):
+ instance_template_patch = convert_model(instance_template_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_reservation',
+ operation_id='update_instance_template',
)
headers.update(sdk_headers)
@@ -9418,7 +9682,7 @@ def update_reservation(
'generation': self.generation,
}
- data = json.dumps(reservation_patch)
+ data = json.dumps(instance_template_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -9429,7 +9693,7 @@ def update_reservation(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/reservations/{id}'.format(**path_param_dict)
+ url = '/instance/templates/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -9441,30 +9705,32 @@ def update_reservation(
response = self.send(request, **kwargs)
return response
- def activate_reservation(
+ #########################
+ # Instances
+ #########################
+
+ def list_instance_profiles(
self,
- id: str,
**kwargs,
) -> DetailedResponse:
"""
- Activate a reservation.
+ List instance profiles.
- This request activates a reservation. For this request to succeed, the reservation
- status must be `inactive`.
+ This request lists provisionable [instance
+ profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the region. An
+ instance profile specifies the performance characteristics and pricing model for
+ an instance.
- :param str id: The reservation 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 `InstanceProfileCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='activate_reservation',
+ operation_id='list_instance_profiles',
)
headers.update(sdk_headers)
@@ -9476,13 +9742,11 @@ def activate_reservation(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/reservations/{id}/activate'.format(**path_param_dict)
+ url = '/instance/profiles'
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -9491,26 +9755,85 @@ def activate_reservation(
response = self.send(request, **kwargs)
return response
- #########################
- # Dedicated hosts
- #########################
+ def get_instance_profile(
+ self,
+ name: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Retrieve an instance profile.
- def list_dedicated_host_groups(
+ This request retrieves a single instance profile specified by the name in the URL.
+
+ :param str name: The instance 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 `InstanceProfile` object
+ """
+
+ if not name:
+ raise ValueError('name must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='get_instance_profile',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['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 = '/instance/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_instances(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
- zone_name: Optional[str] = None,
name: Optional[str] = None,
+ cluster_network_id: Optional[str] = None,
+ cluster_network_crn: Optional[str] = None,
+ cluster_network_name: Optional[str] = None,
+ dedicated_host_id: Optional[str] = None,
+ dedicated_host_crn: Optional[str] = None,
+ dedicated_host_name: Optional[str] = None,
+ placement_group_id: Optional[str] = None,
+ placement_group_crn: Optional[str] = None,
+ placement_group_name: Optional[str] = None,
+ reservation_affinity_policy: Optional[str] = None,
+ reservation_id: Optional[str] = None,
+ reservation_crn: Optional[str] = None,
+ reservation_name: Optional[str] = None,
+ vpc_id: Optional[str] = None,
+ vpc_crn: Optional[str] = None,
+ vpc_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List dedicated host groups.
+ List instances.
- This request lists dedicated host groups in the region. Each dedicated host must
- belong to exactly one group, which controls placement of instances. Dedicated host
- groups do not span zones.
+ This request lists instances in the region.
:param str start: (optional) A server-provided token determining what
resource to start the page on.
@@ -9518,20 +9841,58 @@ def list_dedicated_host_groups(
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
+ :param str cluster_network_id: (optional) Filters the collection to
+ instances with a `cluster_network.id` property matching the specified
+ identifier.
+ :param str cluster_network_crn: (optional) Filters the collection to
+ instances with a `cluster_network.crn` property matching the specified CRN.
+ :param str cluster_network_name: (optional) Filters the collection to
+ resources with a `cluster_network.name` property matching the exact
+ specified name.
+ :param str dedicated_host_id: (optional) Filters the collection to
+ resources with a `dedicated_host.id` property matching the specified
+ identifier.
+ :param str dedicated_host_crn: (optional) Filters the collection to
+ resources with a `dedicated_host.crn` property matching the specified CRN.
+ :param str dedicated_host_name: (optional) Filters the collection to
+ resources with a `dedicated_host.name` property matching the exact
+ specified name.
+ :param str placement_group_id: (optional) Filters the collection to
+ resources with a `placement_target.id` property matching the specified
+ placement group identifier.
+ :param str placement_group_crn: (optional) Filters the collection to
+ resources with a `placement_target.crn` property matching the specified
+ placement group CRN.
+ :param str placement_group_name: (optional) Filters the collection to
+ resources with a `placement_target.name` property matching the exact
+ specified placement group name.
+ :param str reservation_affinity_policy: (optional) Filters the collection
+ to instances with a `reservation_affinity.policy` property matching the
+ specified value.
+ :param str reservation_id: (optional) Filters the collection to resources
+ with a `reservation.id` property matching the specified identifier.
+ :param str reservation_crn: (optional) Filters the collection to resources
+ with a `reservation.crn` property matching the specified identifier.
+ :param str reservation_name: (optional) Filters the collection to resources
+ with a `reservation.name` property matching the specified identifier.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching 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 `DedicatedHostGroupCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_dedicated_host_groups',
+ operation_id='list_instances',
)
headers.update(sdk_headers)
@@ -9541,8 +9902,23 @@ def list_dedicated_host_groups(
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
- 'zone.name': zone_name,
'name': name,
+ 'cluster_network.id': cluster_network_id,
+ 'cluster_network.crn': cluster_network_crn,
+ 'cluster_network.name': cluster_network_name,
+ 'dedicated_host.id': dedicated_host_id,
+ 'dedicated_host.crn': dedicated_host_crn,
+ 'dedicated_host.name': dedicated_host_name,
+ 'placement_group.id': placement_group_id,
+ 'placement_group.crn': placement_group_crn,
+ 'placement_group.name': placement_group_name,
+ 'reservation_affinity.policy': reservation_affinity_policy,
+ 'reservation.id': reservation_id,
+ 'reservation.crn': reservation_crn,
+ 'reservation.name': reservation_name,
+ 'vpc.id': vpc_id,
+ 'vpc.crn': vpc_crn,
+ 'vpc.name': vpc_name,
}
if 'headers' in kwargs:
@@ -9550,7 +9926,7 @@ def list_dedicated_host_groups(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/dedicated_host/groups'
+ url = '/instances'
request = self.prepare_request(
method='GET',
url=url,
@@ -9561,53 +9937,37 @@ def list_dedicated_host_groups(
response = self.send(request, **kwargs)
return response
- def create_dedicated_host_group(
+ def create_instance(
self,
- class_: str,
- family: str,
- zone: 'ZoneIdentity',
- *,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
+ instance_prototype: 'InstancePrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a dedicated host group.
+ Create an instance.
- This request creates a new dedicated host group.
+ This request provisions a new instance from an instance prototype object. The
+ prototype object is structured in the same way as a retrieved instance, and
+ contains the information necessary to provision the new instance. The instance is
+ automatically started.
+ For this request to succeed, the properties in the request must adhere to the
+ source's
+ `allowed_use` property.
- :param str class_: The dedicated host profile class for hosts in this
- group.
- :param str family: The dedicated host profile family for hosts in this
- group.
- :param ZoneIdentity zone: The zone this dedicated host group will reside
- in.
- :param str name: (optional) The name for this dedicated host group. The
- name must not be used by another dedicated host group in the region. 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) will be
- used.
+ :param InstancePrototype instance_prototype: The instance prototype object.
: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 `DedicatedHostGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `Instance` object
"""
- if class_ is None:
- raise ValueError('class_ must be provided')
- if family is None:
- raise ValueError('family must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- zone = convert_model(zone)
- if resource_group is not None:
- resource_group = convert_model(resource_group)
+ if instance_prototype is None:
+ raise ValueError('instance_prototype must be provided')
+ if isinstance(instance_prototype, InstancePrototype):
+ instance_prototype = convert_model(instance_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_dedicated_host_group',
+ operation_id='create_instance',
)
headers.update(sdk_headers)
@@ -9616,15 +9976,7 @@ def create_dedicated_host_group(
'generation': self.generation,
}
- data = {
- 'class': class_,
- 'family': family,
- 'zone': zone,
- 'name': name,
- 'resource_group': resource_group,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(instance_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -9632,7 +9984,7 @@ def create_dedicated_host_group(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/dedicated_host/groups'
+ url = '/instances'
request = self.prepare_request(
method='POST',
url=url,
@@ -9644,17 +9996,28 @@ def create_dedicated_host_group(
response = self.send(request, **kwargs)
return response
- def delete_dedicated_host_group(
+ def delete_instance(
self,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a dedicated host group.
+ Delete an instance.
- This request deletes a dedicated host group.
+ This request deletes an instance. This operation cannot be reversed. Any floating
+ IPs associated with instance network interfaces are implicitly disassociated. All
+ virtual network interfaces with `auto_delete` set to `true` targeting instance
+ network attachments on the instance are automatically deleted. All flow log
+ collectors with
+ `auto_delete` set to `true` targeting the instance, the instance network
+ attachments, the instance network interfaces, or the automatically deleted virtual
+ network interfaces are automatically deleted.
- :param str id: The dedicated host group identifier.
+ :param str id: The virtual server instance 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
@@ -9662,11 +10025,13 @@ def delete_dedicated_host_group(
if not id:
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_dedicated_host_group',
+ operation_id='delete_instance',
)
headers.update(sdk_headers)
@@ -9682,7 +10047,7 @@ def delete_dedicated_host_group(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_host/groups/{id}'.format(**path_param_dict)
+ url = '/instances/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -9693,21 +10058,20 @@ def delete_dedicated_host_group(
response = self.send(request, **kwargs)
return response
- def get_dedicated_host_group(
+ def get_instance(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a dedicated host group.
+ Retrieve an instance.
- This request retrieves a single dedicated host group specified by the identifier
- in the URL.
+ This request retrieves a single instance specified by the identifier in the URL.
- :param str id: The dedicated host group identifier.
+ :param str id: The virtual server instance 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 `DedicatedHostGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `Instance` object
"""
if not id:
@@ -9716,7 +10080,7 @@ def get_dedicated_host_group(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_dedicated_host_group',
+ operation_id='get_instance',
)
headers.update(sdk_headers)
@@ -9733,7 +10097,7 @@ def get_dedicated_host_group(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_host/groups/{id}'.format(**path_param_dict)
+ url = '/instances/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -9744,39 +10108,47 @@ def get_dedicated_host_group(
response = self.send(request, **kwargs)
return response
- def update_dedicated_host_group(
+ def update_instance(
self,
id: str,
- dedicated_host_group_patch: 'DedicatedHostGroupPatch',
+ instance_patch: 'InstancePatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a dedicated host group.
+ Update an instance.
- This request updates a dedicated host group with the information in a provided
- dedicated host group patch. The dedicated host group patch object is structured in
- the same way as a retrieved dedicated host group and contains only the information
- to be updated.
+ This request updates an instance with the information in a provided instance
+ patch. The instance patch object is structured in the same way as a retrieved
+ instance and contains only the information to be updated.
+ For this request to succeed, the properties in the request must adhere to the
+ `allowed_use` property in the volume referenced by
+ `boot_volume_attachment.volume`.
- :param str id: The dedicated host group identifier.
- :param DedicatedHostGroupPatch dedicated_host_group_patch: The dedicated
- host group patch.
+ :param str id: The virtual server instance identifier.
+ :param InstancePatch instance_patch: The instance 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 `DedicatedHostGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `Instance` object
"""
if not id:
raise ValueError('id must be provided')
- if dedicated_host_group_patch is None:
- raise ValueError('dedicated_host_group_patch must be provided')
- if isinstance(dedicated_host_group_patch, DedicatedHostGroupPatch):
- dedicated_host_group_patch = convert_model(dedicated_host_group_patch)
- headers = {}
+ if instance_patch is None:
+ raise ValueError('instance_patch must be provided')
+ if isinstance(instance_patch, InstancePatch):
+ instance_patch = convert_model(instance_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_dedicated_host_group',
+ operation_id='update_instance',
)
headers.update(sdk_headers)
@@ -9785,7 +10157,7 @@ def update_dedicated_host_group(
'generation': self.generation,
}
- data = json.dumps(dedicated_host_group_patch)
+ data = json.dumps(instance_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -9796,7 +10168,7 @@ def update_dedicated_host_group(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_host/groups/{id}'.format(**path_param_dict)
+ url = '/instances/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -9808,42 +10180,37 @@ def update_dedicated_host_group(
response = self.send(request, **kwargs)
return response
- def list_dedicated_host_profiles(
+ def get_instance_initialization(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List dedicated host profiles.
+ Retrieve initialization configuration for an instance.
- This request lists provisionable [dedicated host
- profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in the region. A
- dedicated host profile specifies the hardware characteristics for a dedicated
- host.
+ This request retrieves configuration used to initialize the instance, such as SSH
+ keys and the Windows administrator password. These can subsequently be changed on
+ the instance and therefore may not be current.
- :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 id: The instance 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 `DedicatedHostProfileCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceInitialization` object
"""
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_dedicated_host_profiles',
+ operation_id='get_instance_initialization',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -9851,7 +10218,10 @@ def list_dedicated_host_profiles(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/dedicated_host/profiles'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{id}/initialization'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -9862,30 +10232,38 @@ def list_dedicated_host_profiles(
response = self.send(request, **kwargs)
return response
- def get_dedicated_host_profile(
+ def create_instance_action(
self,
- name: str,
+ instance_id: str,
+ type: str,
+ *,
+ force: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a dedicated host profile.
+ Create an instance action.
- This request retrieves a single dedicated host profile specified by the name in
- the URL.
+ This request creates a new action which will be queued up to run as soon as any
+ pending or running actions have completed.
- :param str name: The dedicated host profile name.
+ :param str instance_id: The virtual server instance identifier.
+ :param str type: The type of action.
+ :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 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 `DedicatedHostProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceAction` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if type is None:
+ raise ValueError('type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_dedicated_host_profile',
+ operation_id='create_instance_action',
)
headers.update(sdk_headers)
@@ -9894,76 +10272,73 @@ def get_dedicated_host_profile(
'generation': self.generation,
}
+ data = {
+ 'type': type,
+ 'force': force,
+ }
+ 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_host/profiles/{name}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/actions'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_dedicated_hosts(
+ def list_instance_cluster_network_attachments(
self,
+ instance_id: str,
*,
- dedicated_host_group_id: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- zone_name: Optional[str] = None,
- name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List dedicated hosts.
+ List cluster network attachments on an instance.
- This request lists dedicated hosts in the region.
+ This request lists cluster network attachments on an instance. A cluster network
+ attachment represents a device on the instance to which a cluster network
+ interface is attached.
- :param str dedicated_host_group_id: (optional) Filters the collection to
- dedicated hosts with a `group.id` property matching the specified
- identifier.
+ :param str instance_id: The virtual server instance 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 resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching 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 `DedicatedHostCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceClusterNetworkAttachmentCollection` object
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_dedicated_hosts',
+ operation_id='list_instance_cluster_network_attachments',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'dedicated_host_group.id': dedicated_host_group_id,
'start': start,
'limit': limit,
- 'resource_group.id': resource_group_id,
- 'zone.name': zone_name,
- 'name': name,
}
if 'headers' in kwargs:
@@ -9971,7 +10346,10 @@ def list_dedicated_hosts(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/dedicated_hosts'
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/cluster_network_attachments'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -9982,32 +10360,66 @@ def list_dedicated_hosts(
response = self.send(request, **kwargs)
return response
- def create_dedicated_host(
+ def create_cluster_network_attachment(
self,
- dedicated_host_prototype: 'DedicatedHostPrototype',
+ instance_id: str,
+ cluster_network_interface: 'InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface',
+ *,
+ before: Optional['InstanceClusterNetworkAttachmentBeforePrototype'] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a dedicated host.
+ Create a cluster network attachment.
- This request creates a new dedicated host.
+ This request creates a cluster network attachment from an instance cluster network
+ attachment prototype object. A cluster network attachment will attach the instance
+ to a cluster network. The cluster network attachment prototype must specify a
+ cluster network interface identity or a cluster network interface prototype.
+ The instance must be in a `stopped` or `stopping` state to create an instance
+ cluster network attachment.
- :param DedicatedHostPrototype dedicated_host_prototype: The dedicated host
- prototype object.
+ :param str instance_id: The virtual server instance identifier.
+ :param InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface
+ cluster_network_interface: A cluster network interface for the instance
+ cluster network attachment. This can be
+ specified using an existing cluster network interface that does not already
+ have a
+ `target`, or a prototype object for a new cluster network interface.
+ This instance must reside in the same VPC as the specified cluster network
+ interface. The
+ cluster network interface must reside in the same cluster network as the
+ `cluster_network_interface` of any other `cluster_network_attachments` for
+ this instance.
+ :param InstanceClusterNetworkAttachmentBeforePrototype before: (optional)
+ The instance cluster network attachment to insert this instance cluster
+ network attachment
+ immediately before.
+ If unspecified, this instance cluster network attachment will be inserted
+ after all
+ existing instance cluster network attachments.
+ :param str name: (optional) The name for this cluster network attachment.
+ Names must be unique within the instance the cluster network attachment
+ resides in. If unspecified, the name will be a hyphenated list of
+ randomly-selected words. Names starting with `ibm-` are reserved for
+ provider-owned resources, and are not allowed.
: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 `DedicatedHost` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceClusterNetworkAttachment` object
"""
- if dedicated_host_prototype is None:
- raise ValueError('dedicated_host_prototype must be provided')
- if isinstance(dedicated_host_prototype, DedicatedHostPrototype):
- dedicated_host_prototype = convert_model(dedicated_host_prototype)
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if cluster_network_interface is None:
+ raise ValueError('cluster_network_interface must be provided')
+ cluster_network_interface = convert_model(cluster_network_interface)
+ if before is not None:
+ before = convert_model(before)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_dedicated_host',
+ operation_id='create_cluster_network_attachment',
)
headers.update(sdk_headers)
@@ -10016,7 +10428,13 @@ def create_dedicated_host(
'generation': self.generation,
}
- data = json.dumps(dedicated_host_prototype)
+ data = {
+ 'cluster_network_interface': cluster_network_interface,
+ 'before': before,
+ '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:
@@ -10024,7 +10442,10 @@ def create_dedicated_host(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/dedicated_hosts'
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/cluster_network_attachments'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -10036,32 +10457,36 @@ def create_dedicated_host(
response = self.send(request, **kwargs)
return response
- def list_dedicated_host_disks(
+ def delete_instance_cluster_network_attachment(
self,
- dedicated_host_id: str,
+ instance_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List disks on a dedicated host.
+ Delete an instance cluster network attachment.
- This request lists disks on a dedicated host. A disk is a physical device that is
- locally attached to the compute node. By default, the listed disks are sorted by
- their
- `created_at` property values, with the newest disk first.
+ This request deletes an instance cluster network attachment. The instance must be
+ in a
+ `stopped` or `stopping` state to delete an instance cluster network attachment.
+ This operation cannot be reversed.
- :param str dedicated_host_id: The dedicated host identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance cluster network attachment 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 `DedicatedHostDiskCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceClusterNetworkAttachment` object
"""
- if not dedicated_host_id:
- raise ValueError('dedicated_host_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_dedicated_host_disks',
+ operation_id='delete_instance_cluster_network_attachment',
)
headers.update(sdk_headers)
@@ -10075,12 +10500,12 @@ def list_dedicated_host_disks(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['dedicated_host_id']
- path_param_values = self.encode_path_vars(dedicated_host_id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_hosts/{dedicated_host_id}/disks'.format(**path_param_dict)
+ url = '/instances/{instance_id}/cluster_network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -10089,34 +10514,34 @@ def list_dedicated_host_disks(
response = self.send(request, **kwargs)
return response
- def get_dedicated_host_disk(
+ def get_instance_cluster_network_attachment(
self,
- dedicated_host_id: str,
+ instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a dedicated host disk.
+ Retrieve an instance cluster network attachment.
- This request retrieves a single dedicated host disk specified by the identifier in
- the URL.
+ This request retrieves a single instance cluster network attachment specified by
+ the identifier in the URL.
- :param str dedicated_host_id: The dedicated host identifier.
- :param str id: The dedicated host disk identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance cluster network attachment 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 `DedicatedHostDisk` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceClusterNetworkAttachment` object
"""
- if not dedicated_host_id:
- raise ValueError('dedicated_host_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_dedicated_host_disk',
+ operation_id='get_instance_cluster_network_attachment',
)
headers.update(sdk_headers)
@@ -10130,10 +10555,10 @@ def get_dedicated_host_disk(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['dedicated_host_id', 'id']
- path_param_values = self.encode_path_vars(dedicated_host_id, id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_hosts/{dedicated_host_id}/disks/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/cluster_network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -10144,41 +10569,45 @@ def get_dedicated_host_disk(
response = self.send(request, **kwargs)
return response
- def update_dedicated_host_disk(
+ def update_instance_cluster_network_attachment(
self,
- dedicated_host_id: str,
+ instance_id: str,
id: str,
- dedicated_host_disk_patch: 'DedicatedHostDiskPatch',
+ instance_cluster_network_attachment_patch: 'InstanceClusterNetworkAttachmentPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a dedicated host disk.
+ Update an instance cluster network attachment.
- This request updates the dedicated host disk with the information in a provided
- patch.
+ This request updates an instance cluster network attachment with the information
+ provided in an instance network interface patch object. The instance cluster
+ network attachment patch object is structured in the same way as a retrieved
+ instance cluster network attachment and needs to contain only the information to
+ be updated.
- :param str dedicated_host_id: The dedicated host identifier.
- :param str id: The dedicated host disk identifier.
- :param DedicatedHostDiskPatch dedicated_host_disk_patch: The dedicated host
- disk patch.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance cluster network attachment identifier.
+ :param InstanceClusterNetworkAttachmentPatch
+ instance_cluster_network_attachment_patch: The instance cluster network
+ attachment 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 `DedicatedHostDisk` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceClusterNetworkAttachment` object
"""
- if not dedicated_host_id:
- raise ValueError('dedicated_host_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
- if dedicated_host_disk_patch is None:
- raise ValueError('dedicated_host_disk_patch must be provided')
- if isinstance(dedicated_host_disk_patch, DedicatedHostDiskPatch):
- dedicated_host_disk_patch = convert_model(dedicated_host_disk_patch)
+ if instance_cluster_network_attachment_patch is None:
+ raise ValueError('instance_cluster_network_attachment_patch must be provided')
+ if isinstance(instance_cluster_network_attachment_patch, InstanceClusterNetworkAttachmentPatch):
+ instance_cluster_network_attachment_patch = convert_model(instance_cluster_network_attachment_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_dedicated_host_disk',
+ operation_id='update_instance_cluster_network_attachment',
)
headers.update(sdk_headers)
@@ -10187,7 +10616,7 @@ def update_dedicated_host_disk(
'generation': self.generation,
}
- data = json.dumps(dedicated_host_disk_patch)
+ data = json.dumps(instance_cluster_network_attachment_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -10195,10 +10624,10 @@ def update_dedicated_host_disk(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['dedicated_host_id', 'id']
- path_param_values = self.encode_path_vars(dedicated_host_id, id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_hosts/{dedicated_host_id}/disks/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/cluster_network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -10210,31 +10639,43 @@ def update_dedicated_host_disk(
response = self.send(request, **kwargs)
return response
- def delete_dedicated_host(
+ def create_instance_console_access_token(
self,
- id: str,
+ instance_id: str,
+ console_type: str,
+ *,
+ force: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a dedicated host.
+ Create a console access token for an instance.
- This request deletes a dedicated host. This operation cannot be reversed. For this
- request to succeed, `instances` must be empty and `instance_placement_enabled`
- must be `false`.
+ This request creates a new single-use console access token for an instance. All
+ console configuration is provided at token create time, and the token is
+ subsequently used in the `access_token` query parameter for the WebSocket request.
+ The access token is only valid for a short period of time, and a maximum of one
+ token is valid for a given instance at a time.
- :param str id: The dedicated host identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str console_type: The instance console type for which this token may
+ be used.
+ :param bool force: (optional) Indicates whether to disconnect an existing
+ serial console session as the serial console cannot be shared. This has no
+ effect on VNC consoles.
: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 `InstanceConsoleAccessToken` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if console_type is None:
+ raise ValueError('console_type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_dedicated_host',
+ operation_id='create_instance_console_access_token',
)
headers.update(sdk_headers)
@@ -10243,48 +10684,60 @@ def delete_dedicated_host(
'generation': self.generation,
}
+ data = {
+ 'console_type': console_type,
+ 'force': force,
+ }
+ 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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_hosts/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/console_access_token'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_dedicated_host(
+ def list_instance_disks(
self,
- id: str,
+ instance_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a dedicated host.
+ List disks on an instance.
- This request retrieves a single dedicated host specified by the identifiers in the
- URL.
+ This request lists disks on an instance. A disk is a block device that is locally
+ attached to the instance's physical host and is also referred to as instance
+ storage. By default, the listed disks are sorted by their `created_at` property
+ values, with the newest disk first.
- :param str id: The dedicated host identifier.
+ :param str instance_id: The virtual server instance 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 `DedicatedHost` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceDiskCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_dedicated_host',
+ operation_id='list_instance_disks',
)
headers.update(sdk_headers)
@@ -10298,10 +10751,10 @@ def get_dedicated_host(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_hosts/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/disks'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -10312,37 +10765,34 @@ def get_dedicated_host(
response = self.send(request, **kwargs)
return response
- def update_dedicated_host(
+ def get_instance_disk(
self,
+ instance_id: str,
id: str,
- dedicated_host_patch: 'DedicatedHostPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a dedicated host.
+ Retrieve an instance disk.
- This request updates a dedicated host with the information in a provided dedicated
- host patch. The dedicated host patch object is structured in the same way as a
- retrieved dedicated host and contains only the information to be updated.
+ This request retrieves a single instance disk specified by the identifier in the
+ URL.
- :param str id: The dedicated host identifier.
- :param DedicatedHostPatch dedicated_host_patch: The dedicated host patch.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance disk 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 `DedicatedHost` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceDisk` object
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
- if dedicated_host_patch is None:
- raise ValueError('dedicated_host_patch must be provided')
- if isinstance(dedicated_host_patch, DedicatedHostPatch):
- dedicated_host_patch = convert_model(dedicated_host_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_dedicated_host',
+ operation_id='get_instance_disk',
)
headers.update(sdk_headers)
@@ -10351,121 +10801,117 @@ def update_dedicated_host(
'generation': self.generation,
}
- data = json.dumps(dedicated_host_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/dedicated_hosts/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/disks/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Placement groups
- #########################
-
- def list_placement_groups(
+ def update_instance_disk(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ instance_id: str,
+ id: str,
+ instance_disk_patch: 'InstanceDiskPatch',
**kwargs,
) -> DetailedResponse:
"""
- List placement groups.
+ Update an instance disk.
- This request lists placement groups in the region.
+ This request updates the instance disk with the information in a provided patch.
- :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 instance_id: The virtual server instance identifier.
+ :param str id: The instance disk identifier.
+ :param InstanceDiskPatch instance_disk_patch: The instance disk 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 `PlacementGroupCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceDisk` object
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if instance_disk_patch is None:
+ raise ValueError('instance_disk_patch must be provided')
+ if isinstance(instance_disk_patch, InstanceDiskPatch):
+ instance_disk_patch = convert_model(instance_disk_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_placement_groups',
+ operation_id='update_instance_disk',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
+ data = json.dumps(instance_disk_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/placement_groups'
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/disks/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_placement_group(
+ def list_instance_network_attachments(
self,
- strategy: str,
- *,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
+ instance_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a placement group.
+ List network attachments on an instance.
- This request creates a new placement group.
+ This request lists network attachments on an instance. A network attachment
+ represents a device on the instance to which a virtual network interface is
+ attached.
+ The network attachments will be sorted by their `created_at` property values, with
+ newest network attachments first. Network attachments with identical `created_at`
+ property values will in turn be sorted by ascending `name` property values.
- :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.
- :param str name: (optional) The name for this placement group. The name
- must not be used by another placement group in the region. 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) will be
- used.
+ :param str instance_id: The virtual server instance 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 `PlacementGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceNetworkAttachmentCollection` object
"""
- if strategy is None:
- raise ValueError('strategy must be provided')
- if resource_group is not None:
- resource_group = convert_model(resource_group)
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_placement_group',
+ operation_id='list_instance_network_attachments',
)
headers.update(sdk_headers)
@@ -10474,57 +10920,69 @@ def create_placement_group(
'generation': self.generation,
}
- data = {
- 'strategy': strategy,
- '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/placement_groups'
- request = self.prepare_request(
- method='POST',
- url=url,
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/network_attachments'.format(**path_param_dict)
+ request = self.prepare_request(
+ method='GET',
+ url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_placement_group(
+ def create_instance_network_attachment(
self,
- id: str,
+ instance_id: str,
+ virtual_network_interface: 'InstanceNetworkAttachmentPrototypeVirtualNetworkInterface',
+ *,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a placement group.
+ Create a network attachment on an instance.
- This request deletes a placement group. This operation cannot be reversed. For
- this request to succeed, the placement group must not be associated with an
- instance.
+ This request creates a new instance network attachment from an instance network
+ attachment prototype object. The prototype object is structured in the same way as
+ a retrieved instance network attachment, and contains the information necessary to
+ create the new instance network attachment.
- :param str id: The placement group identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param InstanceNetworkAttachmentPrototypeVirtualNetworkInterface
+ virtual_network_interface: A virtual network interface for the instance
+ network attachment. This can be specified
+ using an existing virtual network interface, or a prototype object for a
+ new virtual
+ network interface.
+ If an existing virtual network interface is specified,
+ `enable_infrastructure_nat` must be
+ `true`.
+ :param str name: (optional) The name for this network attachment. Names
+ must be unique within the instance the network attachment 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
+ :rtype: DetailedResponse with `dict` result representing a `InstanceNetworkAttachment` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if virtual_network_interface is None:
+ raise ValueError('virtual_network_interface must be provided')
+ virtual_network_interface = convert_model(virtual_network_interface)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_placement_group',
+ operation_id='create_instance_network_attachment',
)
headers.update(sdk_headers)
@@ -10533,48 +10991,65 @@ def delete_placement_group(
'generation': self.generation,
}
+ data = {
+ 'virtual_network_interface': virtual_network_interface,
+ '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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/placement_groups/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_attachments'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_placement_group(
+ def delete_instance_network_attachment(
self,
+ instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a placement group.
+ Delete an instance network attachment.
- This request retrieves a single placement group specified by identifier in the
- URL.
+ This request deletes an instance network attachment. This operation cannot be
+ reversed. Any floating IPs associated with the instance network attachment are
+ implicitly disassociated. All flow log collectors with `auto_delete` set to `true`
+ targeting the instance network attachment are automatically deleted. The primary
+ instance network attachment is not allowed to be deleted.
- :param str id: The placement group identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance network attachment 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 `PlacementGroup` object
+ :rtype: DetailedResponse
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_placement_group',
+ operation_id='delete_instance_network_attachment',
)
headers.update(sdk_headers)
@@ -10586,14 +11061,13 @@ def get_placement_group(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/placement_groups/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -10602,38 +11076,34 @@ def get_placement_group(
response = self.send(request, **kwargs)
return response
- def update_placement_group(
+ def get_instance_network_attachment(
self,
+ instance_id: str,
id: str,
- placement_group_patch: 'PlacementGroupPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a placement group.
+ Retrieve an instance network attachment.
- This request updates a placement group with the information provided placement
- group patch. The placement group patch object is structured in the same way as a
- retrieved placement group and contains only the information to be updated.
+ This request retrieves a single instance network attachment specified by the
+ identifier in the URL.
- :param str id: The placement group identifier.
- :param PlacementGroupPatch placement_group_patch: The placement group
- patch.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance network attachment 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 `PlacementGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceNetworkAttachment` object
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
- if placement_group_patch is None:
- raise ValueError('placement_group_patch must be provided')
- if isinstance(placement_group_patch, PlacementGroupPatch):
- placement_group_patch = convert_model(placement_group_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_placement_group',
+ operation_id='get_instance_network_attachment',
)
headers.update(sdk_headers)
@@ -10642,111 +11112,126 @@ def update_placement_group(
'generation': self.generation,
}
- data = json.dumps(placement_group_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/placement_groups/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Bare metal servers
- #########################
-
- def list_bare_metal_server_profiles(
+ def update_instance_network_attachment(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ instance_id: str,
+ id: str,
+ instance_network_attachment_patch: 'InstanceNetworkAttachmentPatch',
**kwargs,
) -> DetailedResponse:
"""
- List bare metal server profiles.
+ Update an instance network attachment.
- This request lists [bare metal server
- profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
- available in the region. A bare metal server profile specifies the performance
- characteristics and pricing model for a bare metal server.
+ This request updates an instance network attachment with the information provided
+ in an instance network interface patch object. The instance network attachment
+ patch object is structured in the same way as a retrieved instance network
+ attachment and needs to contain only the information to be updated.
- :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 instance_id: The virtual server instance identifier.
+ :param str id: The instance network attachment identifier.
+ :param InstanceNetworkAttachmentPatch instance_network_attachment_patch:
+ The instance network attachment 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 `BareMetalServerProfileCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `InstanceNetworkAttachment` object
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if instance_network_attachment_patch is None:
+ raise ValueError('instance_network_attachment_patch must be provided')
+ if isinstance(instance_network_attachment_patch, InstanceNetworkAttachmentPatch):
+ instance_network_attachment_patch = convert_model(instance_network_attachment_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_bare_metal_server_profiles',
+ operation_id='update_instance_network_attachment',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
+ data = json.dumps(instance_network_attachment_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/bare_metal_server/profiles'
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/network_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_profile(
+ def list_instance_network_interfaces(
self,
- name: str,
+ instance_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a bare metal server profile.
+ List network interfaces on an instance.
- This request retrieves a single bare metal server profile specified by the name in
- the URL.
+ This request lists network interfaces on an instance. An instance network
+ interface is an abstract representation of a network device and attaches an
+ instance to a single subnet. Each network interface on an instance can attach to
+ any subnet in the zone, including subnets that are already attached to the
+ instance. Multiple network interfaces on the instance may also attach to the same
+ subnet.
+ If this instance has network attachments, each returned network interface is a
+ [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface.
- :param str name: The bare metal server profile name.
+ :param str instance_id: The virtual server instance 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 `BareMetalServerProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkInterfaceUnpaginatedCollection` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not instance_id:
+ raise ValueError('instance_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_profile',
+ operation_id='list_instance_network_interfaces',
)
headers.update(sdk_headers)
@@ -10760,10 +11245,10 @@ def get_bare_metal_server_profile(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_server/profiles/{name}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -10774,119 +11259,150 @@ def get_bare_metal_server_profile(
response = self.send(request, **kwargs)
return response
- def list_bare_metal_servers(
+ def create_instance_network_interface(
self,
+ instance_id: str,
+ subnet: 'SubnetIdentity',
*,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
+ allow_ip_spoofing: Optional[bool] = None,
name: Optional[str] = None,
- reservation_id: Optional[str] = None,
- reservation_crn: Optional[str] = None,
- reservation_name: Optional[str] = None,
- vpc_id: Optional[str] = None,
- vpc_crn: Optional[str] = None,
- vpc_name: Optional[str] = None,
+ primary_ip: Optional['NetworkInterfaceIPPrototype'] = None,
+ security_groups: Optional[List['SecurityGroupIdentity']] = None,
**kwargs,
) -> DetailedResponse:
"""
- List bare metal servers.
+ Create a network interface on an instance.
- This request lists bare metal servers in the region.
+ This request creates a new instance network interface from an instance network
+ interface prototype object. The prototype object is structured in the same way as
+ a retrieved instance network interface, and contains the information necessary to
+ create the new instance network interface. Any subnet in the instance's VPC may be
+ specified. Addresses on the instance network interface must be within the
+ specified subnet's CIDR blocks.
+ If this instance has network attachments, each network interface is a [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and new network interfaces are not allowed to be created.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str reservation_id: (optional) Filters the collection to resources
- with a `reservation.id` property matching the specified identifier.
- :param str reservation_crn: (optional) Filters the collection to resources
- with a `reservation.crn` property matching the specified identifier.
- :param str reservation_name: (optional) Filters the collection to resources
- with a `reservation.name` property matching the specified identifier.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
+ :param str instance_id: The virtual server instance identifier.
+ :param SubnetIdentity subnet: The associated subnet.
+ :param bool allow_ip_spoofing: (optional) Indicates whether source IP
+ spoofing is allowed on this instance network interface.
+ If this instance has network attachments, this network interface is a
+ [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and source IP spoofing is managed on the attached virtual
+ network interface.
+ :param str name: (optional) The name for the instance network interface.
+ The name must not be used by another network interface on the virtual
+ server instance. 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 instance 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 instance 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 instance network interface. 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 `BareMetalServerCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkInterface` object
"""
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if subnet is None:
+ raise ValueError('subnet must be provided')
+ subnet = convert_model(subnet)
+ if primary_ip is not None:
+ primary_ip = convert_model(primary_ip)
+ 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='list_bare_metal_servers',
+ operation_id='create_instance_network_interface',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
+ }
+
+ data = {
+ 'subnet': subnet,
+ 'allow_ip_spoofing': allow_ip_spoofing,
'name': name,
- 'reservation.id': reservation_id,
- 'reservation.crn': reservation_crn,
- 'reservation.name': reservation_name,
- 'vpc.id': vpc_id,
- 'vpc.crn': vpc_crn,
- 'vpc.name': vpc_name,
+ 'primary_ip': primary_ip,
+ '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/bare_metal_servers'
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/network_interfaces'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_bare_metal_server(
+ def delete_instance_network_interface(
self,
- bare_metal_server_prototype: 'BareMetalServerPrototype',
+ instance_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a bare metal server.
+ Delete an instance network interface.
- This request provisions a new bare metal server from a prototype object. The
- prototype object is structured in the same way as a retrieved bare metal server,
- and contains the information necessary to provision the new bare metal server. The
- bare metal server is automatically started.
+ This request deletes an instance network interface. This operation cannot be
+ reversed. Any floating IPs associated with the instance network interface are
+ implicitly disassociated. All flow log collectors with `auto_delete` set to `true`
+ targeting the instance network interface are automatically deleted. The primary
+ instance network interface is not allowed to be deleted.
+ If this instance has network attachments, this network interface is a [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and is not allowed to be deleted.
- :param BareMetalServerPrototype bare_metal_server_prototype: The bare metal
- server prototype object.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance 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 `BareMetalServer` object
+ :rtype: DetailedResponse
"""
- if bare_metal_server_prototype is None:
- raise ValueError('bare_metal_server_prototype must be provided')
- if isinstance(bare_metal_server_prototype, BareMetalServerPrototype):
- bare_metal_server_prototype = convert_model(bare_metal_server_prototype)
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_bare_metal_server',
+ operation_id='delete_instance_network_interface',
)
headers.update(sdk_headers)
@@ -10895,67 +11411,57 @@ def create_bare_metal_server(
'generation': self.generation,
}
- data = json.dumps(bare_metal_server_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/bare_metal_servers'
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/instances/{instance_id}/network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def create_bare_metal_server_console_access_token(
+ def get_instance_network_interface(
self,
- bare_metal_server_id: str,
- console_type: str,
- *,
- force: Optional[bool] = None,
+ instance_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a console access token for a bare metal server.
+ Retrieve an instance network interface.
- This request creates a new single-use console access token for a bare metal
- server. All console configuration is provided at token create time, and the token
- is subsequently used in the `access_token` query parameter for the WebSocket
- request. The access token is only valid for a short period of time, and a maximum
- of one token is valid for a given bare metal server at a time. For this request
- to succeed, the server must have a `status` of `stopped`, `starting`, or
- `running`.
+ This request retrieves a single instance network interface specified by the
+ identifier in the URL.
+ If this instance has network attachments, the retrieved network interface is a
+ [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str console_type: The bare metal server console type for which this
- token may be used
- Must be `serial` for bare metal servers with a `cpu.architecture` of
- `s390x`.
- :param bool force: (optional) 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 instance_id: The virtual server instance identifier.
+ :param str id: The instance 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 `BareMetalServerConsoleAccessToken` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkInterface` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if console_type is None:
- raise ValueError('console_type must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_bare_metal_server_console_access_token',
+ operation_id='get_instance_network_interface',
)
headers.update(sdk_headers)
@@ -10964,59 +11470,66 @@ def create_bare_metal_server_console_access_token(
'generation': self.generation,
}
- data = {
- 'console_type': console_type,
- 'force': force,
- }
- 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id']
- path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/console_access_token'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_bare_metal_server_disks(
+ def update_instance_network_interface(
self,
- bare_metal_server_id: str,
+ instance_id: str,
+ id: str,
+ network_interface_patch: 'NetworkInterfacePatch',
**kwargs,
) -> DetailedResponse:
"""
- List disks on a bare metal server.
+ Update an instance network interface.
- This request lists disks on a bare metal server. A disk is a block device that
- is locally attached to the physical server. By default, the listed disks are
- sorted by their `created_at` property values, with the newest disk first.
+ This request updates an instance network interface with the information provided
+ in an instance network interface patch object. The instance network interface
+ patch object is structured in the same way as a retrieved instance network
+ interface and needs to contain only the information to be updated.
+ If this instance has network attachments, this network interface is a [read-only
+ representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
+ of its corresponding network attachment and its attached virtual network
+ interface, and is not allowed to be updated.
- :param str bare_metal_server_id: The bare metal server identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The instance network interface identifier.
+ :param NetworkInterfacePatch network_interface_patch: The instance network
+ interface 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 `BareMetalServerDiskCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkInterface` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if network_interface_patch is None:
+ raise ValueError('network_interface_patch must be provided')
+ if isinstance(network_interface_patch, NetworkInterfacePatch):
+ network_interface_patch = convert_model(network_interface_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_bare_metal_server_disks',
+ operation_id='update_instance_network_interface',
)
headers.update(sdk_headers)
@@ -11025,52 +11538,56 @@ def list_bare_metal_server_disks(
'generation': self.generation,
}
+ data = json.dumps(network_interface_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id']
- path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/disks'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_disk(
+ def list_instance_network_interface_floating_ips(
self,
- bare_metal_server_id: str,
- id: str,
+ instance_id: str,
+ network_interface_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a bare metal server disk.
+ List floating IPs associated with an instance network interface.
- This request retrieves a single disk specified by the identifier in the URL.
+ This request lists floating IPs associated with an instance network interface.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server disk identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance 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 `BareMetalServerDisk` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIPUnpaginatedCollection` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not network_interface_id:
+ 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='get_bare_metal_server_disk',
+ operation_id='list_instance_network_interface_floating_ips',
)
headers.update(sdk_headers)
@@ -11084,10 +11601,10 @@ def get_bare_metal_server_disk(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id', 'network_interface_id']
+ path_param_values = self.encode_path_vars(instance_id, network_interface_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/disks/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -11098,41 +11615,38 @@ def get_bare_metal_server_disk(
response = self.send(request, **kwargs)
return response
- def update_bare_metal_server_disk(
+ def remove_instance_network_interface_floating_ip(
self,
- bare_metal_server_id: str,
+ instance_id: str,
+ network_interface_id: str,
id: str,
- bare_metal_server_disk_patch: 'BareMetalServerDiskPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a bare metal server disk.
+ Disassociate a floating IP from an instance network interface.
- This request updates the bare metal server disk with the information in a provided
- patch.
+ This request disassociates the specified floating IP from the specified instance
+ network interface.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server disk identifier.
- :param BareMetalServerDiskPatch bare_metal_server_disk_patch: The bare
- metal server disk patch.
+ :param str instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance network interface identifier.
+ :param str id: The floating 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 `BareMetalServerDisk` object
+ :rtype: DetailedResponse
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
- if bare_metal_server_disk_patch is None:
- raise ValueError('bare_metal_server_disk_patch must be provided')
- if isinstance(bare_metal_server_disk_patch, BareMetalServerDiskPatch):
- bare_metal_server_disk_patch = convert_model(bare_metal_server_disk_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_bare_metal_server_disk',
+ operation_id='remove_instance_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -11141,73 +11655,62 @@ def update_bare_metal_server_disk(
'generation': self.generation,
}
- data = json.dumps(bare_metal_server_disk_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id', 'network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, network_interface_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/disks/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_bare_metal_server_network_attachments(
+ def get_instance_network_interface_floating_ip(
self,
- bare_metal_server_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ instance_id: str,
+ network_interface_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List network attachments on a bare metal server.
+ Retrieve associated floating IP.
- This request lists network attachments on a bare metal server. A bare metal server
- network attachment is an abstract representation of a network device and attaches
- a bare metal server to a single subnet. Each network interface on a bare metal
- server can attach to any subnet in the zone, including subnets that are already
- attached to the bare metal server.
- The network attachments will be sorted by their `created_at` property values, with
- newest network attachments first. Network attachments with identical `created_at`
- property values will in turn be sorted by ascending `name` property values.
+ This request retrieves a specified floating IP address if it is associated with
+ the instance network interface and instance specified in the URL.
- :param str bare_metal_server_id: The bare metal 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 instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance network interface identifier.
+ :param str id: The floating 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 `BareMetalServerNetworkAttachmentCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIP` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
+ if not id:
+ raise ValueError('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_attachments',
+ operation_id='get_instance_network_interface_floating_ip',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -11215,10 +11718,10 @@ def list_bare_metal_server_network_attachments(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id']
- path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_keys = ['instance_id', 'network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(instance_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_attachments'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -11229,40 +11732,42 @@ def list_bare_metal_server_network_attachments(
response = self.send(request, **kwargs)
return response
- def create_bare_metal_server_network_attachment(
+ def add_instance_network_interface_floating_ip(
self,
- bare_metal_server_id: str,
- bare_metal_server_network_attachment_prototype: 'BareMetalServerNetworkAttachmentPrototype',
+ instance_id: str,
+ network_interface_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a network attachment on a bare metal server.
+ Associate a floating IP with an instance network interface.
- This request creates a new bare metal server network attachment from a bare metal
- server network attachment prototype object. The prototype object is structured in
- the same way as a retrieved bare metal server network attachment, and contains the
- information necessary to create the new bare metal server network attachment.
+ This request associates the specified floating IP with the specified instance
+ network interface, replacing any existing association.
+ The existing floating IP must:
+ - not be required by another resource, such as a public gateway
+ - be in the same `zone` as the instance
+ A request body is not required, and if provided, is ignored.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param BareMetalServerNetworkAttachmentPrototype
- bare_metal_server_network_attachment_prototype: The bare metal server
- network attachment prototype object.
+ :param str instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance network interface identifier.
+ :param str id: The floating 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 `BareMetalServerNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIP` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if bare_metal_server_network_attachment_prototype is None:
- raise ValueError('bare_metal_server_network_attachment_prototype must be provided')
- if isinstance(bare_metal_server_network_attachment_prototype, BareMetalServerNetworkAttachmentPrototype):
- bare_metal_server_network_attachment_prototype = convert_model(bare_metal_server_network_attachment_prototype)
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_bare_metal_server_network_attachment',
+ operation_id='add_instance_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -11271,77 +11776,83 @@ def create_bare_metal_server_network_attachment(
'generation': self.generation,
}
- data = json.dumps(bare_metal_server_network_attachment_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id']
- path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_keys = ['instance_id', 'network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(instance_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_attachments'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_bare_metal_server_network_attachment(
+ def list_instance_network_interface_ips(
self,
- bare_metal_server_id: str,
- id: str,
+ instance_id: str,
+ network_interface_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a bare metal server network attachment.
+ List the primary reserved IP for an instance network interface.
- This request deletes a bare metal server network attachment. This operation cannot
- be reversed. Any floating IPs associated with the bare metal server network
- attachment are implicitly disassociated.
- The bare metal server's primary network attachment cannot be deleted.
+ This request lists the primary reserved IP for an instance network interface.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server network attachment identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance network interface 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 `ReservedIPCollectionInstanceNetworkInterfaceContext` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ logging.warning('A deprecated operation has been invoked: list_instance_network_interface_ips')
+
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not network_interface_id:
+ 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='delete_bare_metal_server_network_attachment',
+ operation_id='list_instance_network_interface_ips',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id', 'network_interface_id']
+ path_param_values = self.encode_path_vars(instance_id, network_interface_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/ips'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -11350,34 +11861,41 @@ def delete_bare_metal_server_network_attachment(
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_network_attachment(
+ def get_instance_network_interface_ip(
self,
- bare_metal_server_id: str,
+ instance_id: str,
+ network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a bare metal server network attachment.
+ Retrieve the primary reserved IP.
- This request retrieves a single bare metal server network attachment specified by
- the identifier in the URL.
+ This request retrieves the primary reserved IP for an instance network interface.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server network attachment identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance 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 `BareMetalServerNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ logging.warning('A deprecated operation has been invoked: get_instance_network_interface_ip')
+
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not network_interface_id:
+ raise ValueError('network_interface_id must be provided')
if not id:
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_attachment',
+ operation_id='get_instance_network_interface_ip',
)
headers.update(sdk_headers)
@@ -11391,10 +11909,10 @@ def get_bare_metal_server_network_attachment(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id', 'network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(instance_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_attachments/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -11405,45 +11923,31 @@ def get_bare_metal_server_network_attachment(
response = self.send(request, **kwargs)
return response
- def update_bare_metal_server_network_attachment(
+ def list_instance_volume_attachments(
self,
- bare_metal_server_id: str,
- id: str,
- bare_metal_server_network_attachment_patch: 'BareMetalServerNetworkAttachmentPatch',
+ instance_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Update a bare metal server network attachment.
+ List volumes attachments on an instance.
- This request updates a bare metal server network attachment with the information
- provided in a bare metal server network attachment patch object. The bare metal
- server network attachment patch object is structured in the same way as a
- retrieved bare metal server network attachment and contains only the information
- to be updated.
+ This request lists volume attachments on an instance. A volume attachment connects
+ a volume to an instance. Each instance may have many volume attachments but each
+ volume attachment connects exactly one instance to exactly one volume.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server network attachment identifier.
- :param BareMetalServerNetworkAttachmentPatch
- bare_metal_server_network_attachment_patch: The bare metal server network
- attachment patch.
+ :param str instance_id: The virtual server instance 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 `BareMetalServerNetworkAttachment` object
+ :rtype: DetailedResponse with `dict` result representing a `VolumeAttachmentCollection` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if bare_metal_server_network_attachment_patch is None:
- raise ValueError('bare_metal_server_network_attachment_patch must be provided')
- if isinstance(bare_metal_server_network_attachment_patch, BareMetalServerNetworkAttachmentPatch):
- bare_metal_server_network_attachment_patch = convert_model(bare_metal_server_network_attachment_patch)
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_bare_metal_server_network_attachment',
+ operation_id='list_instance_volume_attachments',
)
headers.update(sdk_headers)
@@ -11452,138 +11956,133 @@ def update_bare_metal_server_network_attachment(
'generation': self.generation,
}
- data = json.dumps(bare_metal_server_network_attachment_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/volume_attachments'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_bare_metal_server_network_interfaces(
+ def create_instance_volume_attachment(
self,
- bare_metal_server_id: str,
+ instance_id: str,
+ volume: 'VolumeAttachmentPrototypeVolume',
*,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ delete_volume_on_instance_delete: Optional[bool] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List network interfaces on a bare metal server.
+ Create a volume attachment on an instance.
- This request lists network interfaces on a bare metal server. A bare metal server
- network interface is an abstract representation of a network device and attaches a
- bare metal server to a single subnet. Each network interface on a bare metal
- server can attach to any subnet in the zone, including subnets that are already
- attached to the bare metal server.
- If this bare metal server has network attachments, each returned network interface
- is a [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface.
+ This request creates a new volume attachment from a volume attachment prototype
+ object, connecting a volume to an instance. For this request to succeed, the
+ specified volume must not be busy. The prototype object is structured in the same
+ way as a retrieved volume attachment, and contains the information necessary to
+ create the new volume attachment.
- :param str bare_metal_server_id: The bare metal 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 instance_id: The virtual server instance identifier.
+ :param VolumeAttachmentPrototypeVolume volume: The volume to use for this
+ attachment. This can be specified as an existing unattached
+ volume, or a prototype object for a new volume.
+ :param bool delete_volume_on_instance_delete: (optional) Indicates whether
+ deleting the instance will also delete the attached volume.
+ :param str name: (optional) The name for this volume attachment. The name
+ must not be used by another volume attachment on the instance. 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 `BareMetalServerNetworkInterfaceCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VolumeAttachment` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if volume is None:
+ raise ValueError('volume must be provided')
+ volume = convert_model(volume)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_bare_metal_server_network_interfaces',
+ operation_id='create_instance_volume_attachment',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
+ data = {
+ 'volume': volume,
+ 'delete_volume_on_instance_delete': delete_volume_on_instance_delete,
+ '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id']
- path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_keys = ['instance_id']
+ path_param_values = self.encode_path_vars(instance_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces'.format(**path_param_dict)
+ url = '/instances/{instance_id}/volume_attachments'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_bare_metal_server_network_interface(
+ def delete_instance_volume_attachment(
self,
- bare_metal_server_id: str,
- bare_metal_server_network_interface_prototype: 'BareMetalServerNetworkInterfacePrototype',
+ instance_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a network interface on a bare metal server.
+ Delete a volume attachment.
- This request creates a new bare metal server network interface from a bare metal
- server network interface prototype object. The prototype object is structured in
- the same way as a retrieved bare metal server network interface, and contains the
- information necessary to create the new bare metal server network interface. Any
- subnet in the bare metal server's VPC may be specified, even if it is already
- attached to another bare metal server network interface. Addresses on the bare
- metal server network interface must be within the specified subnet's CIDR blocks.
- If this bare metal server has network attachments, each network interface is a
- [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and new network interfaces are not allowed to be created.
+ This request deletes a volume attachment. This operation cannot be reversed, but a
+ new volume attachment may subsequently be created for the volume. For this
+ request to succeed, the volume must not be busy.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param BareMetalServerNetworkInterfacePrototype
- bare_metal_server_network_interface_prototype: The bare metal server
- network interface prototype object.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The volume attachment 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 `BareMetalServerNetworkInterface` object
+ :rtype: DetailedResponse
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if bare_metal_server_network_interface_prototype is None:
- raise ValueError('bare_metal_server_network_interface_prototype must be provided')
- if isinstance(bare_metal_server_network_interface_prototype, BareMetalServerNetworkInterfacePrototype):
- bare_metal_server_network_interface_prototype = convert_model(bare_metal_server_network_interface_prototype)
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_bare_metal_server_network_interface',
+ operation_id='delete_instance_volume_attachment',
)
headers.update(sdk_headers)
@@ -11592,64 +12091,52 @@ def create_bare_metal_server_network_interface(
'generation': self.generation,
}
- data = json.dumps(bare_metal_server_network_interface_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id']
- path_param_values = self.encode_path_vars(bare_metal_server_id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces'.format(**path_param_dict)
+ url = '/instances/{instance_id}/volume_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_bare_metal_server_network_interface(
+ def get_instance_volume_attachment(
self,
- bare_metal_server_id: str,
+ instance_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a bare metal server network interface.
+ Retrieve a volume attachment.
- This request deletes a bare metal server network interface. This operation cannot
- be reversed. Any floating IPs associated with the bare metal server network
- interface are implicitly disassociated. The primary bare metal server network
- interface is not allowed to be deleted.
- If this bare metal server has network attachments, this network interface is a
- [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and is not allowed to be deleted.
+ This request retrieves a single volume attachment specified by the identifier in
+ the URL.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server network interface identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The volume attachment 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 `VolumeAttachment` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_bare_metal_server_network_interface',
+ operation_id='get_instance_volume_attachment',
)
headers.update(sdk_headers)
@@ -11661,13 +12148,14 @@ def delete_bare_metal_server_network_interface(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/volume_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -11676,39 +12164,43 @@ def delete_bare_metal_server_network_interface(
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_network_interface(
+ def update_instance_volume_attachment(
self,
- bare_metal_server_id: str,
+ instance_id: str,
id: str,
+ volume_attachment_patch: 'VolumeAttachmentPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a bare metal server network interface.
+ Update a volume attachment.
- This request retrieves a single bare metal server network interface specified by
- the identifier in the URL.
- If this bare metal server has network attachments, the retrieved network interface
- is a [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface.
+ This request updates a volume attachment with the information provided in a volume
+ attachment patch object. The volume attachment patch object is structured in the
+ same way as a retrieved volume attachment and needs to contain only the
+ information to be updated.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server network interface identifier.
+ :param str instance_id: The virtual server instance identifier.
+ :param str id: The volume attachment identifier.
+ :param VolumeAttachmentPatch volume_attachment_patch: The volume attachment
+ 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 `BareMetalServerNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `VolumeAttachment` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
+ if not instance_id:
+ raise ValueError('instance_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if volume_attachment_patch is None:
+ raise ValueError('volume_attachment_patch must be provided')
+ if isinstance(volume_attachment_patch, VolumeAttachmentPatch):
+ volume_attachment_patch = convert_model(volume_attachment_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_bare_metal_server_network_interface',
+ operation_id='update_instance_volume_attachment',
)
headers.update(sdk_headers)
@@ -11717,129 +12209,136 @@ def get_bare_metal_server_network_interface(
'generation': self.generation,
}
+ data = json.dumps(volume_attachment_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
+ path_param_keys = ['instance_id', 'id']
+ path_param_values = self.encode_path_vars(instance_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}'.format(**path_param_dict)
+ url = '/instances/{instance_id}/volume_attachments/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_bare_metal_server_network_interface(
+ #########################
+ # Keys
+ #########################
+
+ def list_keys(
self,
- bare_metal_server_id: str,
- id: str,
- bare_metal_server_network_interface_patch: 'BareMetalServerNetworkInterfacePatch',
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a bare metal server network interface.
+ List keys.
- This request updates a bare metal server network interface with the information
- provided in a bare metal server network interface patch object. The bare metal
- server network interface patch object is structured in the same way as a retrieved
- bare metal server network interface and needs to contain only the information to
- be updated.
- If this bare metal server has network attachments, this network interface is a
- [read-only
- representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
- of its corresponding network attachment and its attached virtual network
- interface, and is not allowed to be updated.
+ This request lists keys in the region. A key contains a public SSH key which may
+ be installed on instances when they are created. Private keys are not stored.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str id: The bare metal server network interface identifier.
- :param BareMetalServerNetworkInterfacePatch
- bare_metal_server_network_interface_patch: The bare metal server network
- interface patch.
+ :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 with a `resource_group.id` property matching 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 `BareMetalServerNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `KeyCollection` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if bare_metal_server_network_interface_patch is None:
- raise ValueError('bare_metal_server_network_interface_patch must be provided')
- if isinstance(bare_metal_server_network_interface_patch, BareMetalServerNetworkInterfacePatch):
- bare_metal_server_network_interface_patch = convert_model(bare_metal_server_network_interface_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_bare_metal_server_network_interface',
+ operation_id='list_keys',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
}
- data = json.dumps(bare_metal_server_network_interface_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['bare_metal_server_id', 'id']
- path_param_values = self.encode_path_vars(bare_metal_server_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}'.format(**path_param_dict)
+ url = '/keys'
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_bare_metal_server_network_interface_floating_ips(
+ def create_key(
self,
- bare_metal_server_id: str,
- network_interface_id: str,
+ public_key: str,
+ *,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List floating IPs associated with a bare metal server network interface.
+ Create a key.
- This request lists floating IPs associated with a bare metal server network
- interface.
+ This request creates a new SSH key from an key prototype object. The prototype
+ object is structured in the same way as a retrieved key, and contains the
+ information necessary to create the new key. The public key value must be
+ provided.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str network_interface_id: The bare metal server network interface
- identifier.
+ :param str public_key: The public SSH key to use, in OpenSSH format
+ (consisting of three space-separated fields: the algorithm name,
+ base64-encoded key value, and a comment). The algorithm and comment fields
+ may be omitted, as only the key field is used.
+ The key field must not match another key in the region.
+ Keys of type `rsa` must be 2048 or 4096 bits in length (4096 is
+ recommended). Keys of type `ed25519` must be 256 bits in length.
+ :param str name: (optional) The name for this key. The name must not be
+ used by another key in the region. 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) will be
+ used.
+ :param str type: (optional) The crypto-system for this key.
: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 `FloatingIPUnpaginatedCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `Key` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
+ if public_key is None:
+ raise ValueError('public_key must be provided')
+ 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='list_bare_metal_server_network_interface_floating_ips',
+ operation_id='create_key',
)
headers.update(sdk_headers)
@@ -11848,58 +12347,56 @@ def list_bare_metal_server_network_interface_floating_ips(
'generation': self.generation,
}
+ data = {
+ 'public_key': public_key,
+ 'name': name,
+ 'resource_group': resource_group,
+ 'type': type,
+ }
+ 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'))
del kwargs['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}/floating_ips'.format(**path_param_dict)
+ url = '/keys'
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def remove_bare_metal_server_network_interface_floating_ip(
+ def delete_key(
self,
- bare_metal_server_id: str,
- network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Disassociate a floating IP from a bare metal server network interface.
+ Delete a key.
- This request disassociates the specified floating IP from the specified bare metal
- server network interface.
+ This request deletes a key. This operation cannot be reversed.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str network_interface_id: The bare metal server network interface
- identifier.
- :param str id: The floating IP identifier.
+ :param str id: The key identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='remove_bare_metal_server_network_interface_floating_ip',
+ operation_id='delete_key',
)
headers.update(sdk_headers)
@@ -11912,10 +12409,10 @@ def remove_bare_metal_server_network_interface_floating_ip(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- 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_keys = ['id']
+ path_param_values = self.encode_path_vars(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}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/keys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -11926,39 +12423,29 @@ def remove_bare_metal_server_network_interface_floating_ip(
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_network_interface_floating_ip(
+ def get_key(
self,
- bare_metal_server_id: str,
- network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve associated floating IP.
+ Retrieve a key.
- This request retrieves a specified floating IP if it is associated with the bare
- metal server network interface specified in the URL.
+ This request retrieves a single key specified by the identifier in the URL.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str network_interface_id: The bare metal server network interface
- identifier.
- :param str id: The floating IP identifier.
+ :param str id: The key 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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Key` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
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_floating_ip',
+ operation_id='get_key',
)
headers.update(sdk_headers)
@@ -11972,10 +12459,10 @@ def get_bare_metal_server_network_interface_floating_ip(
del kwargs['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_keys = ['id']
+ path_param_values = self.encode_path_vars(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}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/keys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -11986,45 +12473,35 @@ def get_bare_metal_server_network_interface_floating_ip(
response = self.send(request, **kwargs)
return response
- def add_bare_metal_server_network_interface_floating_ip(
+ def update_key(
self,
- bare_metal_server_id: str,
- network_interface_id: str,
id: str,
+ key_patch: 'KeyPatch',
**kwargs,
) -> DetailedResponse:
"""
- Associate a floating IP with a bare metal server network interface.
+ Update a key.
- This request associates the specified floating IP with the specified bare metal
- server network interface. If `enable_infrastructure_nat` is `false`, this adds the
- IP to any existing associations. If `enable_infrastructure_nat` is `true`, this
- replaces any existing association.
- The existing floating IP must:
- - not be required by another resource, such as a public gateway
- - be in the same `zone` as the bare metal server
- A request body is not required, and if provided, is ignored.
+ This request updates a key's name.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str network_interface_id: The bare metal server network interface
- identifier.
- :param str id: The floating IP identifier.
+ :param str id: The key identifier.
+ :param KeyPatch key_patch: The key 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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Key` object
"""
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if key_patch is None:
+ raise ValueError('key_patch must be provided')
+ if isinstance(key_patch, KeyPatch):
+ key_patch = convert_model(key_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='add_bare_metal_server_network_interface_floating_ip',
+ operation_id='update_key',
)
headers.update(sdk_headers)
@@ -12033,64 +12510,68 @@ def add_bare_metal_server_network_interface_floating_ip(
'generation': self.generation,
}
+ data = json.dumps(key_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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_keys = ['id']
+ path_param_values = self.encode_path_vars(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}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/keys/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_bare_metal_server_network_interface_ips(
+ #########################
+ # Load balancers
+ #########################
+
+ def list_load_balancer_profiles(
self,
- bare_metal_server_id: str,
- network_interface_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List the primary reserved IP for a bare metal server network interface.
+ List load balancer profiles.
- This request lists the primary reserved IP for a bare metal server network
- interface.
+ This request lists load balancer profiles available in the region. A load balancer
+ profile specifies the performance characteristics and pricing model for a load
+ balancer.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str network_interface_id: The bare metal server network interface
- 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 `ReservedIPCollectionBareMetalServerNetworkInterfaceContext` object
-
- Deprecated: this method is deprecated and may be removed in a future release.
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerProfileCollection` object
"""
- logging.warning('A deprecated operation has been invoked: list_bare_metal_server_network_interface_ips')
-
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not network_interface_id:
- 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',
+ 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:
@@ -12098,10 +12579,7 @@ def list_bare_metal_server_network_interface_ips(
del kwargs['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)
+ url = '/load_balancer/profiles'
request = self.prepare_request(
method='GET',
url=url,
@@ -12112,43 +12590,29 @@ def list_bare_metal_server_network_interface_ips(
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_network_interface_ip(
+ def get_load_balancer_profile(
self,
- bare_metal_server_id: str,
- network_interface_id: str,
- id: str,
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve the primary reserved IP.
+ Retrieve a load balancer profile.
- This request retrieves the primary reserved IP for a bare metal server network
- interface.
+ This request retrieves a load balancer profile specified by the name in the URL.
- :param str bare_metal_server_id: The bare metal server identifier.
- :param str network_interface_id: The bare metal server network interface
- identifier.
- :param str id: The reserved IP identifier.
+ :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 `ReservedIP` object
-
- Deprecated: this method is deprecated and may be removed in a future release.
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerProfile` object
"""
- logging.warning('A deprecated operation has been invoked: get_bare_metal_server_network_interface_ip')
-
- if not bare_metal_server_id:
- raise ValueError('bare_metal_server_id must be provided')
- if not network_interface_id:
- raise ValueError('network_interface_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not name:
+ raise ValueError('name 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',
+ operation_id='get_load_balancer_profile',
)
headers.update(sdk_headers)
@@ -12162,10 +12626,10 @@ def get_bare_metal_server_network_interface_ip(
del kwargs['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_keys = ['name']
+ path_param_values = self.encode_path_vars(name)
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)
+ url = '/load_balancer/profiles/{name}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -12176,49 +12640,49 @@ def get_bare_metal_server_network_interface_ip(
response = self.send(request, **kwargs)
return response
- def delete_bare_metal_server(
+ def list_load_balancers(
self,
- id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a bare metal server.
+ List load balancers.
- This request deletes a bare metal server. This operation cannot be reversed. Any
- floating IPs associated with the bare metal server network interfaces are
- implicitly disassociated.
+ This request lists load balancers in the region.
- :param str id: The bare metal 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 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 not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_bare_metal_server',
+ operation_id='list_load_balancers',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/bare_metal_servers/{id}'.format(**path_param_dict)
+ url = '/load_balancers'
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -12227,30 +12691,112 @@ def delete_bare_metal_server(
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server(
+ def create_load_balancer(
self,
- id: str,
+ is_public: bool,
+ subnets: List['SubnetIdentity'],
+ *,
+ dns: Optional['LoadBalancerDNSPrototype'] = None,
+ is_private_path: Optional[bool] = None,
+ listeners: Optional[List['LoadBalancerListenerPrototypeLoadBalancerContext']] = None,
+ logging: Optional['LoadBalancerLoggingPrototype'] = None,
+ name: Optional[str] = None,
+ pools: Optional[List['LoadBalancerPoolPrototypeLoadBalancerContext']] = None,
+ profile: Optional['LoadBalancerProfileIdentity'] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ route_mode: Optional[bool] = None,
+ security_groups: Optional[List['SecurityGroupIdentity']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a bare metal server.
+ Create a load balancer.
- This request retrieves a single bare metal server specified by the identifier in
- the URL.
+ This request creates and provisions a new load balancer.
- :param str id: The bare metal server identifier.
+ :param bool is_public: Indicates whether this load balancer is public.
+ At present,
+ - If `route_mode` is set to `true`, the load balancer must be private.
+ - If `is_private_path` is specified, it must be set to `false`.
+ :param List[SubnetIdentity] subnets: The subnets to provision this load
+ balancer in. The subnets must be in the same VPC.
+ - If 'availability' is specified as `subnet` in the profile, the load
+ balancer's availability will depend on the availability of the zones that
+ the subnets reside in.
+ - If 'availability' is specified as `region` in the profile, the load
+ balancer remains available as long as any zone in the region is available.
+ Only members in healthy zones will be sent new connections.
+ Load balancers in the `network` family allow only one subnet to be
+ specified.
+ :param LoadBalancerDNSPrototype dns: (optional) The DNS configuration for
+ this load balancer.
+ If unspecified, DNS `A` records for this load balancer's `hostname`
+ property will be added
+ to the public DNS zone `lb.appdomain.cloud`. Otherwise, those DNS `A`
+ records will be
+ added to the specified `zone`.
+ Not supported by private path load balancers.
+ :param bool is_private_path: (optional) Indicates whether this is a private
+ path load balancer.
+ :param List[LoadBalancerListenerPrototypeLoadBalancerContext] listeners:
+ (optional) The listeners of this load balancer.
+ :param LoadBalancerLoggingPrototype 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. If unspecified, `datapath.active` will
+ be `false`.
+ To activate logging, the load balancer profile must support the specified
+ logging type.
+ :param str name: (optional) The name for this load balancer. The name must
+ not be used by another load balancer in the VPC. If unspecified, the name
+ will be a hyphenated list of randomly-selected words.
+ :param List[LoadBalancerPoolPrototypeLoadBalancerContext] 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) will be
+ used.
+ :param bool route_mode: (optional) Indicates whether [route
+ mode](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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 `BareMetalServer` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object
"""
- if not id:
- 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 dns is not None:
+ dns = convert_model(dns)
+ 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_bare_metal_server',
+ operation_id='create_load_balancer',
)
headers.update(sdk_headers)
@@ -12259,57 +12805,72 @@ def get_bare_metal_server(
'generation': self.generation,
}
+ data = {
+ 'is_public': is_public,
+ 'subnets': subnets,
+ 'dns': dns,
+ 'is_private_path': is_private_path,
+ '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'))
del kwargs['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 = '/bare_metal_servers/{id}'.format(**path_param_dict)
+ url = '/load_balancers'
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_bare_metal_server(
+ def delete_load_balancer(
self,
id: str,
- bare_metal_server_patch: 'BareMetalServerPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a bare metal server.
+ Delete a load balancer.
- This request updates a bare metal server with the information in a provided patch.
- The bare metal server patch object is structured in the same way as a retrieved
- bare metal server and contains only the information to be updated.
+ This request deletes a load balancer. This operation cannot be reversed. A load
+ balancer cannot be deleted if its `provisioning_status` is `delete_pending` or it
+ is referenced by a resource.
- :param str id: The bare metal server identifier.
- :param BareMetalServerPatch bare_metal_server_patch: The bare metal server
- patch.
+ :param str id: The load balancer 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 `BareMetalServer` object
+ :rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
- if bare_metal_server_patch is None:
- raise ValueError('bare_metal_server_patch must be provided')
- if isinstance(bare_metal_server_patch, BareMetalServerPatch):
- bare_metal_server_patch = convert_model(bare_metal_server_patch)
- headers = {}
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_bare_metal_server',
+ operation_id='delete_load_balancer',
)
headers.update(sdk_headers)
@@ -12318,48 +12879,39 @@ def update_bare_metal_server(
'generation': self.generation,
}
- data = json.dumps(bare_metal_server_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/bare_metal_servers/{id}'.format(**path_param_dict)
+ url = '/load_balancers/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def update_firmware_for_bare_metal_server(
+ def get_load_balancer(
self,
id: str,
- *,
- auto_start: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update firmware for a bare metal server.
+ Retrieve a load balancer.
- This request updates a bare metal server to the latest available firmware. The
- server must be stopped.
+ This request retrieves a single load balancer specified by the identifier in the
+ URL path.
- :param str id: The bare metal server identifier.
- :param bool auto_start: (optional) Indicates whether to automatically start
- the bare metal server after the firmware update is successfully completed.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object
"""
if not id:
@@ -12368,7 +12920,7 @@ def update_firmware_for_bare_metal_server(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_firmware_for_bare_metal_server',
+ operation_id='get_load_balancer',
)
headers.update(sdk_headers)
@@ -12377,57 +12929,64 @@ def update_firmware_for_bare_metal_server(
'generation': self.generation,
}
- data = {
- 'auto_start': auto_start,
- }
- 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'))
del kwargs['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 = '/bare_metal_servers/{id}/firmware/update'.format(**path_param_dict)
+ url = '/load_balancers/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def get_bare_metal_server_initialization(
+ def update_load_balancer(
self,
id: str,
+ load_balancer_patch: 'LoadBalancerPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve initialization configuration for a bare metal server.
+ Update a load balancer.
- This request retrieves configuration used to initialize the bare metal server,
- such as the image used, SSH keys, and any configured usernames and passwords.
- These can subsequently be changed on the server and therefore may not be current.
+ This request updates a load balancer with the information in a provided load
+ balancer patch. The load balancer patch object is structured in the same way as a
+ retrieved load balancer and contains only the information to be updated. A load
+ balancer can only be updated if its `provisioning_status` is `active`.
- :param str id: The bare metal server identifier.
+ :param str id: The load balancer identifier.
+ :param LoadBalancerPatch load_balancer_patch: The load balancer 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 `BareMetalServerInitialization` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object
"""
if not id:
raise ValueError('id must be provided')
- headers = {}
+ 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-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_bare_metal_server_initialization',
+ operation_id='update_load_balancer',
)
headers.update(sdk_headers)
@@ -12436,6 +12995,9 @@ def get_bare_metal_server_initialization(
'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'))
del kwargs['headers']
@@ -12444,65 +13006,41 @@ def get_bare_metal_server_initialization(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{id}/initialization'.format(**path_param_dict)
+ url = '/load_balancers/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def replace_bare_metal_server_initialization(
+ def get_load_balancer_statistics(
self,
id: str,
- image: 'ImageIdentity',
- keys: List['KeyIdentity'],
- *,
- user_data: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Reinitialize a bare metal server.
+ List statistics of a load balancer.
- This request reinitializes a bare metal server with the specified image and SSH
- keys. The server must be stopped. Upon successful reinitiatilization, the bare
- metal server will be started automatically.
+ This request lists statistics of a load balancer.
- :param str id: The bare metal server identifier.
- :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 [default
- user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
- For Windows images, at least one key must be specified, and one will be
- selected to encrypt the administrator password. Keys are optional for other
- images, but if no keys are specified, the bare metal server will be
- inaccessible unless the specified image provides another means of access.
- :param str user_data: (optional) The user data to be made available when
- initializing the bare metal server.
+ :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 `BareMetalServerInitialization` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerStatistics` object
"""
if not id:
raise ValueError('id must be provided')
- if image is None:
- raise ValueError('image must be provided')
- if keys is None:
- raise ValueError('keys must be provided')
- image = convert_model(image)
- keys = [convert_model(x) for x in keys]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='replace_bare_metal_server_initialization',
+ operation_id='get_load_balancer_statistics',
)
headers.update(sdk_headers)
@@ -12511,15 +13049,6 @@ def replace_bare_metal_server_initialization(
'generation': self.generation,
}
- data = {
- 'image': image,
- 'keys': keys,
- 'user_data': user_data,
- }
- 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'))
del kwargs['headers']
@@ -12528,42 +13057,40 @@ def replace_bare_metal_server_initialization(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/bare_metal_servers/{id}/initialization'.format(**path_param_dict)
+ url = '/load_balancers/{id}/statistics'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def restart_bare_metal_server(
+ def list_load_balancer_listeners(
self,
- id: str,
+ load_balancer_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Restart a bare metal server.
+ List listeners for a load balancer.
- This request immediately restarts a bare metal server. For this request to
- succeed, the server must have a `status` of `running`.
+ This request lists listeners for a load balancer.
- :param str id: The bare metal server 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 `LoadBalancerListenerCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not load_balancer_id:
+ 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='restart_bare_metal_server',
+ operation_id='list_load_balancer_listeners',
)
headers.update(sdk_headers)
@@ -12575,13 +13102,14 @@ def restart_bare_metal_server(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/bare_metal_servers/{id}/restart'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -12590,30 +13118,139 @@ def restart_bare_metal_server(
response = self.send(request, **kwargs)
return response
- def start_bare_metal_server(
+ def create_load_balancer_listener(
self,
- id: str,
+ load_balancer_id: str,
+ protocol: str,
+ *,
+ accept_proxy_protocol: Optional[bool] = None,
+ certificate_instance: Optional['CertificateInstanceIdentity'] = None,
+ connection_limit: Optional[int] = None,
+ default_pool: Optional['LoadBalancerPoolIdentity'] = None,
+ https_redirect: Optional['LoadBalancerListenerHTTPSRedirectPrototype'] = None,
+ idle_connection_timeout: Optional[int] = None,
+ policies: Optional[List['LoadBalancerListenerPolicyPrototype']] = None,
+ port: Optional[int] = None,
+ port_max: Optional[int] = None,
+ port_min: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Start a bare metal server.
+ Create a listener for a load balancer.
- This request starts a bare metal server. It will run immediately provided the
- server is stopped.
+ This request creates a new listener for a load balancer.
- :param str id: The bare metal server identifier.
+ :param str load_balancer_id: The load balancer identifier.
+ :param str protocol: The listener protocol. Each listener in the load
+ balancer must have a non-overlapping port range and `protocol` combination.
+ 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`.
+ Additional restrictions:
+ - If `default_pool` is set, the pool's protocol must match, or be
+ compatible with
+ the listener's protocol. At present, the compatible protocols are `http`
+ and
+ `https`.
+ - 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 to use for SSL termination. The listener must have a
+ `protocol` of `https`.
+ :param int connection_limit: (optional) The concurrent connection limit for
+ the listener. If reached, incoming connections may be queued or rejected.
+ Supported for load balancers in the `application` family.
+ If unspecified, the limit will be `15000` for load balancers in the
+ `application` family.
+ :param LoadBalancerPoolIdentity default_pool: (optional) The default pool
+ for this listener. If `https_redirect` is specified, the
+ default pool will not be used.
+ If specified, the 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.
+ If unspecified, this listener will be created with no default pool, but one
+ may be
+ subsequently set.
+ :param LoadBalancerListenerHTTPSRedirectPrototype https_redirect:
+ (optional) The target listener that requests will be redirected to if none
+ of the listener's
+ `policies` match.
+ If specified, this listener must have a `protocol` of `http`, and the
+ target
+ listener must have a `protocol` of `https`.
+ :param int idle_connection_timeout: (optional) The idle connection timeout
+ of the listener in seconds.
+ Supported for load balancers in the `application` family.
+ If unspecified, the timeout will be `50` for load balancers in the
+ `application` family.
+ :param List[LoadBalancerListenerPolicyPrototype] policies: (optional) The
+ policy prototype objects for this listener. The load balancer must be in
+ the
+ `application` family.
+ :param int port: (optional) The listener port number. Each listener in the
+ load balancer must have a non-overlapping port range and `protocol`
+ combination. Protocol values of `tcp`, `http` and `https` share the TCP
+ port space.
+ If `port_min` is also specified, `port` must have the same value as
+ `port_min`.
+ :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`.
+ Only network load balancers with `route_mode`, `is_public` or
+ `is_private_path` set to
+ `true` support different values for `port_min` and `port_max`. If
+ `route_mode` is set to `true`, the value must be `65535`.
+ The specified port range must not overlap with port ranges used by other
+ listeners for this load balancer using the same protocol. Protocol values
+ of `tcp`, `http` and
+ `https` share the TCP port space.
+ :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`.
+ If specified, `port_max` must also be specified, and must not be smaller.
+ If unspecified, `port_max` must also be unspecified.
+ If `port` is also specified, `port_min` must have the same value as `port`.
+ Only network load balancers with `route_mode`, `is_public` or
+ `is_private_path` set to
+ `true` support different values for `port_min` and `port_max`. If
+ `route_mode` is set to `true`, the value must be `1`.
+ The specified port range must not overlap with port ranges used by other
+ listeners for this load balancer using the same protocol. Protocol values
+ of `tcp`, `http` and
+ `https` share the TCP port space.
: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 `LoadBalancerListener` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not load_balancer_id:
+ 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]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='start_bare_metal_server',
+ operation_id='create_load_balancer_listener',
)
headers.update(sdk_headers)
@@ -12622,55 +13259,72 @@ def start_bare_metal_server(
'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,
+ 'idle_connection_timeout': idle_connection_timeout,
+ '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'))
del kwargs['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 = '/bare_metal_servers/{id}/start'.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,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def stop_bare_metal_server(
+ def delete_load_balancer_listener(
self,
+ load_balancer_id: str,
id: str,
- type: str,
**kwargs,
) -> DetailedResponse:
"""
- Stop a bare metal server.
+ Delete a load balancer listener.
- This request stops a bare metal server. It will run immediately provided the
- server is running. Note: A soft stop may not complete as it relies on the
- operating system to perform the operation.
+ 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 id: The bare metal server identifier.
- :param str type: The type of stop operation:
- - `soft`: signal running operating system to quiesce and shutdown cleanly
- - `hard`: immediately stop the server.
+ :param str load_balancer_id: The load balancer 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
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
if not id:
raise ValueError('id must be provided')
- if type is None:
- raise ValueError('type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='stop_bare_metal_server',
+ operation_id='delete_load_balancer_listener',
)
headers.update(sdk_headers)
@@ -12679,72 +13333,58 @@ def stop_bare_metal_server(
'generation': self.generation,
}
- data = {
- 'type': type,
- }
- 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'))
del kwargs['headers']
- 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 = '/bare_metal_servers/{id}/stop'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Volumes
- #########################
-
- def list_volume_profiles(
+ def get_load_balancer_listener(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ load_balancer_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List volume profiles.
+ Retrieve a load balancer listener.
- This request lists [volume
- profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles)
- available in the region. A volume profile specifies the performance
- characteristics and pricing model for a volume.
+ This request retrieves a single listener specified by the identifier in the URL
+ path.
- :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 load_balancer_id: The load balancer 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 `VolumeProfileCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_volume_profiles',
+ operation_id='get_load_balancer_listener',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -12752,7 +13392,10 @@ def list_volume_profiles(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/volume/profiles'
+ 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='GET',
url=url,
@@ -12763,29 +13406,40 @@ def list_volume_profiles(
response = self.send(request, **kwargs)
return response
- def get_volume_profile(
+ def update_load_balancer_listener(
self,
- name: str,
+ load_balancer_id: str,
+ id: str,
+ load_balancer_listener_patch: 'LoadBalancerListenerPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a volume profile.
+ Update a load balancer listener.
- This request retrieves a single volume profile specified by the name in the URL.
+ This request updates a load balancer listener from a listener patch.
- :param str name: The volume profile name.
+ :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 `VolumeProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not id:
+ 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='get_volume_profile',
+ operation_id='update_load_balancer_listener',
)
headers.update(sdk_headers)
@@ -12794,95 +13448,64 @@ def get_volume_profile(
'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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ 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 = '/volume/profiles/{name}'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_volumes(
+ def list_load_balancer_listener_policies(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- attachment_state: Optional[str] = None,
- encryption: Optional[str] = None,
- name: Optional[str] = None,
- operating_system_family: Optional[str] = None,
- operating_system_architecture: Optional[str] = None,
- tag: Optional[str] = None,
- zone_name: Optional[str] = None,
+ load_balancer_id: str,
+ listener_id: str,
**kwargs,
) -> DetailedResponse:
"""
- List volumes.
+ List policies for a load balancer listener.
- This request lists volumes in the region. Volumes are network-connected block
- storage devices that may be attached to one or more instances in the same region.
+ This request lists policies for a load balancer listener. A policy consists of
+ rules to match against each incoming request, and an action to apply to the
+ request if a rule matches.
- :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 attachment_state: (optional) Filters the collection to volumes
- with an `attachment_state` property matching the specified value.
- :param str encryption: (optional) Filters the collection to resources with
- an `encryption` property matching the specified value.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str operating_system_family: (optional) Filters the collection to
- resources with an `operating_system.family` property matching the specified
- operating system family.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no operating system or any operating
- system, respectively.
- :param str operating_system_architecture: (optional) Filters the collection
- to resources with an `operating_system.architecture` property matching the
- specified operating system architecture.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no operating system or any operating
- system, respectively.
- :param str tag: (optional) Filters the collection to resources with an item
- in the `tags` property matching the exact specified tag.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
+ :param str load_balancer_id: The load balancer 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 `VolumeCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyCollection` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ 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_volumes',
+ operation_id='list_load_balancer_listener_policies',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'attachment_state': attachment_state,
- 'encryption': encryption,
- 'name': name,
- 'operating_system.family': operating_system_family,
- 'operating_system.architecture': operating_system_architecture,
- 'tag': tag,
- 'zone.name': zone_name,
}
if 'headers' in kwargs:
@@ -12890,7 +13513,10 @@ def list_volumes(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/volumes'
+ 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}/listeners/{listener_id}/policies'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -12901,33 +13527,84 @@ def list_volumes(
response = self.send(request, **kwargs)
return response
- def create_volume(
+ def create_load_balancer_listener_policy(
self,
- volume_prototype: 'VolumePrototype',
+ load_balancer_id: str,
+ listener_id: str,
+ action: str,
+ priority: int,
+ *,
+ name: Optional[str] = None,
+ rules: Optional[List['LoadBalancerListenerPolicyRulePrototype']] = None,
+ target: Optional['LoadBalancerListenerPolicyTargetPrototype'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a volume.
-
- This request creates a new volume from a volume prototype object. The prototype
- object is structured in the same way as a retrieved volume, and contains the
- information necessary to create the new volume.
+ Create a policy for a load balancer listener.
- :param VolumePrototype volume_prototype: The volume prototype object.
- :param dict headers: A `dict` containing the request headers
+ This request creates a new policy from a load balancer listener policy object. The
+ prototype object is structured in the same way as a retrieved policy, and contains
+ the information necessary to create the new policy. For this request to succeed,
+ the load balancer must be in the `application` family.
+
+ :param str load_balancer_id: The load balancer identifier.
+ :param str listener_id: The listener identifier.
+ :param str action: The policy action:
+ - `forward_to_listener`: Requests will be forwarded to the specified
+ `target` listener.
+ - `forward_to_pool`: Requests will be forwarded to the specified `target`
+ pool.
+ - `https_redirect`: Requests will be redirected to the specified
+ `target.listener`.
+ This listener must have a `protocol` of `http`, and the target listener
+ must
+ have a `protocol` of `https`.
+ - `redirect`: Requests will be redirected to the specified `target.url`
+ - `reject`: Requests will be rejected with a `403` status code.
+ :param int priority: The priority of the policy. The priority is unique
+ across all policies for this load balancer listener. Lower value indicates
+ higher priority.
+ :param str name: (optional) The name for this policy. The name must not be
+ used by another policy for the load balancer listener. If unspecified, the
+ name will be a hyphenated list of randomly-selected words.
+ :param List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The
+ rule prototype objects for this policy.
+ :param LoadBalancerListenerPolicyTargetPrototype target: (optional) - If
+ `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity`
+ in this
+ load balancer to forward to.
+ - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to
+ specify a pool in
+ this load balancer to forward to.
+ - If `action` is `https_redirect`, use
+ `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener
+ on this
+ load balancer to redirect to.
+ - If `action` is `redirect`, use
+ `LoadBalancerListenerPolicyRedirectURLPrototype`to
+ specify a URL to redirect to.
+ :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 `Volume` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object
"""
- if volume_prototype is None:
- raise ValueError('volume_prototype must be provided')
- if isinstance(volume_prototype, VolumePrototype):
- volume_prototype = convert_model(volume_prototype)
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ 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_volume',
+ operation_id='create_load_balancer_listener_policy',
)
headers.update(sdk_headers)
@@ -12936,7 +13613,15 @@ def create_volume(
'generation': self.generation,
}
- data = json.dumps(volume_prototype)
+ data = {
+ '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)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -12944,7 +13629,10 @@ def create_volume(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/volumes'
+ 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}/listeners/{listener_id}/policies'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -12956,36 +13644,37 @@ def create_volume(
response = self.send(request, **kwargs)
return response
- def delete_volume(
+ def delete_load_balancer_listener_policy(
self,
+ load_balancer_id: str,
+ listener_id: str,
id: str,
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a volume.
+ Delete a load balancer listener policy.
- This request deletes a volume. This operation cannot be reversed. For this request
- to succeed, the volume must not be attached to any instances.
+ Deletes a policy of the load balancer listener. This operation cannot be reversed.
- :param str id: The volume 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 str load_balancer_id: The load balancer 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
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
if not id:
raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_volume',
+ operation_id='delete_load_balancer_listener_policy',
)
headers.update(sdk_headers)
@@ -12998,10 +13687,10 @@ def delete_volume(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/volumes/{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,
@@ -13012,29 +13701,37 @@ def delete_volume(
response = self.send(request, **kwargs)
return response
- def get_volume(
+ def get_load_balancer_listener_policy(
self,
+ load_balancer_id: str,
+ listener_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a volume.
+ Retrieve a load balancer listener policy.
- This request retrieves a single volume specified by the identifier in the URL.
+ Retrieve a single policy specified by the identifier in the URL path.
- :param str id: The volume identifier.
+ :param str load_balancer_id: The load balancer 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 `Volume` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_volume',
+ operation_id='get_load_balancer_listener_policy',
)
headers.update(sdk_headers)
@@ -13048,10 +13745,10 @@ def get_volume(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/volumes/{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,
@@ -13062,44 +13759,46 @@ def get_volume(
response = self.send(request, **kwargs)
return response
- def update_volume(
+ def update_load_balancer_listener_policy(
self,
+ load_balancer_id: str,
+ listener_id: str,
id: str,
- volume_patch: 'VolumePatch',
- *,
- if_match: Optional[str] = None,
+ load_balancer_listener_policy_patch: 'LoadBalancerListenerPolicyPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a volume.
+ Update a load balancer listener policy.
- This request updates a volume with the information in a provided volume patch. The
- volume patch object is structured in the same way as a retrieved volume and
- contains only the information to be updated.
+ This request updates a load balancer listener policy with the information in a
+ provided policy patch. The policy patch object is structured in the same way as a
+ retrieved policy and contains only the information to be updated.
- :param str id: The volume identifier.
- :param VolumePatch volume_patch: The volume 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 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 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 `Volume` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
if not id:
raise ValueError('id must be provided')
- if volume_patch is None:
- raise ValueError('volume_patch must be provided')
- if isinstance(volume_patch, VolumePatch):
- volume_patch = convert_model(volume_patch)
- headers = {
- 'If-Match': if_match,
- }
+ 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_volume',
+ operation_id='update_load_balancer_listener_policy',
)
headers.update(sdk_headers)
@@ -13108,7 +13807,7 @@ def update_volume(
'generation': self.generation,
}
- data = json.dumps(volume_patch)
+ data = json.dumps(load_balancer_listener_policy_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -13116,10 +13815,10 @@ def update_volume(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/volumes/{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,
@@ -13131,65 +13830,43 @@ def update_volume(
response = self.send(request, **kwargs)
return response
- #########################
- # Snapshots
- #########################
-
- def list_snapshot_consistency_groups(
+ def list_load_balancer_listener_policy_rules(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- sort: Optional[str] = None,
- backup_policy_plan_id: Optional[str] = None,
+ load_balancer_id: str,
+ listener_id: str,
+ policy_id: str,
**kwargs,
) -> DetailedResponse:
"""
- List snapshot consistency groups.
+ List rules of a load balancer listener policy.
- This request lists snapshot consistency groups in the region. A snapshot
- consistency group is a collection of individual snapshots taken at the same time.
+ This request lists rules of a load balancer listener policy.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :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 str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching 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 `SnapshotConsistencyGroupCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRuleCollection` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
+ if not policy_id:
+ 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_snapshot_consistency_groups',
+ operation_id='list_load_balancer_listener_policy_rules',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
- 'name': name,
- 'sort': sort,
- 'backup_policy_plan.id': backup_policy_plan_id,
}
if 'headers' in kwargs:
@@ -13197,7 +13874,10 @@ def list_snapshot_consistency_groups(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/snapshot_consistency_groups'
+ 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,
@@ -13208,36 +13888,71 @@ def list_snapshot_consistency_groups(
response = self.send(request, **kwargs)
return response
- def create_snapshot_consistency_group(
+ def create_load_balancer_listener_policy_rule(
self,
- snapshot_consistency_group_prototype: 'SnapshotConsistencyGroupPrototype',
+ load_balancer_id: str,
+ listener_id: str,
+ policy_id: str,
+ condition: str,
+ type: str,
+ value: str,
+ *,
+ field: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a snapshot consistency group.
+ Create a rule for a load balancer listener policy.
- This request creates a new snapshot consistency group from a snapshot consistency
- group object. The prototype object is structured in the same way as a retrieved
- consistency group, and contains the information necessary to provision the new
- snapshot consistency group.
+ Creates a new rule for the load balancer listener policy.
- :param SnapshotConsistencyGroupPrototype
- snapshot_consistency_group_prototype: The snapshot consistency group
- prototype object.
+ :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 for the rule.
+ :param str type: The content the rule applies to:
+ - `body`: The UTF-8 form-encoded HTTP request body
+ - `header`: The HTTP header
+ - `hostname`: The fully-qualified domain name of the server specified in
+ the Host
+ HTTP request header
+ - `path`: The path of the HTTP request
+ - `query`: The query of the HTTP request URL
+ - `sni_hostname`: The fully-qualified domain name of the server provided in
+ the
+ "server name indicator" extension during TLS negotiation
+ - For listeners with `protocol` `http` or `https`, any type may be
+ specified.
+ - For listeners with `protocol` `tcp`, only type `sni_hostname` may be
+ specified.
+ :param str value: The value to be matched for the 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 to match for this rule.
+ - If the `type` is `header`, this property must be specified.
+ - If the `type` is `body` or `query`, this property may be specified.
+ - For all other types, this property must not be specified.
: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 `SnapshotConsistencyGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object
"""
- if snapshot_consistency_group_prototype is None:
- raise ValueError('snapshot_consistency_group_prototype must be provided')
- if isinstance(snapshot_consistency_group_prototype, SnapshotConsistencyGroupPrototype):
- snapshot_consistency_group_prototype = convert_model(snapshot_consistency_group_prototype)
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
+ if not policy_id:
+ 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_snapshot_consistency_group',
+ operation_id='create_load_balancer_listener_policy_rule',
)
headers.update(sdk_headers)
@@ -13246,7 +13961,14 @@ def create_snapshot_consistency_group(
'generation': self.generation,
}
- data = json.dumps(snapshot_consistency_group_prototype)
+ 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:
@@ -13254,7 +13976,10 @@ def create_snapshot_consistency_group(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/snapshot_consistency_groups'
+ 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,
@@ -13266,31 +13991,42 @@ def create_snapshot_consistency_group(
response = self.send(request, **kwargs)
return response
- def delete_snapshot_consistency_group(
+ def delete_load_balancer_listener_policy_rule(
self,
+ load_balancer_id: str,
+ listener_id: str,
+ policy_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a snapshot consistency group.
+ Delete a load balancer listener policy rule.
- This request deletes snapshot consistency group. This operation cannot be
- reversed. If the `delete_snapshots_on_delete` property is `true`, all snapshots in
- the consistency group will also be deleted.
+ Deletes a rule from the load balancer listener policy. This operation cannot be
+ reversed.
- :param str id: The snapshot consistency group 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 `SnapshotConsistencyGroup` object
+ :rtype: DetailedResponse
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
+ if not policy_id:
+ raise ValueError('policy_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_snapshot_consistency_group',
+ operation_id='delete_load_balancer_listener_policy_rule',
)
headers.update(sdk_headers)
@@ -13302,12 +14038,11 @@ def delete_snapshot_consistency_group(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/snapshot_consistency_groups/{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,
@@ -13318,30 +14053,41 @@ def delete_snapshot_consistency_group(
response = self.send(request, **kwargs)
return response
- def get_snapshot_consistency_group(
+ def get_load_balancer_listener_policy_rule(
self,
+ load_balancer_id: str,
+ listener_id: str,
+ policy_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a snapshot consistency group.
+ Retrieve a load balancer listener policy rule.
- This request retrieves a single snapshot consistency group specified by the
- identifier in the URL.
+ Retrieves a single rule specified by the identifier in the URL path.
- :param str id: The snapshot consistency group 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 `SnapshotConsistencyGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
+ if not policy_id:
+ raise ValueError('policy_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_snapshot_consistency_group',
+ operation_id='get_load_balancer_listener_policy_rule',
)
headers.update(sdk_headers)
@@ -13355,10 +14101,10 @@ def get_snapshot_consistency_group(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/snapshot_consistency_groups/{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,
@@ -13369,46 +14115,48 @@ def get_snapshot_consistency_group(
response = self.send(request, **kwargs)
return response
- def update_snapshot_consistency_group(
+ def update_load_balancer_listener_policy_rule(
self,
+ load_balancer_id: str,
+ listener_id: str,
+ policy_id: str,
id: str,
- snapshot_consistency_group_patch: 'SnapshotConsistencyGroupPatch',
- *,
- if_match: Optional[str] = None,
+ load_balancer_listener_policy_rule_patch: 'LoadBalancerListenerPolicyRulePatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a snapshot consistency group.
+ Update a load balancer listener policy rule.
- This request updates a snapshot consistency group with the information in a
- provided snapshot consistency group patch. The snapshot consistency group patch
- object is structured in the same way as a retrieved snapshot consistency group and
- contains only the information to be updated.
+ Updates a rule of the load balancer listener policy.
- :param str id: The snapshot consistency group identifier.
- :param SnapshotConsistencyGroupPatch snapshot_consistency_group_patch: The
- snapshot consistency group 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 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 `SnapshotConsistencyGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not listener_id:
+ raise ValueError('listener_id must be provided')
+ if not policy_id:
+ raise ValueError('policy_id must be provided')
if not id:
raise ValueError('id must be provided')
- if snapshot_consistency_group_patch is None:
- raise ValueError('snapshot_consistency_group_patch must be provided')
- if isinstance(snapshot_consistency_group_patch, SnapshotConsistencyGroupPatch):
- snapshot_consistency_group_patch = convert_model(snapshot_consistency_group_patch)
- headers = {
- 'If-Match': if_match,
- }
+ 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_snapshot_consistency_group',
+ operation_id='update_load_balancer_listener_policy_rule',
)
headers.update(sdk_headers)
@@ -13417,7 +14165,7 @@ def update_snapshot_consistency_group(
'generation': self.generation,
}
- data = json.dumps(snapshot_consistency_group_patch)
+ data = json.dumps(load_balancer_listener_policy_rule_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -13425,10 +14173,10 @@ def update_snapshot_consistency_group(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(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 = '/snapshot_consistency_groups/{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='PATCH',
url=url,
@@ -13440,47 +14188,48 @@ def update_snapshot_consistency_group(
response = self.send(request, **kwargs)
return response
- def delete_snapshots(
+ def list_load_balancer_pools(
self,
- source_volume_id: str,
+ load_balancer_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a filtered collection of snapshots.
+ List pools of a load balancer.
- This request deletes snapshots that match the specified filter. This operation
- cannot be reversed.
+ This request lists pools of a load balancer.
- :param str source_volume_id: Filters the collection to resources with a
- `source_volume.id` property matching the specified 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 not source_volume_id:
- raise ValueError('source_volume_id must be provided')
+ if not load_balancer_id:
+ 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_snapshots',
+ operation_id='list_load_balancer_pools',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'source_volume.id': source_volume_id,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- url = '/snapshots'
+ 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='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -13489,187 +14238,171 @@ def delete_snapshots(
response = self.send(request, **kwargs)
return response
- def list_snapshots(
+ def create_load_balancer_pool(
self,
+ load_balancer_id: str,
+ algorithm: str,
+ health_monitor: 'LoadBalancerPoolHealthMonitorPrototype',
+ protocol: str,
*,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- tag: Optional[str] = None,
- resource_group_id: Optional[str] = None,
+ failsafe_policy: Optional['LoadBalancerPoolFailsafePolicyPrototype'] = None,
+ members: Optional[List['LoadBalancerPoolMemberPrototype']] = None,
name: Optional[str] = None,
- source_volume_id: Optional[str] = None,
- source_volume_crn: Optional[str] = None,
- source_image_id: Optional[str] = None,
- source_image_crn: Optional[str] = None,
- sort: Optional[str] = None,
- backup_policy_plan_id: Optional[str] = None,
- copies_id: Optional[str] = None,
- copies_name: Optional[str] = None,
- copies_crn: Optional[str] = None,
- copies_remote_region_name: Optional[str] = None,
- source_snapshot_id: Optional[str] = None,
- source_snapshot_remote_region_name: Optional[str] = None,
- source_volume_remote_region_name: Optional[str] = None,
- source_image_remote_region_name: Optional[str] = None,
- clones_zone_name: Optional[str] = None,
- snapshot_consistency_group_id: Optional[str] = None,
- snapshot_consistency_group_crn: Optional[str] = None,
+ proxy_protocol: Optional[str] = None,
+ session_persistence: Optional['LoadBalancerPoolSessionPersistencePrototype'] = None,
**kwargs,
) -> DetailedResponse:
"""
- List snapshots.
+ Create a load balancer pool.
- This request lists snapshots in the region. A snapshot preserves the data of a
- volume at the time the snapshot is created.
+ This request creates a new pool from a pool prototype object.
- :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 tag: (optional) Filters the collection to resources with an item
- in the `tags` property matching the exact specified tag.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str source_volume_id: (optional) Filters the collection to resources
- with a `source_volume.id` property matching the specified identifier.
- :param str source_volume_crn: (optional) Filters the collection to
- resources with a `source_volume.crn` property matching the specified CRN.
- :param str source_image_id: (optional) Filters the collection to resources
- with a `source_image.id` property matching the specified identifier.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no source image or any existent
- source image, respectively.
- :param str source_image_crn: (optional) Filters the collection to resources
- with a `source_image.crn` property matching the specified CRN.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no source image or any existent
- source image, respectively.
- :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 str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
- :param str copies_id: (optional) Filters the collection to snapshots with
- an item in the `copies` property with an `id` property matching the
- specified identifier.
- :param str copies_name: (optional) Filters the collection to snapshots with
- an item in the `copies` property with a `name` property matching the exact
- specified name.
- :param str copies_crn: (optional) Filters the collection to snapshots with
- an item in the `copies` property with a `crn` property matching the
- specified CRN.
- :param str copies_remote_region_name: (optional) Filters the collection to
- snapshots with an item in the `copies` property with a
- `remote.region.name` property matching the exact specified name.
- :param str source_snapshot_id: (optional) Filters the collection to
- resources with a `source_snapshot.id` property matching the specified
- identifier.
- :param str source_snapshot_remote_region_name: (optional) Filters the
- collection to resources with a `source_snapshot.remote.region.name`
- property matching the exact specified name.
- :param str source_volume_remote_region_name: (optional) Filters the
- collection to resources with a `source_volume.remote.region.name` property
- matching the exact specified name.
- :param str source_image_remote_region_name: (optional) Filters the
- collection to resources with a `source_image.remote.region.name` property
- matching the exact specified name.
- :param str clones_zone_name: (optional) Filters the collection to snapshots
- with an item in the `clones` property with a `zone.name` property matching
- the exact specified name.
- :param str snapshot_consistency_group_id: (optional) Filters the collection
- to resources with a `snapshot_consistency_group.id` property matching the
- specified identifier.
- :param str snapshot_consistency_group_crn: (optional) Filters the
- collection to resources with a `snapshot_consistency_group.crn` property
- matching the specified identifier.
+ :param str load_balancer_id: The load balancer identifier.
+ :param str algorithm: The load balancing algorithm. The `least_connections`
+ algorithm is only supported for load balancers that have `availability`
+ with value `subnet` in the profile.
+ :param LoadBalancerPoolHealthMonitorPrototype health_monitor: The health
+ monitor of this pool.
+ If this pool has a member targeting a load balancer then:
+ - If the targeted load balancer has multiple subnets, this health monitor
+ will be
+ used to direct traffic to the available subnets.
+ - The health checks spawned by this health monitor will be handled as any
+ other
+ traffic (that is, subject to the configuration of listeners and pools on
+ the target
+ load balancer).
+ - This health monitor does not affect how pool member health is determined
+ within the
+ target load balancer.
+ For more information, see [Private Path network load balancer frequently
+ asked
+ questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs).
+ :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 LoadBalancerPoolFailsafePolicyPrototype failsafe_policy: (optional)
+ The failsafe policy to use for this pool.
+ If unspecified, the default failsafe policy action from the profile will be
+ used.
+ :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 name for this load balancer pool. The name
+ must not be used by another pool for the load balancer. 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
+ For load balancers in the `network` family, this property must be
+ `disabled`.
+ :param LoadBalancerPoolSessionPersistencePrototype session_persistence:
+ (optional) The session persistence of this pool. If specified, the load
+ balancer must have
+ `source_ip_session_persistence_supported` set to `true` in its profile.
+ If unspecified, session persistence will be disabled, and traffic will be
+ distributed
+ across members of the 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 `SnapshotCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object
"""
+ if not load_balancer_id:
+ 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 failsafe_policy is not None:
+ failsafe_policy = convert_model(failsafe_policy)
+ 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='list_snapshots',
+ operation_id='create_load_balancer_pool',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'tag': tag,
- 'resource_group.id': resource_group_id,
+ }
+
+ data = {
+ 'algorithm': algorithm,
+ 'health_monitor': health_monitor,
+ 'protocol': protocol,
+ 'failsafe_policy': failsafe_policy,
+ 'members': members,
'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,
- 'copies[].id': copies_id,
- 'copies[].name': copies_name,
- 'copies[].crn': copies_crn,
- 'copies[].remote.region.name': copies_remote_region_name,
- 'source_snapshot.id': source_snapshot_id,
- 'source_snapshot.remote.region.name': source_snapshot_remote_region_name,
- 'source_volume.remote.region.name': source_volume_remote_region_name,
- 'source_image.remote.region.name': source_image_remote_region_name,
- 'clones[].zone.name': clones_zone_name,
- 'snapshot_consistency_group.id': snapshot_consistency_group_id,
- 'snapshot_consistency_group.crn': snapshot_consistency_group_crn,
+ '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/snapshots'
+ 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='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_snapshot(
+ def delete_load_balancer_pool(
self,
- snapshot_prototype: 'SnapshotPrototype',
+ load_balancer_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a snapshot.
+ Delete a load balancer pool.
- This request creates a new snapshot from a snapshot prototype object. The
- prototype object is structured in the same way as a retrieved snapshot, and
- contains the information necessary to provision the new snapshot.
+ 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,
+ nor be the target pool in the failsafe policy for any other pool.
- :param SnapshotPrototype snapshot_prototype: The snapshot prototype object.
+ :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 `Snapshot` object
+ :rtype: DetailedResponse
"""
- if snapshot_prototype is None:
- raise ValueError('snapshot_prototype must be provided')
- if isinstance(snapshot_prototype, SnapshotPrototype):
- snapshot_prototype = convert_model(snapshot_prototype)
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_snapshot',
+ operation_id='delete_load_balancer_pool',
)
headers.update(sdk_headers)
@@ -13678,55 +14411,51 @@ def create_snapshot(
'generation': self.generation,
}
- data = json.dumps(snapshot_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/snapshots'
+ 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='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_snapshot(
+ def get_load_balancer_pool(
self,
+ load_balancer_id: str,
id: str,
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a snapshot.
+ Retrieve a load balancer pool.
- This request deletes a snapshot. This operation cannot be reversed.
+ This request retrieves a single pool specified by the identifier in the URL path.
- :param str id: The snapshot 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 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
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
if not id:
raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_snapshot',
+ operation_id='get_load_balancer_pool',
)
headers.update(sdk_headers)
@@ -13738,13 +14467,14 @@ def delete_snapshot(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/snapshots/{id}'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -13753,29 +14483,40 @@ def delete_snapshot(
response = self.send(request, **kwargs)
return response
- def get_snapshot(
+ def update_load_balancer_pool(
self,
+ load_balancer_id: str,
id: str,
+ load_balancer_pool_patch: 'LoadBalancerPoolPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a snapshot.
+ Update a load balancer pool.
- This request retrieves a single snapshot specified by the identifier in the URL.
+ This request updates a load balancer pool from a pool patch.
- :param str id: The snapshot identifier.
+ :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 `Snapshot` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
if not id:
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)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_snapshot',
+ operation_id='update_load_balancer_pool',
)
headers.update(sdk_headers)
@@ -13784,63 +14525,56 @@ def get_snapshot(
'generation': self.generation,
}
+ data = json.dumps(load_balancer_pool_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/snapshots/{id}'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_snapshot(
+ def list_load_balancer_pool_members(
self,
- id: str,
- snapshot_patch: 'SnapshotPatch',
- *,
- if_match: Optional[str] = None,
+ load_balancer_id: str,
+ pool_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Update a snapshot.
+ List members of a load balancer pool.
- This request updates a snapshot with the information in a provided snapshot patch.
- The snapshot consistency group patch object is structured in the same way as a
- retrieved snapshot and contains only the information to be updated.
+ This request lists members of a load balancer pool.
- :param str id: The snapshot identifier.
- :param SnapshotPatch snapshot_patch: The snapshot 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 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 `Snapshot` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMemberCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
- if snapshot_patch is None:
- raise ValueError('snapshot_patch must be provided')
- if isinstance(snapshot_patch, SnapshotPatch):
- snapshot_patch = convert_model(snapshot_patch)
- headers = {
- 'If-Match': if_match,
- }
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not pool_id:
+ raise ValueError('pool_id must be provided')
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_snapshot',
+ operation_id='list_load_balancer_pool_members',
)
headers.update(sdk_headers)
@@ -13849,53 +14583,87 @@ def update_snapshot(
'generation': self.generation,
}
- data = json.dumps(snapshot_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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']
+ path_param_values = self.encode_path_vars(load_balancer_id, pool_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/snapshots/{id}'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_snapshot_clones(
+ def create_load_balancer_pool_member(
self,
- id: str,
+ load_balancer_id: str,
+ pool_id: str,
+ port: int,
+ target: 'LoadBalancerPoolMemberTargetPrototype',
+ *,
+ weight: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List clones for a snapshot.
+ Create a member in a load balancer pool.
- This request lists clones for a snapshot. Use a clone to quickly restore a
- snapshot within the clone's zone.
+ This request creates a new member and adds the member to the pool.
+ The pool must not already have a member targeting a load balancer.
- :param str id: The snapshot identifier.
+ :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.
+ 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 LoadBalancerPoolMemberTargetPrototype target: The pool member
+ target.
+ If the load balancer has `route_mode` set to `true`, the member must be in
+ a zone the load
+ balancer has a subnet in.
+ 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 int weight: (optional) The weight of the member.
+ If specified, the pool algorithm must be `weighted_round_robin` and the
+ load balancer must be in the `application` family.
+ If unspecified, the weight will be `50` for load balancers in the
+ `application` family.
: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 `SnapshotCloneCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not pool_id:
+ 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)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_snapshot_clones',
+ operation_id='create_load_balancer_pool_member',
)
headers.update(sdk_headers)
@@ -13904,53 +14672,69 @@ def list_snapshot_clones(
'generation': self.generation,
}
+ data = {
+ 'port': port,
+ 'target': target,
+ 'weight': weight,
+ }
+ 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'))
del kwargs['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']
+ path_param_values = self.encode_path_vars(load_balancer_id, pool_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/snapshots/{id}/clones'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_snapshot_clone(
+ def replace_load_balancer_pool_members(
self,
- id: str,
- zone_name: str,
+ load_balancer_id: str,
+ pool_id: str,
+ members: List['LoadBalancerPoolMemberPrototype'],
**kwargs,
) -> DetailedResponse:
"""
- Delete a snapshot clone.
+ Replace load balancer pool members.
- This request deletes a snapshot clone. This operation cannot be reversed, but an
- equivalent clone may be recreated from the snapshot.
+ This request replaces the existing members of the load balancer pool with new
+ members created from the collection of member prototype objects.
- :param str id: The snapshot identifier.
- :param str zone_name: The zone name.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMemberCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
- if not zone_name:
- raise ValueError('zone_name must be provided')
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not pool_id:
+ 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='delete_snapshot_clone',
+ operation_id='replace_load_balancer_pool_members',
)
headers.update(sdk_headers)
@@ -13959,52 +14743,64 @@ def delete_snapshot_clone(
'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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id', 'zone_name']
- path_param_values = self.encode_path_vars(id, zone_name)
+ 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 = '/snapshots/{id}/clones/{zone_name}'.format(**path_param_dict)
+ url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='PUT',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_snapshot_clone(
+ def delete_load_balancer_pool_member(
self,
+ load_balancer_id: str,
+ pool_id: str,
id: str,
- zone_name: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a snapshot clone.
+ Delete a load balancer pool member.
- This request retrieves a single clone specified by the snapshot identifier and
- zone name in the URL.
+ This request deletes a member from the pool. This operation cannot be reversed.
- :param str id: The snapshot identifier.
- :param str zone_name: The zone name.
+ :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 `SnapshotClone` object
+ :rtype: DetailedResponse
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not pool_id:
+ raise ValueError('pool_id must be provided')
if not id:
raise ValueError('id must be provided')
- if not zone_name:
- raise ValueError('zone_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_snapshot_clone',
+ operation_id='delete_load_balancer_pool_member',
)
headers.update(sdk_headers)
@@ -14016,14 +14812,13 @@ def get_snapshot_clone(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id', 'zone_name']
- path_param_values = self.encode_path_vars(id, zone_name)
+ 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 = '/snapshots/{id}/clones/{zone_name}'.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',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -14032,35 +14827,38 @@ def get_snapshot_clone(
response = self.send(request, **kwargs)
return response
- def create_snapshot_clone(
+ def get_load_balancer_pool_member(
self,
+ load_balancer_id: str,
+ pool_id: str,
id: str,
- zone_name: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a clone for a snapshot.
+ Retrieve a load balancer pool member.
- This request creates a new clone for a snapshot in the specified zone. A request
- body is not required, and if provided, is ignored. If the snapshot already has a
- clone in the zone, it is returned.
+ This request retrieves a single member specified by the identifier in the URL
+ path.
- :param str id: The snapshot identifier.
- :param str zone_name: The zone name.
+ :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 `SnapshotClone` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object
"""
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not pool_id:
+ raise ValueError('pool_id must be provided')
if not id:
raise ValueError('id must be provided')
- if not zone_name:
- raise ValueError('zone_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_snapshot_clone',
+ operation_id='get_load_balancer_pool_member',
)
headers.update(sdk_headers)
@@ -14074,75 +14872,10 @@ def create_snapshot_clone(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id', 'zone_name']
- path_param_values = self.encode_path_vars(id, zone_name)
+ 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 = '/snapshots/{id}/clones/{zone_name}'.format(**path_param_dict)
- request = self.prepare_request(
- method='PUT',
- url=url,
- headers=headers,
- params=params,
- )
-
- response = self.send(request, **kwargs)
- return response
-
- #########################
- # Shares
- #########################
-
- def list_share_profiles(
- self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- sort: Optional[str] = None,
- **kwargs,
- ) -> DetailedResponse:
- """
- List file share profiles.
-
- This request lists [file share
- profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles)
- available in the region. A file share profile specifies the performance
- characteristics and pricing model for a file share.
-
- :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 `ShareProfileCollection` object
- """
-
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='list_share_profiles',
- )
- 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'))
- del kwargs['headers']
- headers['Accept'] = 'application/json'
-
- url = '/share/profiles'
+ url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -14153,30 +14886,44 @@ def list_share_profiles(
response = self.send(request, **kwargs)
return response
- def get_share_profile(
+ def update_load_balancer_pool_member(
self,
- name: str,
+ load_balancer_id: str,
+ pool_id: str,
+ id: str,
+ load_balancer_pool_member_patch: 'LoadBalancerPoolMemberPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a file share profile.
+ Update a load balancer pool member.
- This request retrieves a single file share profile specified by the name in the
- URL.
+ This request updates an existing member from a member patch.
- :param str name: The file share profile name.
+ :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 `ShareProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not load_balancer_id:
+ raise ValueError('load_balancer_id must be provided')
+ if not pool_id:
+ raise ValueError('pool_id must be provided')
+ if not id:
+ 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)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_share_profile',
+ operation_id='update_load_balancer_pool_member',
)
headers.update(sdk_headers)
@@ -14185,40 +14932,49 @@ def get_share_profile(
'generation': self.generation,
}
+ data = json.dumps(load_balancer_pool_member_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ 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 = '/share/profiles/{name}'.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',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_shares(
+ #########################
+ # Network ACLs
+ #########################
+
+ def list_network_acls(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- sort: Optional[str] = None,
- replication_role: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List file shares.
+ List network ACLs.
- This request lists file shares in the region.
+ This request lists network ACLs in the region. A network ACL defines a set of
+ packet filtering rules for traffic in and out of the subnets the network ACL is
+ attached to. No traffic is allowed by default. Both allow and deny rules can be
+ defined, and rules are stateless so that reverse traffic in response to allowed
+ traffic is not automatically allowed.
:param str start: (optional) A server-provided token determining what
resource to start the page on.
@@ -14226,25 +14982,16 @@ def list_shares(
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :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 str replication_role: (optional) Filters the collection to file
- shares with a `replication_role` property matching the specified 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 `ShareCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACLCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_shares',
+ operation_id='list_network_acls',
)
headers.update(sdk_headers)
@@ -14254,9 +15001,6 @@ def list_shares(
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
- 'name': name,
- 'sort': sort,
- 'replication_role': replication_role,
}
if 'headers' in kwargs:
@@ -14264,7 +15008,7 @@ def list_shares(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/shares'
+ url = '/network_acls'
request = self.prepare_request(
method='GET',
url=url,
@@ -14275,35 +15019,34 @@ def list_shares(
response = self.send(request, **kwargs)
return response
- def create_share(
+ def create_network_acl(
self,
- share_prototype: 'SharePrototype',
+ network_acl_prototype: 'NetworkACLPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a file share.
+ Create a network ACL.
- This request provisions new file shares from a share prototype object. The new
- file shares can be a standalone share, a replica share, or both a source and
- replica share.
- The prototype object is structured in the same way as a retrieved share, and
- contains the information necessary to provision the new file shares.
+ This request creates a new stateless network ACL from a network ACL prototype
+ object. The prototype object is structured in the same way as a retrieved network
+ ACL, and contains the information necessary to create the new network ACL.
- :param SharePrototype share_prototype: The file share prototype object.
+ :param NetworkACLPrototype network_acl_prototype: The network ACL prototype
+ object.
: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 `Share` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACL` object
"""
- if share_prototype is None:
- raise ValueError('share_prototype must be provided')
- if isinstance(share_prototype, SharePrototype):
- share_prototype = convert_model(share_prototype)
+ if network_acl_prototype is None:
+ raise ValueError('network_acl_prototype must be provided')
+ if isinstance(network_acl_prototype, NetworkACLPrototype):
+ network_acl_prototype = convert_model(network_acl_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_share',
+ operation_id='create_network_acl',
)
headers.update(sdk_headers)
@@ -14312,7 +15055,7 @@ def create_share(
'generation': self.generation,
}
- data = json.dumps(share_prototype)
+ data = json.dumps(network_acl_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -14320,7 +15063,7 @@ def create_share(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/shares'
+ url = '/network_acls'
request = self.prepare_request(
method='POST',
url=url,
@@ -14332,41 +15075,31 @@ def create_share(
response = self.send(request, **kwargs)
return response
- def delete_share(
+ def delete_network_acl(
self,
id: str,
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a file share.
+ Delete a network ACL.
- This request deletes a share. This operation cannot be reversed. A share cannot be
- deleted if it:
- - has share mount targets
- - has a `lifecycle_state` of `updating`
- - has a replication operation in progress
- If the request is accepted, the share `lifecycle_state` will be set to `deleting`.
- Once deletion processing completes, it will no longer be retrievable.
+ This request deletes a network ACL. This operation cannot be reversed. For this
+ request to succeed, the network ACL must not be the default network ACL for any
+ VPCs, and the network ACL must not be attached to any subnets.
- :param str id: The file share 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 str id: The network ACL 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 `Share` object
+ :rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_share',
+ operation_id='delete_network_acl',
)
headers.update(sdk_headers)
@@ -14378,12 +15111,11 @@ def delete_share(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/shares/{id}'.format(**path_param_dict)
+ url = '/network_acls/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -14394,20 +15126,21 @@ def delete_share(
response = self.send(request, **kwargs)
return response
- def get_share(
+ def get_network_acl(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a file share.
+ Retrieve a network ACL.
- This request retrieves a single file share specified by the identifier in the URL.
+ This request retrieves a single network ACL specified by the identifier in the
+ URL.
- :param str id: The file share identifier.
+ :param str id: The network ACL 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 `Share` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACL` object
"""
if not id:
@@ -14416,7 +15149,7 @@ def get_share(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_share',
+ operation_id='get_network_acl',
)
headers.update(sdk_headers)
@@ -14433,7 +15166,7 @@ def get_share(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{id}'.format(**path_param_dict)
+ url = '/network_acls/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -14444,44 +15177,35 @@ def get_share(
response = self.send(request, **kwargs)
return response
- def update_share(
+ def update_network_acl(
self,
id: str,
- share_patch: 'SharePatch',
- *,
- if_match: Optional[str] = None,
+ network_acl_patch: 'NetworkACLPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a file share.
+ Update a network ACL.
- This request updates a share with the information in a provided share patch. The
- share patch object is structured in the same way as a retrieved share and contains
- only the information to be updated.
+ This request updates a network ACL's name.
- :param str id: The file share identifier.
- :param SharePatch share_patch: The file share 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 str id: The network ACL identifier.
+ :param NetworkACLPatch network_acl_patch: The network ACL 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 `Share` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACL` object
"""
if not id:
raise ValueError('id must be provided')
- if share_patch is None:
- raise ValueError('share_patch must be provided')
- if isinstance(share_patch, SharePatch):
- share_patch = convert_model(share_patch)
- headers = {
- 'If-Match': if_match,
- }
+ if network_acl_patch is None:
+ raise ValueError('network_acl_patch must be provided')
+ if isinstance(network_acl_patch, NetworkACLPatch):
+ network_acl_patch = convert_model(network_acl_patch)
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_share',
+ operation_id='update_network_acl',
)
headers.update(sdk_headers)
@@ -14490,7 +15214,7 @@ def update_share(
'generation': self.generation,
}
- data = json.dumps(share_patch)
+ data = json.dumps(network_acl_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -14501,7 +15225,7 @@ def update_share(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{id}'.format(**path_param_dict)
+ url = '/network_acls/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -14513,39 +15237,40 @@ def update_share(
response = self.send(request, **kwargs)
return response
- def list_share_accessor_bindings(
+ def list_network_acl_rules(
self,
- id: str,
+ network_acl_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ direction: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List accessor bindings for a file share.
+ List rules for a network ACL.
- This request lists accessor bindings for a share. Each accessor binding identifies
- a resource (possibly in another account) with access to this file share including
- its snapshots.
- The share accessor bindings will be sorted by their `created_at` property values,
- with newest bindings first.
+ This request lists rules for a network ACL. These rules can allow or deny traffic
+ between a source CIDR block and a destination CIDR block over a particular
+ protocol and port range.
- :param str id: The file share identifier.
+ :param str network_acl_id: The network ACL 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 direction: (optional) Filters the collection to rules with a
+ `direction` property matching the specified 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 `ShareAccessorBindingCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACLRuleCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not network_acl_id:
+ raise ValueError('network_acl_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_share_accessor_bindings',
+ operation_id='list_network_acl_rules',
)
headers.update(sdk_headers)
@@ -14554,6 +15279,7 @@ def list_share_accessor_bindings(
'generation': self.generation,
'start': start,
'limit': limit,
+ 'direction': direction,
}
if 'headers' in kwargs:
@@ -14561,10 +15287,10 @@ def list_share_accessor_bindings(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['network_acl_id']
+ path_param_values = self.encode_path_vars(network_acl_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{id}/accessor_bindings'.format(**path_param_dict)
+ url = '/network_acls/{network_acl_id}/rules'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -14575,33 +15301,96 @@ def list_share_accessor_bindings(
response = self.send(request, **kwargs)
return response
- def delete_share_accessor_binding(
+ def create_network_acl_rule(
self,
- share_id: str,
+ network_acl_id: str,
+ network_acl_rule_prototype: 'NetworkACLRulePrototype',
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Create a rule for a network ACL.
+
+ This request creates a new rule from a network ACL rule prototype object. The
+ prototype object is structured in the same way as a retrieved rule, and contains
+ the information necessary to create the new rule.
+
+ :param str network_acl_id: The network ACL identifier.
+ :param NetworkACLRulePrototype network_acl_rule_prototype: The network ACL
+ rule prototype object.
+ :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 `NetworkACLRule` object
+ """
+
+ if not network_acl_id:
+ raise ValueError('network_acl_id must be provided')
+ if network_acl_rule_prototype is None:
+ raise ValueError('network_acl_rule_prototype must be provided')
+ if isinstance(network_acl_rule_prototype, NetworkACLRulePrototype):
+ network_acl_rule_prototype = convert_model(network_acl_rule_prototype)
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='create_network_acl_rule',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ data = json.dumps(network_acl_rule_prototype)
+ headers['content-type'] = 'application/json'
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+ headers['Accept'] = 'application/json'
+
+ path_param_keys = ['network_acl_id']
+ path_param_values = self.encode_path_vars(network_acl_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/network_acls/{network_acl_id}/rules'.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_network_acl_rule(
+ self,
+ network_acl_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a file share accessor binding.
+ Delete a network ACL rule.
- This request deletes a share accessor binding. This operation cannot be reversed.
+ This request deletes a rule. This operation cannot be reversed.
- :param str share_id: The file share identifier.
- :param str id: The file share accessor binding identifier.
+ :param str network_acl_id: The network ACL 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 not share_id:
- raise ValueError('share_id must be provided')
+ if not network_acl_id:
+ raise ValueError('network_acl_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_share_accessor_binding',
+ operation_id='delete_network_acl_rule',
)
headers.update(sdk_headers)
@@ -14614,10 +15403,10 @@ def delete_share_accessor_binding(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_id, id)
+ path_param_keys = ['network_acl_id', 'id']
+ path_param_values = self.encode_path_vars(network_acl_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/accessor_bindings/{id}'.format(**path_param_dict)
+ url = '/network_acls/{network_acl_id}/rules/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -14628,34 +15417,33 @@ def delete_share_accessor_binding(
response = self.send(request, **kwargs)
return response
- def get_share_accessor_binding(
+ def get_network_acl_rule(
self,
- share_id: str,
+ network_acl_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a file share accessor binding.
+ Retrieve a network ACL rule.
- This request retrieves a single accessor binding specified by the identifier in
- the URL.
+ This request retrieves a single rule specified by the identifier in the URL.
- :param str share_id: The file share identifier.
- :param str id: The file share accessor binding identifier.
+ :param str network_acl_id: The network ACL 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 `ShareAccessorBinding` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACLRule` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
+ if not network_acl_id:
+ raise ValueError('network_acl_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_share_accessor_binding',
+ operation_id='get_network_acl_rule',
)
headers.update(sdk_headers)
@@ -14669,10 +15457,10 @@ def get_share_accessor_binding(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_id, id)
+ path_param_keys = ['network_acl_id', 'id']
+ path_param_values = self.encode_path_vars(network_acl_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/accessor_bindings/{id}'.format(**path_param_dict)
+ url = '/network_acls/{network_acl_id}/rules/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -14683,50 +15471,43 @@ def get_share_accessor_binding(
response = self.send(request, **kwargs)
return response
- def failover_share(
+ def update_network_acl_rule(
self,
- share_id: str,
- *,
- fallback_policy: Optional[str] = None,
- timeout: Optional[int] = None,
+ network_acl_id: str,
+ id: str,
+ network_acl_rule_patch: 'NetworkACLRulePatch',
**kwargs,
) -> DetailedResponse:
"""
- Failover to replica file share.
+ Update a network ACL rule.
- This request triggers a failover to the replica file share specified by the
- identifier in the URL. The failover cannot be started if a source share or the
- replica share has a `lifecycle_state` of `updating`, or has a replication
- operation in progress.
- If `fallback_policy` is specified as `split`, and the request is accepted but the
- failover operation cannot be performed, a split will be triggered.
+ This request updates a rule with the information in a provided rule patch. The
+ rule patch object contains only the information to be updated. The request will
+ fail if the provided patch includes properties that are not used by the rule's
+ protocol.
- :param str share_id: The file share identifier.
- :param str fallback_policy: (optional) The action to take if the failover
- request is accepted but cannot be performed or times out:
- - `fail`: Fail the operation, resulting in the replication relationship
- being unchanged.
- - `split`: Split the replica from its source, resulting in two individual
- read-write
- file shares. Because the final sync was not completed, the replica may
- be
- out-of-date. This occurs in disaster recovery scenarios where the
- source is known to
- be unreachable.
- :param int timeout: (optional) The failover timeout in seconds.
- If the timeout is reached, the `fallback_policy` will be triggered.
+ :param str network_acl_id: The network ACL identifier.
+ :param str id: The rule identifier.
+ :param NetworkACLRulePatch network_acl_rule_patch: The network ACL rule
+ patch.
: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 `NetworkACLRule` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
+ if not network_acl_id:
+ raise ValueError('network_acl_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if network_acl_rule_patch is None:
+ raise ValueError('network_acl_rule_patch must be provided')
+ if isinstance(network_acl_rule_patch, NetworkACLRulePatch):
+ network_acl_rule_patch = convert_model(network_acl_rule_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='failover_share',
+ operation_id='update_network_acl_rule',
)
headers.update(sdk_headers)
@@ -14735,24 +15516,20 @@ def failover_share(
'generation': self.generation,
}
- data = {
- 'fallback_policy': fallback_policy,
- 'timeout': timeout,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
- headers['content-type'] = 'application/json'
+ data = json.dumps(network_acl_rule_patch)
+ headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
+ path_param_keys = ['network_acl_id', 'id']
+ path_param_values = self.encode_path_vars(network_acl_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/failover'.format(**path_param_dict)
+ url = '/network_acls/{network_acl_id}/rules/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PATCH',
url=url,
headers=headers,
params=params,
@@ -14762,49 +15539,41 @@ def failover_share(
response = self.send(request, **kwargs)
return response
- def list_share_mount_targets(
+ #########################
+ # Placement groups
+ #########################
+
+ def list_placement_groups(
self,
- share_id: str,
*,
- name: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List mount targets for a file share.
+ List placement groups.
- This request lists mount targets for a file share. A mount target is a network
- endpoint at which a file share may be mounted. The file share can be mounted by
- clients in the same VPC and zone after creating share mount targets.
- The share mount targets will be sorted by their `created_at` property values, with
- newest targets first.
+ This request lists placement groups in the region.
- :param str share_id: The file share identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching 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 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 `ShareMountTargetCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `PlacementGroupCollection` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_share_mount_targets',
+ operation_id='list_placement_groups',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'name': name,
'start': start,
'limit': limit,
}
@@ -14814,10 +15583,7 @@ def list_share_mount_targets(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/mount_targets'.format(**path_param_dict)
+ url = '/placement_groups'
request = self.prepare_request(
method='GET',
url=url,
@@ -14828,40 +15594,43 @@ def list_share_mount_targets(
response = self.send(request, **kwargs)
return response
- def create_share_mount_target(
+ def create_placement_group(
self,
- share_id: str,
- share_mount_target_prototype: 'ShareMountTargetPrototype',
+ strategy: str,
+ *,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a mount target for a file share.
+ Create a placement group.
- This request creates a new share mount target from a share mount target prototype
- object.
- The prototype object is structured in the same way as a retrieved share mount
- target, and contains the information necessary to provision the new file share
- mount target.
+ This request creates a new placement group.
- :param str share_id: The file share identifier.
- :param ShareMountTargetPrototype share_mount_target_prototype: The share
- mount target prototype object.
+ :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.
+ :param str name: (optional) The name for this placement group. The name
+ must not be used by another placement group in the region. 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) will be
+ 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 `ShareMountTarget` object
+ :rtype: DetailedResponse with `dict` result representing a `PlacementGroup` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
- if share_mount_target_prototype is None:
- raise ValueError('share_mount_target_prototype must be provided')
- if isinstance(share_mount_target_prototype, ShareMountTargetPrototype):
- share_mount_target_prototype = convert_model(share_mount_target_prototype)
+ if strategy is None:
+ raise ValueError('strategy must be provided')
+ 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_share_mount_target',
+ operation_id='create_placement_group',
)
headers.update(sdk_headers)
@@ -14870,7 +15639,13 @@ def create_share_mount_target(
'generation': self.generation,
}
- data = json.dumps(share_mount_target_prototype)
+ data = {
+ 'strategy': strategy,
+ '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:
@@ -14878,10 +15653,7 @@ def create_share_mount_target(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/mount_targets'.format(**path_param_dict)
+ url = '/placement_groups'
request = self.prepare_request(
method='POST',
url=url,
@@ -14893,36 +15665,31 @@ def create_share_mount_target(
response = self.send(request, **kwargs)
return response
- def delete_share_mount_target(
+ def delete_placement_group(
self,
- share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a file share mount target.
+ Delete a placement group.
- This request deletes a share mount target. This operation cannot be reversed.
- If the request is accepted, the share mount target `lifecycle_state` will be set
- to
- `deleting`. Once deletion processing completes, it will no longer be retrievable.
+ This request deletes a placement group. This operation cannot be reversed. For
+ this request to succeed, the placement group must not be associated with an
+ instance.
- :param str share_id: The file share identifier.
- :param str id: The file share mount target identifier.
+ :param str id: The placement group 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 `ShareMountTarget` object
+ :rtype: DetailedResponse
"""
- if not share_id:
- raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_share_mount_target',
+ operation_id='delete_placement_group',
)
headers.update(sdk_headers)
@@ -14934,12 +15701,11 @@ def delete_share_mount_target(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_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 = '/shares/{share_id}/mount_targets/{id}'.format(**path_param_dict)
+ url = '/placement_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -14950,34 +15716,30 @@ def delete_share_mount_target(
response = self.send(request, **kwargs)
return response
- def get_share_mount_target(
+ def get_placement_group(
self,
- share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a file share mount target.
+ Retrieve a placement group.
- This request retrieves a single share mount target specified by the identifier in
- the URL.
+ This request retrieves a single placement group specified by identifier in the
+ URL.
- :param str share_id: The file share identifier.
- :param str id: The file share mount target identifier.
+ :param str id: The placement group 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 `ShareMountTarget` object
+ :rtype: DetailedResponse with `dict` result representing a `PlacementGroup` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_share_mount_target',
+ operation_id='get_placement_group',
)
headers.update(sdk_headers)
@@ -14991,10 +15753,10 @@ def get_share_mount_target(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_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 = '/shares/{share_id}/mount_targets/{id}'.format(**path_param_dict)
+ url = '/placement_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -15005,43 +15767,38 @@ def get_share_mount_target(
response = self.send(request, **kwargs)
return response
- def update_share_mount_target(
+ def update_placement_group(
self,
- share_id: str,
id: str,
- share_mount_target_patch: 'ShareMountTargetPatch',
+ placement_group_patch: 'PlacementGroupPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a file share mount target.
+ Update a placement group.
- This request updates a share mount target with the information provided in a share
- mount target patch object. The share mount target patch object is structured in
- the same way as a retrieved share mount target and needs to contain only the
- information to be updated.
+ This request updates a placement group with the information provided placement
+ group patch. The placement group patch object is structured in the same way as a
+ retrieved placement group and contains only the information to be updated.
- :param str share_id: The file share identifier.
- :param str id: The file share mount target identifier.
- :param ShareMountTargetPatch share_mount_target_patch: The share mount
- target patch.
+ :param str id: The placement group identifier.
+ :param PlacementGroupPatch placement_group_patch: The placement group
+ 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 `ShareMountTarget` object
+ :rtype: DetailedResponse with `dict` result representing a `PlacementGroup` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
- if share_mount_target_patch is None:
- raise ValueError('share_mount_target_patch must be provided')
- if isinstance(share_mount_target_patch, ShareMountTargetPatch):
- share_mount_target_patch = convert_model(share_mount_target_patch)
+ if placement_group_patch is None:
+ raise ValueError('placement_group_patch must be provided')
+ if isinstance(placement_group_patch, PlacementGroupPatch):
+ placement_group_patch = convert_model(placement_group_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_share_mount_target',
+ operation_id='update_placement_group',
)
headers.update(sdk_headers)
@@ -15050,7 +15807,7 @@ def update_share_mount_target(
'generation': self.generation,
}
- data = json.dumps(share_mount_target_patch)
+ data = json.dumps(placement_group_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -15058,10 +15815,10 @@ def update_share_mount_target(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_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 = '/shares/{share_id}/mount_targets/{id}'.format(**path_param_dict)
+ url = '/placement_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -15073,64 +15830,57 @@ def update_share_mount_target(
response = self.send(request, **kwargs)
return response
- def list_share_snapshots(
+ #########################
+ # Private path service gateways
+ #########################
+
+ def list_private_path_service_gateways(
self,
- share_id: str,
*,
- backup_policy_plan_id: Optional[str] = None,
- name: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
- sort: Optional[str] = None,
+ resource_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List file share snapshots.
+ List private path service gateways.
- This request lists snapshots for the specified file share, or across all
- accessible file shares. A snapshot preserves the data of a share at the time the
- snapshot was captured.
- If the file share is a replica, the list will contain snapshots corresponding to
- snapshots on the source.
+ This request lists private path service gateways in the region. Private path
+ service gateways allow
+ [service
+ providers](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components)
+ to make their services available using
+ [private path
+ connectivity](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components).
+ Private path service gateways are used to facilitate and manage the private path
+ connectivity between private path network load balancers and their associated
+ endpoint gateways.
- :param str share_id: The file share identifier, or `-` to wildcard all
- accessible file shares.
- :param str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching 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 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 str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching 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 `ShareSnapshotCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGatewayCollection` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_share_snapshots',
+ operation_id='list_private_path_service_gateways',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'backup_policy_plan.id': backup_policy_plan_id,
- 'name': name,
'start': start,
'limit': limit,
- 'sort': sort,
+ 'resource_group.id': resource_group_id,
}
if 'headers' in kwargs:
@@ -15138,10 +15888,7 @@ def list_share_snapshots(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/snapshots'.format(**path_param_dict)
+ url = '/private_path_service_gateways'
request = self.prepare_request(
method='GET',
url=url,
@@ -15152,48 +15899,69 @@ def list_share_snapshots(
response = self.send(request, **kwargs)
return response
- def create_share_snapshot(
+ def create_private_path_service_gateway(
self,
- share_id: str,
+ load_balancer: 'LoadBalancerIdentity',
+ service_endpoints: List[str],
*,
+ default_access_policy: Optional[str] = None,
name: Optional[str] = None,
- user_tags: Optional[List[str]] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ zonal_affinity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a snapshot for a file share.
+ Create a private path service gateway.
- This request creates a new share snapshot from a share snapshot prototype object.
- The prototype object is structured in the same way as a retrieved share snapshot,
- and contains the information necessary to create the new share snapshot.
- The share must have an `access_control_mode` of `security_group` and a
- `replication_role` of `source` or `none`.
- The snapshot will inherit its `resource_group` and encryption settings from the
- share.
- If the share has a `replication_role` of `source`, a corresponding snapshot on the
- replica share will be created with a `status` of `pending`. It will remain in
- `pending` until the data is synchronized per the replication schedule determined
- by the replica share's `replication_cron_spec`.
+ This request creates a private path service gateway from a private path service
+ gateway prototype object. The prototype object is structured in the same way as a
+ retrieved private path service gateway, and contains the information necessary to
+ create the new private path service gateway.
- :param str share_id: The file share identifier.
- :param str name: (optional) The name for this share snapshot. The name must
- not be used by another snapshot for the file share. If unspecified, the
- name will be a hyphenated list of randomly-selected words.
- :param List[str] user_tags: (optional) The [user
- tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
- this share snapshot.
+ :param LoadBalancerIdentity load_balancer: The load balancer for this
+ private path service gateway. The load balancer must
+ have `is_private_path` set to `true`.
+ The private path service gateway will reside in the same VPC as the
+ specified load
+ balancer.
+ :param List[str] service_endpoints: The fully qualified domain names for
+ this private path service gateway. Any uppercase letters will be converted
+ to lowercase.
+ :param str default_access_policy: (optional) The policy to use for bindings
+ from accounts without an explicit account policy.
+ :param str name: (optional) The name for this private path service gateway.
+ The name must not be used by another private path service gateway in the
+ VPC. 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) will be
+ used.
+ :param bool zonal_affinity: (optional) Indicates whether this private path
+ service gateway has zonal affinity.
+ - `true`: Traffic to the service from a zone the service resides in will
+ remain in
+ that zone.
+ - `false`: Traffic to the service from a zone will be load balanced across
+ all zones
+ in the region the service 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 `ShareSnapshot` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGateway` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
+ if load_balancer is None:
+ raise ValueError('load_balancer must be provided')
+ if service_endpoints is None:
+ raise ValueError('service_endpoints must be provided')
+ load_balancer = convert_model(load_balancer)
+ 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_share_snapshot',
+ operation_id='create_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -15203,8 +15971,12 @@ def create_share_snapshot(
}
data = {
+ 'load_balancer': load_balancer,
+ 'service_endpoints': service_endpoints,
+ 'default_access_policy': default_access_policy,
'name': name,
- 'user_tags': user_tags,
+ 'resource_group': resource_group,
+ 'zonal_affinity': zonal_affinity,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -15215,10 +15987,7 @@ def create_share_snapshot(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/snapshots'.format(**path_param_dict)
+ url = '/private_path_service_gateways'
request = self.prepare_request(
method='POST',
url=url,
@@ -15230,46 +15999,31 @@ def create_share_snapshot(
response = self.send(request, **kwargs)
return response
- def delete_share_snapshot(
+ def delete_private_path_service_gateway(
self,
- share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a share snapshot.
+ Delete a private path service gateway.
- This request deletes a share snapshot. This operation cannot be reversed. For this
- request to succeed, the share must have a `replication_role` of `source` or
- `none`.
- If the request is accepted, the share snapshot `lifecycle_state` will be set to
- `deleting`. Once deletion processing completes, the share snapshot will no longer
- be retrievable.
- Deleting a share snapshot will not affect any previously-accepted requests to
- create a share from it.
- If the share has a `replication_role` of `source`, the corresponding snapshot on
- the replica share will be subsequently moved to a `lifecycle_state` of `deleting`.
- If the data for the corresponding snapshot has already been synchronized via the
- replication schedule determined by `replication_cron_spec`, the snapshot will
- remain available in the replica share's `.snapshot` directory until the next
- replication sync.
+ This request deletes a private path service gateway. For this request to succeed,
+ the value of `endpoint_gateway_count` must be `0`. This operation cannot be
+ reversed.
- :param str share_id: The file share identifier.
- :param str id: The share snapshot identifier.
+ :param str id: The private path service 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 `ShareSnapshot` object
+ :rtype: DetailedResponse
"""
- if not share_id:
- raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_share_snapshot',
+ operation_id='delete_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -15281,12 +16035,11 @@ def delete_share_snapshot(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_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 = '/shares/{share_id}/snapshots/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -15297,34 +16050,30 @@ def delete_share_snapshot(
response = self.send(request, **kwargs)
return response
- def get_share_snapshot(
+ def get_private_path_service_gateway(
self,
- share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a share snapshot.
+ Retrieve a private path service gateway.
- This request retrieves a single share snapshot specified by the identifier in the
- URL.
+ This request retrieves the private path service gateway specified by the
+ identifier in the URL.
- :param str share_id: The file share identifier.
- :param str id: The share snapshot identifier.
+ :param str id: The private path service 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 `ShareSnapshot` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGateway` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_share_snapshot',
+ operation_id='get_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -15338,10 +16087,10 @@ def get_share_snapshot(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_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 = '/shares/{share_id}/snapshots/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -15352,49 +16101,39 @@ def get_share_snapshot(
response = self.send(request, **kwargs)
return response
- def update_share_snapshot(
+ def update_private_path_service_gateway(
self,
- share_id: str,
id: str,
- share_snapshot_patch: 'ShareSnapshotPatch',
- *,
- if_match: Optional[str] = None,
+ private_path_service_gateway_patch: 'PrivatePathServiceGatewayPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a share snapshot.
+ Update a private path service gateway.
- This request updates a share snapshot with the information provided in a share
- snapshot patch object. The share snapshot patch object is structured in the same
- way as a retrieved share snapshot and needs to contain only the information to be
- updated.
+ This request updates a private path service gateway with the information provided
+ in a private path service gateway patch object. The private path service gateway
+ patch object is structured in the same way as a retrieved private path service
+ gateway and contains only the information to be updated.
- :param str share_id: The file share identifier.
- :param str id: The share snapshot identifier.
- :param ShareSnapshotPatch share_snapshot_patch: The share snapshot 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 str id: The private path service gateway identifier.
+ :param PrivatePathServiceGatewayPatch private_path_service_gateway_patch:
+ The private path service 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 `ShareSnapshot` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGateway` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
- if share_snapshot_patch is None:
- raise ValueError('share_snapshot_patch must be provided')
- if isinstance(share_snapshot_patch, ShareSnapshotPatch):
- share_snapshot_patch = convert_model(share_snapshot_patch)
- headers = {
- 'If-Match': if_match,
- }
+ if private_path_service_gateway_patch is None:
+ raise ValueError('private_path_service_gateway_patch must be provided')
+ if isinstance(private_path_service_gateway_patch, PrivatePathServiceGatewayPatch):
+ private_path_service_gateway_patch = convert_model(private_path_service_gateway_patch)
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_share_snapshot',
+ operation_id='update_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -15403,7 +16142,7 @@ def update_share_snapshot(
'generation': self.generation,
}
- data = json.dumps(share_snapshot_patch)
+ data = json.dumps(private_path_service_gateway_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -15411,10 +16150,10 @@ def update_share_snapshot(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id', 'id']
- path_param_values = self.encode_path_vars(share_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 = '/shares/{share_id}/snapshots/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -15426,51 +16165,66 @@ def update_share_snapshot(
response = self.send(request, **kwargs)
return response
- def delete_share_source(
+ def list_private_path_service_gateway_account_policies(
self,
- share_id: str,
+ private_path_service_gateway_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ account_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Split the source file share from a replica file share.
+ List account policies for a private path service gateway.
- This request removes the replication relationship between a source share and the
- replica share specified by the identifier in the URL. The replication relationship
- cannot be removed if a source share or the replica share has a `lifecycle_state`
- of `updating`, or has a replication operation in progress.
- This operation cannot be reversed.
+ This request lists account policies for a private path service gateway. Each
+ policy defines how requests to use the private path service gateway from that
+ account will be handled.
+ The account policies will be sorted by their `created_at` property values, with
+ newest account policies first. Account policies with identical `created_at`
+ property values will in turn be sorted by ascending `id` property values.
- :param str share_id: The file share identifier.
+ :param str private_path_service_gateway_id: The private path service
+ 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 account_id: (optional) Filters the collection to resources with
+ an `account.id` property matching 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
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGatewayAccountPolicyCollection` object
"""
- if not share_id:
- raise ValueError('share_id must be provided')
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_share_source',
+ operation_id='list_private_path_service_gateway_account_policies',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'account.id': account_id,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
+ path_param_keys = ['private_path_service_gateway_id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/source'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -15479,109 +16233,182 @@ def delete_share_source(
response = self.send(request, **kwargs)
return response
- def get_share_source(
+ def create_private_path_service_gateway_account_policy(
self,
- share_id: str,
+ private_path_service_gateway_id: str,
+ access_policy: str,
+ account: 'AccountIdentity',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve the source file share for a replica file share.
-
- This request retrieves the source file share associated with the replica file
- share specified by the identifier in the URL.
-
- :param str share_id: The file share 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 `ShareReference` object
- """
+ Create an account policy for a private path service gateway.
- if not share_id:
- raise ValueError('share_id must be provided')
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='get_share_source',
- )
- headers.update(sdk_headers)
+ This request creates an account policy from an account policy prototype object.
+ The prototype object is structured in the same way as a retrieved account policy,
+ and contains the information necessary to create the new account policy.
- params = {
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str access_policy: The access policy for the account. Updating the
+ access policy only affects pending and future endpoint gateway bindings.
+ - permit: access will be permitted
+ - deny: access will be denied
+ - review: access will be manually reviewed
+ - Updating to `review` sets the status of future endpoint gateway bindings
+ from
+ this account to `pending`.
+ - Updating to `permit` updates both the status of any `pending` and future
+ endpoint
+ gateway bindings from this account to `permitted`.
+ - Updating to `deny` updates both the status of any `pending` and future
+ endpoint
+ gateway bindings from this account to `denied`.
+ :param AccountIdentity account: The account for this access policy. The
+ account must be unique across all account
+ policies for this private path service gateway.
+ :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 `PrivatePathServiceGatewayAccountPolicy` object
+ """
+
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if access_policy is None:
+ raise ValueError('access_policy must be provided')
+ if account is None:
+ raise ValueError('account must be provided')
+ account = convert_model(account)
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='create_private_path_service_gateway_account_policy',
+ )
+ headers.update(sdk_headers)
+
+ params = {
'version': self.version,
'generation': self.generation,
}
+ data = {
+ 'access_policy': access_policy,
+ 'account': account,
+ }
+ 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['share_id']
- path_param_values = self.encode_path_vars(share_id)
+ path_param_keys = ['private_path_service_gateway_id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/shares/{share_id}/source'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Backup policies
- #########################
+ def delete_private_path_service_gateway_account_policy(
+ self,
+ private_path_service_gateway_id: str,
+ id: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Delete an account policy for a private path service gateway.
- def list_backup_policies(
+ This request deletes an account policy. This operation cannot be reversed and it
+ does not affect the `status` of any existing endpoint gateway bindings.
+
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str id: The account policy identifier.
+ :param dict headers: A `dict` containing the request headers
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
+ :rtype: DetailedResponse
+ """
+
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='delete_private_path_service_gateway_account_policy',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+
+ path_param_keys = ['private_path_service_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/account_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_private_path_service_gateway_account_policy(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- tag: Optional[str] = None,
+ private_path_service_gateway_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List backup policies.
+ Retrieve an account policy for a private path service gateway.
- This request lists 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.
+ This request retrieves a single account policy specified by the identifier in the
+ URL.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str tag: (optional) Filters the collection to resources with an item
- in the `tags` property matching the exact specified tag.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str id: The account 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 `BackupPolicyCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGatewayAccountPolicy` object
"""
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_backup_policies',
+ operation_id='get_private_path_service_gateway_account_policy',
)
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:
@@ -15589,7 +16416,10 @@ def list_backup_policies(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/backup_policies'
+ path_param_keys = ['private_path_service_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -15600,34 +16430,44 @@ def list_backup_policies(
response = self.send(request, **kwargs)
return response
- def create_backup_policy(
+ def update_private_path_service_gateway_account_policy(
self,
- backup_policy_prototype: 'BackupPolicyPrototype',
+ private_path_service_gateway_id: str,
+ id: str,
+ private_path_service_gateway_account_policy_patch: 'PrivatePathServiceGatewayAccountPolicyPatch',
**kwargs,
) -> DetailedResponse:
"""
- Create a backup policy.
+ Update an account policy for a private path service gateway.
- 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.
+ This request updates an account policy with the information in a provided account
+ policy patch. The account policy patch object is structured in the same way as a
+ retrieved account policy and contains only the information to be updated.
- :param BackupPolicyPrototype backup_policy_prototype: The backup policy
- prototype object.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str id: The account policy identifier.
+ :param PrivatePathServiceGatewayAccountPolicyPatch
+ private_path_service_gateway_account_policy_patch: The account 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 `BackupPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGatewayAccountPolicy` object
"""
- if backup_policy_prototype is None:
- raise ValueError('backup_policy_prototype must be provided')
- if isinstance(backup_policy_prototype, BackupPolicyPrototype):
- backup_policy_prototype = convert_model(backup_policy_prototype)
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if private_path_service_gateway_account_policy_patch is None:
+ raise ValueError('private_path_service_gateway_account_policy_patch must be provided')
+ if isinstance(private_path_service_gateway_account_policy_patch, PrivatePathServiceGatewayAccountPolicyPatch):
+ private_path_service_gateway_account_policy_patch = convert_model(private_path_service_gateway_account_policy_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_backup_policy',
+ operation_id='update_private_path_service_gateway_account_policy',
)
headers.update(sdk_headers)
@@ -15636,17 +16476,20 @@ def create_backup_policy(
'generation': self.generation,
}
- data = json.dumps(backup_policy_prototype)
- headers['content-type'] = 'application/json'
+ data = json.dumps(private_path_service_gateway_account_policy_patch)
+ headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/backup_policies'
+ path_param_keys = ['private_path_service_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PATCH',
url=url,
headers=headers,
params=params,
@@ -15656,74 +16499,61 @@ def create_backup_policy(
response = self.send(request, **kwargs)
return response
- def list_backup_policy_jobs(
+ def list_private_path_service_gateway_endpoint_gateway_bindings(
self,
- backup_policy_id: str,
+ private_path_service_gateway_id: str,
*,
- status: Optional[str] = None,
- backup_policy_plan_id: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
- sort: Optional[str] = None,
- source_id: Optional[str] = None,
- target_snapshots_id: Optional[str] = None,
- target_snapshots_crn: Optional[str] = None,
+ status: Optional[str] = None,
+ account_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List jobs for a backup policy.
+ List endpoint gateway bindings for a private path service gateway.
- This request retrieves jobs for a backup policy. A backup job represents the
- execution of a backup policy plan for a resource matching the policy's criteria.
+ This request lists endpoint gateway bindings for a private path service gateway.
+ Each endpoint gateway binding is implicitly created when an endpoint gateway is
+ created targeting the private path service gateway. The associated account policy
+ is applied to all new endpoint gateway bindings. If an associated account policy
+ doesn't exist, the private path service gateway's `default_access_policy` is used.
+ The endpoint gateway bindings will be sorted by their `created_at` property
+ values, with newest endpoint gateway bindings first. Endpoint gateway bindings
+ with identical
+ `created_at` property values will in turn be sorted by ascending `name` property
+ values.
- :param str backup_policy_id: The backup policy identifier.
- :param str status: (optional) Filters the collection to backup policy jobs
- with a `status` property matching the specified value.
- :param str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
+ :param str private_path_service_gateway_id: The private path service
+ 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 str source_id: (optional) Filters the collection to backup policy
- jobs with a `source.id` property matching the specified identifier.
- :param str target_snapshots_id: (optional) Filters the collection to backup
- policy jobs with an item in the `target_snapshots` property with an `id`
- property matching the specified identifier.
- :param str target_snapshots_crn: (optional) Filters the collection to
- backup policy jobs with an item in the `target_snapshots` property with a
- `crn` property matching the specified CRN.
+ :param str status: (optional) Filters the collection to endpoint gateway
+ bindings with a `status` property matching the specified value.
+ :param str account_id: (optional) Filters the collection to resources with
+ an `account.id` property matching 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 `BackupPolicyJobCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGatewayEndpointGatewayBindingCollection` object
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_backup_policy_jobs',
+ operation_id='list_private_path_service_gateway_endpoint_gateway_bindings',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'status': status,
- 'backup_policy_plan.id': backup_policy_plan_id,
'start': start,
'limit': limit,
- 'sort': sort,
- 'source.id': source_id,
- 'target_snapshots[].id': target_snapshots_id,
- 'target_snapshots[].crn': target_snapshots_crn,
+ 'status': status,
+ 'account.id': account_id,
}
if 'headers' in kwargs:
@@ -15731,10 +16561,10 @@ def list_backup_policy_jobs(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['backup_policy_id']
- path_param_values = self.encode_path_vars(backup_policy_id)
+ path_param_keys = ['private_path_service_gateway_id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/jobs'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -15745,34 +16575,35 @@ def list_backup_policy_jobs(
response = self.send(request, **kwargs)
return response
- def get_backup_policy_job(
+ def get_private_path_service_gateway_endpoint_gateway_binding(
self,
- backup_policy_id: str,
+ private_path_service_gateway_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a backup policy job.
+ Retrieve an endpoint gateway binding for a private path service gateway.
- This request retrieves a single backup policy job specified by the identifier in
- the URL.
+ This request retrieves a single endpoint gateway binding specified by the
+ identifier in the URL.
- :param str backup_policy_id: The backup policy identifier.
- :param str id: The backup policy job identifier.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str id: The endpoint gateway binding 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 `BackupPolicyJob` object
+ :rtype: DetailedResponse with `dict` result representing a `PrivatePathServiceGatewayEndpointGatewayBinding` object
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
if not id:
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_job',
+ operation_id='get_private_path_service_gateway_endpoint_gateway_binding',
)
headers.update(sdk_headers)
@@ -15786,10 +16617,10 @@ def get_backup_policy_job(
del kwargs['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_keys = ['private_path_service_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/jobs/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -15800,129 +16631,128 @@ def get_backup_policy_job(
response = self.send(request, **kwargs)
return response
- def list_backup_policy_plans(
+ def deny_private_path_service_gateway_endpoint_gateway_binding(
self,
- backup_policy_id: str,
+ private_path_service_gateway_id: str,
+ id: str,
*,
- name: Optional[str] = None,
+ set_account_policy: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- List plans for a backup policy.
+ Deny an endpoint gateway binding for a private path service gateway.
- This request retrieves plans for a backup policy. Backup plans provide the backup
- schedule and deletion triggers.
+ This request denies a `pending` endpoint gateway request, and optionally sets the
+ policy to deny future requests from the same account.
- :param str backup_policy_id: The backup policy identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str id: The endpoint gateway binding identifier.
+ :param bool set_account_policy: (optional) Indicates whether this will
+ become the access policy for any `pending` and future endpoint gateway
+ bindings from the same account.
+ If set to `true`:
+ - If the account has an existing access policy, that policy will be updated
+ to `deny`.
+ Otherwise, a new `deny` access policy will be created for the account.
+ - All `pending` endpoint gateway bindings for the account will be denied.
+ If set to `false`:
+ - No access policies will be created or updated
+ - All `pending` endpoint gateway bindings for the account will remain
+ `pending`.
: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
+ :rtype: DetailedResponse
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if not id:
+ raise ValueError('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',
+ operation_id='deny_private_path_service_gateway_endpoint_gateway_binding',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'name': name,
}
+ data = {
+ 'set_account_policy': set_account_policy,
+ }
+ 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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['backup_policy_id']
- path_param_values = self.encode_path_vars(backup_policy_id)
+ path_param_keys = ['private_path_service_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/plans'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/deny'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_backup_policy_plan(
+ def permit_private_path_service_gateway_endpoint_gateway_binding(
self,
- backup_policy_id: str,
- cron_spec: str,
+ private_path_service_gateway_id: str,
+ id: str,
*,
- active: Optional[bool] = None,
- attach_user_tags: Optional[List[str]] = None,
- clone_policy: Optional['BackupPolicyPlanClonePolicyPrototype'] = None,
- copy_user_tags: Optional[bool] = None,
- deletion_trigger: Optional['BackupPolicyPlanDeletionTriggerPrototype'] = None,
- name: Optional[str] = None,
- remote_region_policies: Optional[List['BackupPolicyPlanRemoteRegionPolicyPrototype']] = None,
+ set_account_policy: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a plan for a backup policy.
+ Permit an endpoint gateway binding for a private path service gateway.
- 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.
+ This request permits a `pending` endpoint gateway request, and optionally sets the
+ policy to permit future requests from the same account.
- :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) The user tags to attach to
- each backup (snapshot) created by this plan.
- :param BackupPolicyPlanClonePolicyPrototype clone_policy: (optional)
- :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 name for this backup policy plan. The name
- must not be used by another plan for the backup policy. If unspecified, the
- name will be a hyphenated list of randomly-selected words.
- :param List[BackupPolicyPlanRemoteRegionPolicyPrototype]
- remote_region_policies: (optional) The policies for additional backups in
- remote regions.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param str id: The endpoint gateway binding identifier.
+ :param bool set_account_policy: (optional) Indicates whether this will
+ become the access policy for any `pending` and future endpoint gateway
+ bindings from the same account.
+ If set to `true`:
+ - If the account has an existing access policy, that policy will be updated
+ to
+ `permit`. Otherwise, a new `permit` access policy will be created for the
+ account.
+ - All `pending` endpoint gateway bindings for the account will be
+ permitted.
+ If set to `false`:
+ - No access policies will be created or updated
+ - All `pending` endpoint gateway bindings for the account will remain
+ `pending`.
: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
+ :rtype: DetailedResponse
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
- if cron_spec is None:
- raise ValueError('cron_spec must be provided')
- if clone_policy is not None:
- clone_policy = convert_model(clone_policy)
- if deletion_trigger is not None:
- deletion_trigger = convert_model(deletion_trigger)
- if remote_region_policies is not None:
- remote_region_policies = [convert_model(x) for x in remote_region_policies]
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_backup_policy_plan',
+ operation_id='permit_private_path_service_gateway_endpoint_gateway_binding',
)
headers.update(sdk_headers)
@@ -15932,14 +16762,7 @@ def create_backup_policy_plan(
}
data = {
- 'cron_spec': cron_spec,
- 'active': active,
- 'attach_user_tags': attach_user_tags,
- 'clone_policy': clone_policy,
- 'copy_user_tags': copy_user_tags,
- 'deletion_trigger': deletion_trigger,
- 'name': name,
- 'remote_region_policies': remote_region_policies,
+ 'set_account_policy': set_account_policy,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -15948,12 +16771,11 @@ def create_backup_policy_plan(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['backup_policy_id']
- path_param_values = self.encode_path_vars(backup_policy_id)
+ path_param_keys = ['private_path_service_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/plans'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/permit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -15965,45 +16787,31 @@ def create_backup_policy_plan(
response = self.send(request, **kwargs)
return response
- def delete_backup_policy_plan(
+ def publish_private_path_service_gateway(
self,
- backup_policy_id: str,
- id: str,
- *,
- if_match: Optional[str] = None,
+ private_path_service_gateway_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a backup policy plan.
+ Publish a private path service gateway.
- 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.
+ This request publishes a private path service gateway, allowing any account to
+ request access to it.
- :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 str private_path_service_gateway_id: The private path service
+ 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 `BackupPolicyPlan` object
+ :rtype: DetailedResponse
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_backup_policy_plan',
+ operation_id='publish_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -16015,14 +16823,13 @@ def delete_backup_policy_plan(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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_keys = ['private_path_service_gateway_id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/publish'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -16031,34 +16838,40 @@ def delete_backup_policy_plan(
response = self.send(request, **kwargs)
return response
- def get_backup_policy_plan(
+ def revoke_account_for_private_path_service_gateway(
self,
- backup_policy_id: str,
- id: str,
+ private_path_service_gateway_id: str,
+ account: 'AccountIdentity',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a backup policy plan.
+ Revoke access to a private path service gateway for an account.
- This request retrieves a single backup policy plan specified by the identifier in
- the URL.
+ This request revokes a consumer account. This operation cannot be reversed. The
+ `status` of all endpoint gateway bindings associated with the specified private
+ path service gateway become `denied`. If the specified account has an existing
+ access policy, that policy will be updated to `denied`. Otherwise, a new `deny`
+ access policy will be created for the account.
- :param str backup_policy_id: The backup policy identifier.
- :param str id: The backup policy plan identifier.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
+ :param AccountIdentity account: The account that will be revoked access to
+ the private path service gateway.
: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
+ :rtype: DetailedResponse
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ if account is None:
+ raise ValueError('account must be provided')
+ account = convert_model(account)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_backup_policy_plan',
+ operation_id='revoke_account_for_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -16067,68 +16880,59 @@ def get_backup_policy_plan(
'generation': self.generation,
}
+ data = {
+ 'account': account,
+ }
+ 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'))
del kwargs['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_keys = ['private_path_service_gateway_id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/revoke_account'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_backup_policy_plan(
+ def unpublish_private_path_service_gateway(
self,
- backup_policy_id: str,
- id: str,
- backup_policy_plan_patch: 'BackupPolicyPlanPatch',
- *,
- if_match: Optional[str] = None,
+ private_path_service_gateway_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Update a backup policy plan.
+ Unpublish a private path service gateway.
- 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.
+ This request unpublishes a private path service gateway. For this request to
+ succeed, any existing access from other accounts must first be revoked. Once
+ unpublished, access will again be restricted to the account that created this
+ private path service gateway.
- :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 str private_path_service_gateway_id: The private path service
+ 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 `BackupPolicyPlan` object
+ :rtype: DetailedResponse
"""
- if not backup_policy_id:
- raise ValueError('backup_policy_id must be provided')
- if not id:
- 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,
- }
+ if not private_path_service_gateway_id:
+ raise ValueError('private_path_service_gateway_id must be provided')
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_backup_policy_plan',
+ operation_id='unpublish_private_path_service_gateway',
)
headers.update(sdk_headers)
@@ -16137,67 +16941,70 @@ def update_backup_policy_plan(
'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'))
del kwargs['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_keys = ['private_path_service_gateway_id']
+ path_param_values = self.encode_path_vars(private_path_service_gateway_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict)
+ url = '/private_path_service_gateways/{private_path_service_gateway_id}/unpublish'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_backup_policy(
+ #########################
+ # Public address ranges
+ #########################
+
+ def list_public_address_ranges(
self,
- id: str,
*,
- if_match: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a backup policy.
+ List public address ranges.
- 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.
+ This request lists [public address
+ ranges](https://cloud.ibm.com/docs/vpc?topic=vpc-about-par) in the region. A
+ public address range is a contiguous block of public IP addresses that can be
+ bound to a `target` that specifies a `vpc` and a `zone`. Incoming traffic for
+ these IP addresses will be routed according to the VPC's ingress routing table.
- :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 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 with a `resource_group.id` property matching 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 `BackupPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicAddressRangeCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_backup_policy',
+ operation_id='list_public_address_ranges',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
}
if 'headers' in kwargs:
@@ -16205,12 +17012,9 @@ def delete_backup_policy(
del kwargs['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)
+ url = '/public_address_ranges'
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -16219,30 +17023,51 @@ def delete_backup_policy(
response = self.send(request, **kwargs)
return response
- def get_backup_policy(
+ def create_public_address_range(
self,
- id: str,
+ ipv4_address_count: int,
+ *,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ target: Optional['PublicAddressRangeTargetPrototype'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a backup policy.
+ Create a public address range.
- This request retrieves a single backup policy specified by the identifier in the
- URL.
+ This request creates a new public address range from a public address range
+ prototype object. The prototype object is structured in the same way as a
+ retrieved public address range, and contains the information necessary to create
+ the new public address range.
- :param str id: The backup policy identifier.
+ :param int ipv4_address_count: The total number of public IPv4 addresses
+ required. Must be a power of 2.
+ :param str name: (optional) The name for this public address range. The
+ name must not be used by another public address range in the region. 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) will be
+ used.
+ :param PublicAddressRangeTargetPrototype target: (optional) The target to
+ bind this public address range to. If unspecified, the public address
+ range will not be bound to a target at creation.
: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
+ :rtype: DetailedResponse with `dict` result representing a `PublicAddressRange` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if ipv4_address_count is None:
+ raise ValueError('ipv4_address_count must be provided')
+ if resource_group is not None:
+ resource_group = convert_model(resource_group)
+ 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='get_backup_policy',
+ operation_id='create_public_address_range',
)
headers.update(sdk_headers)
@@ -16251,63 +17076,58 @@ def get_backup_policy(
'generation': self.generation,
}
+ data = {
+ 'ipv4_address_count': ipv4_address_count,
+ 'name': name,
+ 'resource_group': resource_group,
+ 'target': target,
+ }
+ 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'))
del kwargs['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)
+ url = '/public_address_ranges'
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def update_backup_policy(
+ def delete_public_address_range(
self,
id: str,
- backup_policy_patch: 'BackupPolicyPatch',
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a backup policy.
+ Delete a public address range.
- 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.
+ This request deletes a public address range. If the public address range is bound
+ to a
+ `target`, it will be unbound. This operation cannot be reversed.
- :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 str id: The public address range 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
+ :rtype: DetailedResponse with `dict` result representing a `PublicAddressRange` object
"""
if not id:
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,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_backup_policy',
+ operation_id='delete_public_address_range',
)
headers.update(sdk_headers)
@@ -16316,9 +17136,6 @@ def update_backup_policy(
'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'))
del kwargs['headers']
@@ -16327,46 +17144,41 @@ def update_backup_policy(
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)
+ url = '/public_address_ranges/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Geography
- #########################
-
- def list_regions(
+ def get_public_address_range(
self,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List regions.
+ Retrieve a public address range.
- This request lists regions. Each region is a separate geographic area that
- contains multiple isolated zones. Resources can be provisioned into one or more
- zones in a region. Each zone is isolated, but connected to other zones in the same
- region with low-latency and high-bandwidth links. Regions represent the top-level
- of fault isolation available. Resources deployed within a single region also
- benefit from the low latency afforded by geographic proximity.
+ This request retrieves a single public address range specified by the identifier
+ in the URL.
+ :param str id: The public address range 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 `RegionCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicAddressRange` object
"""
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_regions',
+ operation_id='get_public_address_range',
)
headers.update(sdk_headers)
@@ -16380,7 +17192,10 @@ def list_regions(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/regions'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/public_address_ranges/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -16391,29 +17206,39 @@ def list_regions(
response = self.send(request, **kwargs)
return response
- def get_region(
+ def update_public_address_range(
self,
- name: str,
+ id: str,
+ public_address_range_patch: 'PublicAddressRangePatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a region.
+ Update a public address range.
- This request retrieves a single region specified by the name in the URL.
+ This request updates a public address range with the information in a provided
+ public address range patch. The public address range patch object is structured in
+ the same way as a retrieved public address range and contains only the information
+ to be updated.
- :param str name: The region name.
+ :param str id: The public address range identifier.
+ :param PublicAddressRangePatch public_address_range_patch: The public
+ address range 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 `Region` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicAddressRange` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if public_address_range_patch is None:
+ raise ValueError('public_address_range_patch must be provided')
+ if isinstance(public_address_range_patch, PublicAddressRangePatch):
+ public_address_range_patch = convert_model(public_address_range_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_region',
+ operation_id='update_public_address_range',
)
headers.update(sdk_headers)
@@ -16422,56 +17247,74 @@ def get_region(
'generation': self.generation,
}
+ data = json.dumps(public_address_range_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/regions/{name}'.format(**path_param_dict)
+ url = '/public_address_ranges/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_region_zones(
+ #########################
+ # Public gateways
+ #########################
+
+ def list_public_gateways(
self,
- region_name: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List zones in a region.
+ List public gateways.
- This request lists zones in a region. Zones represent logically-isolated data
- centers with high-bandwidth and low-latency interconnects to other zones in the
- same region. Faults in a zone do not affect other zones.
+ This request lists public gateways in the region. A public gateway is a virtual
+ network device associated with a VPC, which allows access to the Internet. A
+ public gateway resides in a zone and can be connected to subnets in the same zone
+ only.
- :param str region_name: The region 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 with a `resource_group.id` property matching 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 `ZoneCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicGatewayCollection` object
"""
- if not region_name:
- raise ValueError('region_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_region_zones',
+ operation_id='list_public_gateways',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
}
if 'headers' in kwargs:
@@ -16479,10 +17322,7 @@ def list_region_zones(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['region_name']
- path_param_values = self.encode_path_vars(region_name)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/regions/{region_name}/zones'.format(**path_param_dict)
+ url = '/public_gateways'
request = self.prepare_request(
method='GET',
url=url,
@@ -16493,34 +17333,57 @@ def list_region_zones(
response = self.send(request, **kwargs)
return response
- def get_region_zone(
+ def create_public_gateway(
self,
- region_name: str,
- name: str,
+ vpc: 'VPCIdentity',
+ zone: 'ZoneIdentity',
+ *,
+ floating_ip: Optional['PublicGatewayFloatingIPPrototype'] = None,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a zone.
+ Create a public gateway.
- This request retrieves a single zone specified by the region and zone names in the
- URL.
+ This request creates a new public gateway from a public gateway prototype object.
+ For this to succeed, the VPC must not already have a public gateway in the
+ specified zone.
+ If a floating IP is provided, it must be unbound. If a floating IP is not
+ provided, one will be created and bound to the public gateway. Once a public
+ gateway has been created, its floating IP cannot be unbound. A public gateway must
+ be explicitly attached to each subnet it will provide connectivity for.
- :param str region_name: The region name.
- :param str name: The zone name.
+ :param VPCIdentity vpc: The VPC this public gateway will reside in.
+ :param ZoneIdentity zone: The zone this public gateway will reside in.
+ :param PublicGatewayFloatingIPPrototype floating_ip: (optional)
+ :param str name: (optional) The name for this public gateway. The name must
+ not be used by another public gateway in the VPC. 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) will be
+ 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 `Zone` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicGateway` object
"""
- if not region_name:
- raise ValueError('region_name must be provided')
- if not name:
- raise ValueError('name must be provided')
+ if vpc is None:
+ raise ValueError('vpc must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ vpc = convert_model(vpc)
+ zone = convert_model(zone)
+ if floating_ip is not None:
+ floating_ip = convert_model(floating_ip)
+ 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='get_region_zone',
+ operation_id='create_public_gateway',
)
headers.update(sdk_headers)
@@ -16529,84 +17392,78 @@ def get_region_zone(
'generation': self.generation,
}
+ data = {
+ 'vpc': vpc,
+ 'zone': zone,
+ 'floating_ip': floating_ip,
+ '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['region_name', 'name']
- path_param_values = self.encode_path_vars(region_name, name)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/regions/{region_name}/zones/{name}'.format(**path_param_dict)
+ url = '/public_gateways'
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Virtual network interfaces
- #########################
-
- def list_virtual_network_interfaces(
+ def delete_public_gateway(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List virtual network interfaces.
+ Delete a public gateway.
- This request lists virtual network interfaces in the region. A virtual network
- interface is a logical abstraction of a virtual network interface in a subnet, and
- may be attached to a target resource.
- The virtual network interfaces will be sorted by their `created_at` property
- values, with newest virtual network interfaces first. Virtual network interfaces
- with identical
- `created_at` property values will in turn be sorted by ascending `name` property
- values.
+ This request deletes a public gateway. This operation cannot be reversed. For this
+ request to succeed, the public gateway must not be attached to any subnets. The
+ public gateway's floating IP will be automatically unbound. If the floating IP was
+ created when the public gateway was created, it will be deleted.
- :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 with a `resource_group.id` property matching the specified
- identifier.
+ :param str id: The public 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 `VirtualNetworkInterfaceCollection` object
+ :rtype: DetailedResponse
"""
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_virtual_network_interfaces',
+ operation_id='delete_public_gateway',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/virtual_network_interfaces'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/public_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -16615,118 +17472,30 @@ def list_virtual_network_interfaces(
response = self.send(request, **kwargs)
return response
- def create_virtual_network_interface(
+ def get_public_gateway(
self,
- *,
- allow_ip_spoofing: Optional[bool] = None,
- auto_delete: Optional[bool] = None,
- enable_infrastructure_nat: Optional[bool] = None,
- ips: Optional[List['VirtualNetworkInterfaceIPPrototype']] = None,
- name: Optional[str] = None,
- primary_ip: Optional['VirtualNetworkInterfacePrimaryIPPrototype'] = None,
- protocol_state_filtering_mode: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
- security_groups: Optional[List['SecurityGroupIdentity']] = None,
- subnet: Optional['SubnetIdentity'] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a virtual network interface.
-
- This request creates a new virtual network interface from a virtual network
- interface prototype object. The prototype object is structured in the same way as
- a retrieved virtual network interface, and contains the information necessary to
- create the new virtual network interface.
+ Retrieve a public gateway.
- :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 auto_delete: (optional) Indicates whether this virtual network
- interface will be automatically deleted when
- `target` is deleted. Must be `false` if the virtual network interface is
- unbound.
- :param bool enable_infrastructure_nat: (optional) If `true`:
- - The VPC infrastructure performs any needed NAT operations.
- - `floating_ips` must not have more than one floating IP.
- If `false`:
- - Packets are passed unchanged to/from the virtual network interface,
- allowing the workload to perform any needed NAT operations.
- - `allow_ip_spoofing` must be `false`.
- - Can only be attached to a `target` with a `resource_type` of
- `bare_metal_server_network_attachment`.
- :param List[VirtualNetworkInterfaceIPPrototype] ips: (optional) The
- additional IP addresses to bind to the virtual network interface. Each item
- may be either a reserved IP identity, or a reserved IP prototype object
- which will be used to create a new reserved IP. All IP addresses must be in
- the primary IP's subnet.
- If reserved IP identities are provided, the specified reserved IPs must be
- unbound.
- If reserved IP prototype objects with addresses are provided, the addresses
- must be available on the virtual network interface's subnet. For any
- prototype objects that do not specify an address, an available address on
- the subnet will be automatically selected and reserved.
- :param str name: (optional) The name for this virtual network interface.
- The name must not be used by another virtual network interface in the VPC.
- If unspecified, the name will be a hyphenated list of randomly-selected
- words. Names beginning with `ibm-` are reserved for provider-owned
- resources, and are not allowed.
- :param VirtualNetworkInterfacePrimaryIPPrototype primary_ip: (optional) The
- primary IP address to bind to the virtual network interface. May be either
- a
- reserved IP identity, or a reserved IP prototype object which will be used
- to create a
- new reserved IP.
- If a reserved IP identity is provided, the specified reserved IP must be
- unbound.
- If a reserved IP prototype object with an address is provided, the address
- must be
- available on the virtual network interface's subnet. If no address is
- specified,
- an available address on the subnet will be automatically selected and
- reserved.
- :param str protocol_state_filtering_mode: (optional) The protocol state
- filtering mode to use for this virtual network interface. If
- `auto`, protocol state packet filtering is enabled or disabled based on the
- virtual network interface's `target` resource type:
- - `bare_metal_server_network_attachment`: disabled
- - `instance_network_attachment`: enabled
- - `share_mount_target`: enabled
- Protocol state filtering monitors each network connection flowing over this
- virtual network interface, and drops any packets that are invalid based on
- the current connection state and protocol. See [Protocol state filtering
- mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering)
- for more information.
- :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) will be
- used.
- :param List[SecurityGroupIdentity] security_groups: (optional) The security
- groups to use for this virtual network interface. If unspecified, the
- default security group of the VPC for the subnet is used.
- :param SubnetIdentity subnet: (optional) The associated subnet. Required if
- `primary_ip` does not specify a reserved IP
- identity.
+ This request retrieves a single public gateway specified by the identifier in the
+ URL.
+
+ :param str id: The public 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 `VirtualNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicGateway` object
"""
- if ips is not None:
- ips = [convert_model(x) for x in ips]
- if primary_ip is not None:
- primary_ip = convert_model(primary_ip)
- 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 subnet is not None:
- subnet = convert_model(subnet)
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_virtual_network_interface',
+ operation_id='get_public_gateway',
)
headers.update(sdk_headers)
@@ -16735,65 +17504,54 @@ def create_virtual_network_interface(
'generation': self.generation,
}
- data = {
- 'allow_ip_spoofing': allow_ip_spoofing,
- 'auto_delete': auto_delete,
- 'enable_infrastructure_nat': enable_infrastructure_nat,
- 'ips': ips,
- 'name': name,
- 'primary_ip': primary_ip,
- 'protocol_state_filtering_mode': protocol_state_filtering_mode,
- 'resource_group': resource_group,
- 'security_groups': security_groups,
- 'subnet': subnet,
- }
- 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/virtual_network_interfaces'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/public_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_virtual_network_interfaces(
+ def update_public_gateway(
self,
id: str,
+ public_gateway_patch: 'PublicGatewayPatch',
**kwargs,
) -> DetailedResponse:
"""
- Delete a virtual network interface.
+ Update a public gateway.
- This request deletes a virtual network interface. This operation cannot be
- reversed. For this request to succeed, the virtual network interface must not be
- required by another resource, such as the primary network attachment for an
- instance.
+ This request updates a public gateway's name.
- :param str id: The virtual network interface identifier.
+ :param str id: The public gateway identifier.
+ :param PublicGatewayPatch public_gateway_patch: The public 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 `VirtualNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicGateway` object
"""
if not id:
raise ValueError('id must be provided')
+ if public_gateway_patch is None:
+ raise ValueError('public_gateway_patch must be provided')
+ if isinstance(public_gateway_patch, PublicGatewayPatch):
+ public_gateway_patch = convert_model(public_gateway_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_virtual_network_interfaces',
+ operation_id='update_public_gateway',
)
headers.update(sdk_headers)
@@ -16802,6 +17560,9 @@ def delete_virtual_network_interfaces(
'generation': self.generation,
}
+ data = json.dumps(public_gateway_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
@@ -16810,47 +17571,83 @@ def delete_virtual_network_interfaces(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/virtual_network_interfaces/{id}'.format(**path_param_dict)
+ url = '/public_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_virtual_network_interface(
+ #########################
+ # Reservations
+ #########################
+
+ def list_reservations(
self,
- id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ name: Optional[str] = None,
+ profile_resource_type: Optional[str] = None,
+ affinity_policy: Optional[str] = None,
+ resource_group_id: Optional[str] = None,
+ zone_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a virtual network interface.
+ List reservations.
- This request retrieves a single virtual network interface specified by the
- identifier in the URL.
+ This request lists reservations in the region. A reservation provides reserved
+ capacity for a specified profile in a specified zone. A reservation can also
+ include a long-term committed use discount.
+ The reservations will be sorted by their `created_at` property values, with newest
+ reservations first. Reservations with identical `created_at` property values will
+ in turn be sorted by ascending `name` property values.
- :param str id: The virtual network interface 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 name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str profile_resource_type: (optional) Filters the collection of
+ resources with a `profile.resource_type` property matching the specified
+ value.
+ :param str affinity_policy: (optional) Filters the collection to
+ reservations with an `affinity_policy` property matching the specified
+ value.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching 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 `VirtualNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservationCollection` object
"""
- if not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_virtual_network_interface',
+ operation_id='list_reservations',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'name': name,
+ 'profile.resource_type': profile_resource_type,
+ 'affinity_policy': affinity_policy,
+ 'resource_group.id': resource_group_id,
+ 'zone.name': zone_name,
}
if 'headers' in kwargs:
@@ -16858,10 +17655,7 @@ def get_virtual_network_interface(
del kwargs['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 = '/virtual_network_interfaces/{id}'.format(**path_param_dict)
+ url = '/reservations'
request = self.prepare_request(
method='GET',
url=url,
@@ -16872,39 +17666,70 @@ def get_virtual_network_interface(
response = self.send(request, **kwargs)
return response
- def update_virtual_network_interface(
+ def create_reservation(
self,
- id: str,
- virtual_network_interface_patch: 'VirtualNetworkInterfacePatch',
+ capacity: 'ReservationCapacityPrototype',
+ committed_use: 'ReservationCommittedUsePrototype',
+ profile: 'ReservationProfilePrototype',
+ zone: 'ZoneIdentity',
+ *,
+ affinity_policy: Optional[str] = None,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a virtual network interface.
+ Create a reservation.
- This request updates a virtual network interface with the information in a
- provided virtual network interface patch. The virtual network interface patch
- object is structured in the same way as a retrieved virtual network interface and
- contains only the information to be updated.
+ This request creates a new reservation from a reservation prototype object. The
+ prototype object is structured in the same way as a retrieved reservation, and
+ contains the information necessary to create the new reservation.
- :param str id: The virtual network interface identifier.
- :param VirtualNetworkInterfacePatch virtual_network_interface_patch: The
- virtual network interface patch.
+ :param ReservationCapacityPrototype capacity: The capacity reservation
+ configuration to use.
+ :param ReservationCommittedUsePrototype committed_use: The committed use
+ configuration to use for this reservation.
+ :param ReservationProfilePrototype profile: The [instance
+ profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
+ [bare metal server
+ profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
+ to use for this reservation.
+ :param ZoneIdentity zone: The zone to use for this reservation.
+ :param str affinity_policy: (optional) The affinity policy to use for this
+ reservation:
+ - `automatic`: The reservation will be automatically selected
+ - `restricted`: The reservation must be manually requested.
+ :param str name: (optional) The name for this reservation. The name must
+ not be used by another reservation in the region. 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) will be
+ 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 `VirtualNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `Reservation` object
"""
- if not id:
- raise ValueError('id must be provided')
- if virtual_network_interface_patch is None:
- raise ValueError('virtual_network_interface_patch must be provided')
- if isinstance(virtual_network_interface_patch, VirtualNetworkInterfacePatch):
- virtual_network_interface_patch = convert_model(virtual_network_interface_patch)
+ if capacity is None:
+ raise ValueError('capacity must be provided')
+ if committed_use is None:
+ raise ValueError('committed_use must be provided')
+ if profile is None:
+ raise ValueError('profile must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ capacity = convert_model(capacity)
+ committed_use = convert_model(committed_use)
+ profile = convert_model(profile)
+ zone = convert_model(zone)
+ 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='update_virtual_network_interface',
+ operation_id='create_reservation',
)
headers.update(sdk_headers)
@@ -16913,20 +17738,27 @@ def update_virtual_network_interface(
'generation': self.generation,
}
- data = json.dumps(virtual_network_interface_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = {
+ 'capacity': capacity,
+ 'committed_use': committed_use,
+ 'profile': profile,
+ 'zone': zone,
+ 'affinity_policy': affinity_policy,
+ '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'))
del kwargs['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 = '/virtual_network_interfaces/{id}'.format(**path_param_dict)
+ url = '/reservations'
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -16936,51 +17768,36 @@ def update_virtual_network_interface(
response = self.send(request, **kwargs)
return response
- def list_network_interface_floating_ips(
+ def delete_reservation(
self,
- virtual_network_interface_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- sort: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List floating IPs associated with a virtual network interface.
+ Delete a reservation.
- This request lists floating IPs associated with a virtual network interface.
+ This request deletes a reservation. This operation cannot be reversed.
+ Reservations with a `status` of `active` are not allowed to be deleted.
- :param str virtual_network_interface_id: The virtual network interface
- 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
- `-name` sorts the collection by the `name` property in descending order,
- and the value `name` sorts it by the `name` property in ascending order.
+ :param str id: The reservation 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 `FloatingIPCollectionVirtualNetworkInterfaceContext` object
+ :rtype: DetailedResponse with `dict` result representing a `Reservation` object
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_network_interface_floating_ips',
+ operation_id='delete_reservation',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'sort': sort,
}
if 'headers' in kwargs:
@@ -16988,12 +17805,12 @@ def list_network_interface_floating_ips(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id']
- path_param_values = self.encode_path_vars(virtual_network_interface_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 = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips'.format(**path_param_dict)
+ url = '/reservations/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -17002,35 +17819,29 @@ def list_network_interface_floating_ips(
response = self.send(request, **kwargs)
return response
- def remove_network_interface_floating_ip(
+ def get_reservation(
self,
- virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Disassociate a floating IP from a virtual network interface.
+ Retrieve a reservation.
- This request disassociates the specified floating IP from the specified virtual
- network interface.
+ This request retrieves a single reservation specified by identifier in the URL.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
- :param str id: The floating IP identifier.
+ :param str id: The reservation 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 `Reservation` object
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='remove_network_interface_floating_ip',
+ operation_id='get_reservation',
)
headers.update(sdk_headers)
@@ -17042,13 +17853,14 @@ def remove_network_interface_floating_ip(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id', 'id']
- path_param_values = self.encode_path_vars(virtual_network_interface_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 = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/reservations/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -17057,35 +17869,37 @@ def remove_network_interface_floating_ip(
response = self.send(request, **kwargs)
return response
- def get_network_interface_floating_ip(
+ def update_reservation(
self,
- virtual_network_interface_id: str,
id: str,
+ reservation_patch: 'ReservationPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve associated floating IP.
+ Update a reservation.
- This request retrieves a specified floating IP if it is associated with the
- virtual network interface specified in the URL.
+ This request updates a reservation with the information provided in a reservation
+ patch object. The patch object is structured in the same way as a retrieved
+ reservation and needs to contain only the information to be updated.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
- :param str id: The floating IP identifier.
+ :param str id: The reservation identifier.
+ :param ReservationPatch reservation_patch: The reservation 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 `FloatingIPReference` object
+ :rtype: DetailedResponse with `dict` result representing a `Reservation` object
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if reservation_patch is None:
+ raise ValueError('reservation_patch must be provided')
+ if isinstance(reservation_patch, ReservationPatch):
+ reservation_patch = convert_model(reservation_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_network_interface_floating_ip',
+ operation_id='update_reservation',
)
headers.update(sdk_headers)
@@ -17094,66 +17908,53 @@ def get_network_interface_floating_ip(
'generation': self.generation,
}
+ data = json.dumps(reservation_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id', 'id']
- path_param_values = self.encode_path_vars(virtual_network_interface_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 = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/reservations/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def add_network_interface_floating_ip(
+ def activate_reservation(
self,
- virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Add an association between a floating IP and a virtual network interface.
+ Activate a reservation.
- This request adds an association between the specified floating IP and the
- specified virtual network interface.
- If the virtual network interface has `enable_infrastructure_nat` set to `true`, no
- more than one floating IP can be associated, and network address translation is
- performed between the floating IP address and the virtual network interface's
- `primary_ip` address.
- If the virtual network interface has `enable_infrastructure_nat` set to `false`,
- packets are passed unchanged to/from the virtual network interface.
- The floating IP must:
- - be in the same `zone` as the virtual network interface
- - not currently be associated with another resource
- The virtual network interface's `target` must not currently be a file share mount
- target.
- A request body is not required, and if provided, is ignored.
+ This request activates a reservation. For this request to succeed, the reservation
+ status must be `inactive`.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
- :param str id: The floating IP identifier.
+ :param str id: The reservation 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 `FloatingIPReference` object
+ :rtype: DetailedResponse
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='add_network_interface_floating_ip',
+ operation_id='activate_reservation',
)
headers.update(sdk_headers)
@@ -17165,14 +17966,13 @@ def add_network_interface_floating_ip(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id', 'id']
- path_param_values = self.encode_path_vars(virtual_network_interface_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 = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
+ url = '/reservations/{id}/activate'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -17181,42 +17981,52 @@ def add_network_interface_floating_ip(
response = self.send(request, **kwargs)
return response
- def list_virtual_network_interface_ips(
+ #########################
+ # Security groups
+ #########################
+
+ def list_security_groups(
self,
- virtual_network_interface_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
- sort: Optional[str] = None,
+ resource_group_id: Optional[str] = None,
+ vpc_id: Optional[str] = None,
+ vpc_crn: Optional[str] = None,
+ vpc_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List reserved IPs bound to a virtual network interface.
+ List security groups.
- This request lists reserved IPs bound to a virtual network interface.
+ This request lists security groups in the region. A security group defines a set
+ of packet filtering rules to allow traffic in and out of the resources targeted by
+ the security group. No traffic is allowed by default. Security group rules are
+ stateful so that reverse traffic in response to allowed traffic is automatically
+ allowed.
- :param str virtual_network_interface_id: The virtual network interface
- 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
- `-name` sorts the collection by the `name` property in descending order,
- and the value `name` sorts it by the `name` property in ascending order.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching 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 `ReservedIPCollectionVirtualNetworkInterfaceContext` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupCollection` object
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_virtual_network_interface_ips',
+ operation_id='list_security_groups',
)
headers.update(sdk_headers)
@@ -17225,7 +18035,10 @@ def list_virtual_network_interface_ips(
'generation': self.generation,
'start': start,
'limit': limit,
- 'sort': sort,
+ 'resource_group.id': resource_group_id,
+ 'vpc.id': vpc_id,
+ 'vpc.crn': vpc_crn,
+ 'vpc.name': vpc_name,
}
if 'headers' in kwargs:
@@ -17233,10 +18046,7 @@ def list_virtual_network_interface_ips(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id']
- path_param_values = self.encode_path_vars(virtual_network_interface_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/virtual_network_interfaces/{virtual_network_interface_id}/ips'.format(**path_param_dict)
+ url = '/security_groups'
request = self.prepare_request(
method='GET',
url=url,
@@ -17247,37 +18057,53 @@ def list_virtual_network_interface_ips(
response = self.send(request, **kwargs)
return response
- def remove_virtual_network_interface_ip(
+ def create_security_group(
self,
- virtual_network_interface_id: str,
- id: str,
+ vpc: 'VPCIdentity',
+ *,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
+ rules: Optional[List['SecurityGroupRulePrototype']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Unbind a reserved IP from a virtual network interface.
+ Create a security group.
- This request unbinds the specified reserved IP from the specified virtual network
- interface. If the reserved IP has `auto_delete` set to `true`, the reserved IP
- will be deleted.
- The reserved IP for the `primary_ip` cannot be unbound.
+ This request creates a new security group from a security group prototype object.
+ The prototype object is structured in the same way as a retrieved security group,
+ and contains the information necessary to create the new security group. If
+ security group rules are included in the prototype object, those rules will be
+ added to the security group. Each security group is scoped to one VPC. Only
+ resources in that VPC can be added to the security group.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
- :param str id: The reserved IP identifier.
+ :param VPCIdentity vpc: The VPC this security group will reside in.
+ :param str name: (optional) The name for this security group. The name must
+ not be used by another security group for the VPC. 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) will be
+ used.
+ :param List[SecurityGroupRulePrototype] rules: (optional) The prototype
+ objects for rules to be created for this security group. If unspecified, no
+ rules will be created, resulting in no traffic being allowed.
: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 `SecurityGroup` object
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if vpc is None:
+ raise ValueError('vpc must be provided')
+ vpc = convert_model(vpc)
+ if resource_group is not None:
+ resource_group = convert_model(resource_group)
+ if rules is not None:
+ rules = [convert_model(x) for x in rules]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='remove_virtual_network_interface_ip',
+ operation_id='create_security_group',
)
headers.update(sdk_headers)
@@ -17286,53 +18112,58 @@ def remove_virtual_network_interface_ip(
'generation': self.generation,
}
+ data = {
+ 'vpc': vpc,
+ 'name': name,
+ 'resource_group': resource_group,
+ 'rules': rules,
+ }
+ 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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id', 'id']
- path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}'.format(**path_param_dict)
+ url = '/security_groups'
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_virtual_network_interface_ip(
+ def delete_security_group(
self,
- virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve bound reserved IP.
+ Delete a security group.
- This request retrieves the specified reserved IP address if it is bound to the
- virtual network interface specified in the URL.
+ This request deletes a security group. A security group cannot be deleted if it is
+ referenced by any security group targets or rules. Additionally, a VPC's default
+ security group cannot be deleted. This operation cannot be reversed.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
- :param str id: The reserved IP identifier.
+ :param str id: The security group 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 `ReservedIPReference` object
+ :rtype: DetailedResponse
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_virtual_network_interface_ip',
+ operation_id='delete_security_group',
)
headers.update(sdk_headers)
@@ -17344,14 +18175,13 @@ def get_virtual_network_interface_ip(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id', 'id']
- path_param_values = self.encode_path_vars(virtual_network_interface_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 = '/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}'.format(**path_param_dict)
+ url = '/security_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -17360,38 +18190,30 @@ def get_virtual_network_interface_ip(
response = self.send(request, **kwargs)
return response
- def add_virtual_network_interface_ip(
+ def get_security_group(
self,
- virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Bind a reserved IP to a virtual network interface.
+ Retrieve a security group.
- This request binds the specified reserved IP to the specified virtual network
- interface.
- The reserved IP must currently be unbound and in the primary IP's subnet. The
- virtual network interface's `target` must not currently be a file share mount
- target.
+ This request retrieves a single security group specified by the identifier in the
+ URL path.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
- :param str id: The reserved IP identifier.
+ :param str id: The security group 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 `ReservedIPReference` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroup` object
"""
- if not virtual_network_interface_id:
- raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='add_virtual_network_interface_ip',
+ operation_id='get_security_group',
)
headers.update(sdk_headers)
@@ -17405,12 +18227,12 @@ def add_virtual_network_interface_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['virtual_network_interface_id', 'id']
- path_param_values = self.encode_path_vars(virtual_network_interface_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 = '/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}'.format(**path_param_dict)
+ url = '/security_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -17419,87 +18241,93 @@ def add_virtual_network_interface_ip(
response = self.send(request, **kwargs)
return response
- #########################
- # Cluster networks
- #########################
-
- def list_cluster_network_profiles(
+ def update_security_group(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ id: str,
+ security_group_patch: 'SecurityGroupPatch',
**kwargs,
) -> DetailedResponse:
"""
- List cluster network profiles.
+ Update a security group.
- This request lists cluster network profiles available in the region. A cluster
- network profile specifies the performance characteristics and capabilities for a
- cluster network.
+ This request updates a security group with the information provided in a security
+ group patch object. The security group patch object is structured in the same way
+ as a retrieved security group and contains only the information to be updated.
- :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 id: The security group identifier.
+ :param SecurityGroupPatch security_group_patch: The security group 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 `ClusterNetworkProfileCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroup` object
"""
+ if not id:
+ raise ValueError('id must be provided')
+ if security_group_patch is None:
+ raise ValueError('security_group_patch must be provided')
+ if isinstance(security_group_patch, SecurityGroupPatch):
+ security_group_patch = convert_model(security_group_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_cluster_network_profiles',
+ operation_id='update_security_group',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
+ data = json.dumps(security_group_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/cluster_network/profiles'
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/security_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_cluster_network_profile(
+ def list_security_group_rules(
self,
- name: str,
+ security_group_id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a cluster network profile.
+ List rules in a security group.
- This request retrieves a single cluster network profile specified by the name in
- the URL.
+ This request lists rules in a security group. These rules define what traffic the
+ security group permits. Security group rules are stateful, such that reverse
+ traffic in response to allowed traffic is automatically permitted.
- :param str name: The cluster network profile name.
+ :param str security_group_id: The security group 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 `ClusterNetworkProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupRuleCollection` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_cluster_network_profile',
+ operation_id='list_security_group_rules',
)
headers.update(sdk_headers)
@@ -17513,10 +18341,10 @@ def get_cluster_network_profile(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ path_param_keys = ['security_group_id']
+ path_param_values = self.encode_path_vars(security_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_network/profiles/{name}'.format(**path_param_dict)
+ url = '/security_groups/{security_group_id}/rules'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -17527,146 +18355,104 @@ def get_cluster_network_profile(
response = self.send(request, **kwargs)
return response
- def list_cluster_networks(
+ def create_security_group_rule(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- sort: Optional[str] = None,
- vpc_id: Optional[str] = None,
- vpc_crn: Optional[str] = None,
- vpc_name: Optional[str] = None,
+ security_group_id: str,
+ security_group_rule_prototype: 'SecurityGroupRulePrototype',
**kwargs,
) -> DetailedResponse:
"""
- List cluster networks.
+ Create a rule for a security group.
- This request lists [cluster
- networks](https://cloud.ibm.com/docs/vpc?topic=vpc-about-cluster-network) in the
- region. A cluster network is a grouping of resources in a separate networking
- space for high performance computing and networking.
+ This request creates a new security group rule from a security group rule
+ prototype object. The prototype object is structured in the same way as a
+ retrieved security group rule and contains the information necessary to create the
+ rule. As part of creating a new rule in a security group, the rule is applied to
+ all the networking interfaces in the security group. Rules specify which IP
+ traffic a security group will allow. Security group rules are stateful, such that
+ reverse traffic in response to allowed traffic is automatically permitted. A rule
+ allowing inbound TCP traffic on port 80 also allows outbound TCP traffic on port
+ 80 without the need for an additional rule.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :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 str vpc_id: (optional) Filters the collection to cluster networks
- with a `vpc.id` property matching the specified id.
- :param str vpc_crn: (optional) Filters the collection to cluster networks
- with a `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to cluster networks
- with a `vpc.name` property matching the specified name.
+ :param str security_group_id: The security group identifier.
+ :param SecurityGroupRulePrototype security_group_rule_prototype: The
+ properties of the security group rule to be created.
: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 `ClusterNetworkCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupRule` object
"""
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
+ if security_group_rule_prototype is None:
+ raise ValueError('security_group_rule_prototype must be provided')
+ if isinstance(security_group_rule_prototype, SecurityGroupRulePrototype):
+ security_group_rule_prototype = convert_model(security_group_rule_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_cluster_networks',
+ operation_id='create_security_group_rule',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
- 'name': name,
- 'sort': sort,
- 'vpc.id': vpc_id,
- 'vpc.crn': vpc_crn,
- 'vpc.name': vpc_name,
}
+ data = json.dumps(security_group_rule_prototype)
+ headers['content-type'] = 'application/json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/cluster_networks'
+ path_param_keys = ['security_group_id']
+ path_param_values = self.encode_path_vars(security_group_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/security_groups/{security_group_id}/rules'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_cluster_network(
+ def delete_security_group_rule(
self,
- profile: 'ClusterNetworkProfileIdentity',
- vpc: 'VPCIdentity',
- zone: 'ZoneIdentity',
- *,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
- subnet_prefixes: Optional[List['ClusterNetworkSubnetPrefixPrototype']] = None,
+ security_group_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a cluster network.
+ Delete a security group rule.
- This request creates a new cluster network from a cluster network prototype
- object. The prototype object is structured in the same way as a retrieved cluster
- network, and contains the information necessary to create the new cluster network.
+ This request deletes a security group rule. This operation cannot be reversed.
+ Removing a security group rule will not end existing connections allowed by that
+ rule.
- :param ClusterNetworkProfileIdentity profile: The profile to use for this
- cluster network.
- :param VPCIdentity vpc: The VPC this cluster network will reside in.
- :param ZoneIdentity zone: The zone this cluster network will reside in. The
- zone must be listed
- as supported on the specified cluster network profile.
- :param str name: (optional) The name for this cluster network. The name
- must not be used by another cluster network in the region. Names starting
- with `ibm-` are reserved for provider-owned resources, and 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) will be
- used.
- :param List[ClusterNetworkSubnetPrefixPrototype] subnet_prefixes:
- (optional)
+ :param str security_group_id: The security group 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 `ClusterNetwork` object
+ :rtype: DetailedResponse
"""
- if profile is None:
- raise ValueError('profile must be provided')
- if vpc is None:
- raise ValueError('vpc must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- profile = convert_model(profile)
- vpc = convert_model(vpc)
- zone = convert_model(zone)
- if resource_group is not None:
- resource_group = convert_model(resource_group)
- if subnet_prefixes is not None:
- subnet_prefixes = [convert_model(x) for x in subnet_prefixes]
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_cluster_network',
+ operation_id='delete_security_group_rule',
)
headers.update(sdk_headers)
@@ -17675,90 +18461,58 @@ def create_cluster_network(
'generation': self.generation,
}
- data = {
- 'profile': profile,
- 'vpc': vpc,
- 'zone': zone,
- 'name': name,
- 'resource_group': resource_group,
- 'subnet_prefixes': subnet_prefixes,
- }
- 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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/cluster_networks'
+ path_param_keys = ['security_group_id', 'id']
+ path_param_values = self.encode_path_vars(security_group_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/security_groups/{security_group_id}/rules/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_cluster_network_interfaces(
+ def get_security_group_rule(
self,
- cluster_network_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- name: Optional[str] = None,
- sort: Optional[str] = None,
+ security_group_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List cluster network interfaces.
+ Retrieve a security group rule.
- This request lists cluster network interfaces in the region. A cluster network
- interface is a logical abstraction of a cluster network interface in a subnet, and
- may be attached to a target resource.
- The cluster network interfaces will be sorted by their `created_at` property
- values, with newest cluster network interfaces first. Cluster network interfaces
- with identical
- `created_at` property values will in turn be sorted by ascending `name` property
- values.
+ This request retrieves a single security group rule specified by the identifier in
+ the URL path.
- :param str cluster_network_id: The cluster network 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 name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :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 str security_group_id: The security group 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 `ClusterNetworkInterfaceCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupRule` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_cluster_network_interfaces',
+ operation_id='get_security_group_rule',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'name': name,
- 'sort': sort,
}
if 'headers' in kwargs:
@@ -17766,10 +18520,10 @@ def list_cluster_network_interfaces(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id']
- path_param_values = self.encode_path_vars(cluster_network_id)
+ path_param_keys = ['security_group_id', 'id']
+ path_param_values = self.encode_path_vars(security_group_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/interfaces'.format(**path_param_dict)
+ url = '/security_groups/{security_group_id}/rules/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -17780,64 +18534,43 @@ def list_cluster_network_interfaces(
response = self.send(request, **kwargs)
return response
- def create_cluster_network_interface(
+ def update_security_group_rule(
self,
- cluster_network_id: str,
- *,
- name: Optional[str] = None,
- primary_ip: Optional['ClusterNetworkInterfacePrimaryIPPrototype'] = None,
- subnet: Optional['ClusterNetworkSubnetIdentity'] = None,
+ security_group_id: str,
+ id: str,
+ security_group_rule_patch: 'SecurityGroupRulePatch',
**kwargs,
) -> DetailedResponse:
"""
- Create a cluster network interface.
+ Update a security group rule.
- This request creates a new cluster network interface from a cluster network
- interface prototype object. The prototype object is structured in the same way as
- a retrieved cluster network interface, and contains the information necessary to
- create the new cluster network interface.
+ This request updates a security group rule with the information in a provided rule
+ patch object. The rule patch object contains only the information to be updated.
+ The request will fail if the provided patch includes properties that are not used
+ by the rule's protocol.
- :param str cluster_network_id: The cluster network identifier.
- :param str name: (optional) The name for this cluster network interface.
- The name must not be used by another interface in the cluster network.
- Names beginning with `ibm-` are reserved for provider-owned resources, and
- are not allowed. If unspecified, the name will be a hyphenated list of
- randomly-selected words.
- :param ClusterNetworkInterfacePrimaryIPPrototype primary_ip: (optional) The
- primary IP address to bind to the cluster network interface. May be either
- a cluster network subnet reserved IP identity, or a cluster network subnet
- reserved IP
- prototype object which will be used to create a new cluster network subnet
- reserved IP.
- If a cluster network subnet reserved IP identity is provided, the specified
- cluster
- network subnet reserved IP must be unbound.
- If a cluster network subnet reserved IP prototype object with an address is
- provided,
- the address must be available on the cluster network interface's cluster
- network
- subnet. If no address is specified, an available address on the cluster
- network subnet
- will be automatically selected and reserved.
- :param ClusterNetworkSubnetIdentity subnet: (optional) The associated
- cluster network subnet. Required if `primary_ip` does not specify a cluster
- network subnet reserved IP identity.
+ :param str security_group_id: The security group identifier.
+ :param str id: The rule identifier.
+ :param SecurityGroupRulePatch security_group_rule_patch: The security group
+ 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 `ClusterNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupRule` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if primary_ip is not None:
- primary_ip = convert_model(primary_ip)
- if subnet is not None:
- subnet = convert_model(subnet)
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if security_group_rule_patch is None:
+ raise ValueError('security_group_rule_patch must be provided')
+ if isinstance(security_group_rule_patch, SecurityGroupRulePatch):
+ security_group_rule_patch = convert_model(security_group_rule_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_cluster_network_interface',
+ operation_id='update_security_group_rule',
)
headers.update(sdk_headers)
@@ -17846,26 +18579,20 @@ def create_cluster_network_interface(
'generation': self.generation,
}
- data = {
- 'name': name,
- 'primary_ip': primary_ip,
- 'subnet': subnet,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
- headers['content-type'] = 'application/json'
+ data = json.dumps(security_group_rule_patch)
+ headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id']
- path_param_values = self.encode_path_vars(cluster_network_id)
+ path_param_keys = ['security_group_id', 'id']
+ path_param_values = self.encode_path_vars(security_group_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/interfaces'.format(**path_param_dict)
+ url = '/security_groups/{security_group_id}/rules/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PATCH',
url=url,
headers=headers,
params=params,
@@ -17875,48 +18602,44 @@ def create_cluster_network_interface(
response = self.send(request, **kwargs)
return response
- def delete_cluster_network_interface(
+ def list_security_group_targets(
self,
- cluster_network_id: str,
- id: str,
+ security_group_id: str,
*,
- if_match: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a cluster network interface.
+ List targets associated with a security group.
- This request deletes a cluster network interface. This operation cannot be
- reversed. For this request to succeed, the cluster network interface must not be
- required by another resource, such as a cluster network attachment for a virtual
- server instance.
+ This request lists targets associated with a security group, to which the rules in
+ the security group are applied.
- :param str cluster_network_id: The cluster network identifier.
- :param str id: The cluster network interface 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 str security_group_id: The security group 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 `ClusterNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupTargetCollection` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_cluster_network_interface',
+ operation_id='list_security_group_targets',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -17924,10 +18647,73 @@ def delete_cluster_network_interface(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, id)
+ path_param_keys = ['security_group_id']
+ path_param_values = self.encode_path_vars(security_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/interfaces/{id}'.format(**path_param_dict)
+ url = '/security_groups/{security_group_id}/targets'.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_security_group_target_binding(
+ self,
+ security_group_id: str,
+ id: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Remove a target from a security group.
+
+ This request removes a target from a security group. For this request to succeed,
+ the target must be attached to at least one other security group. The specified
+ target identifier can be:
+ - A bare metal server network interface identifier
+ - A virtual network interface identifier
+ - A VPN server identifier
+ - A load balancer identifier
+ - An endpoint gateway identifier
+ - An instance network interface identifier
+ Security groups are stateful, so any changes to a target's security groups are
+ applied to new connections. Existing connections are not affected.
+
+ :param str security_group_id: The security group identifier.
+ :param str id: The security group target identifier.
+ :param dict headers: A `dict` containing the request headers
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
+ :rtype: DetailedResponse
+ """
+
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='delete_security_group_target_binding',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+
+ path_param_keys = ['security_group_id', 'id']
+ path_param_values = self.encode_path_vars(security_group_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/security_groups/{security_group_id}/targets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -17938,34 +18724,34 @@ def delete_cluster_network_interface(
response = self.send(request, **kwargs)
return response
- def get_cluster_network_interface(
+ def get_security_group_target(
self,
- cluster_network_id: str,
+ security_group_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a cluster network interface.
+ Retrieve a security group target.
- This request retrieves a single cluster network interface specified by the
- identifier in the URL.
+ This request retrieves a single target specified by the identifier in the URL
+ path. The target must be an existing target of the security group.
- :param str cluster_network_id: The cluster network identifier.
- :param str id: The cluster network interface identifier.
+ :param str security_group_id: The security group identifier.
+ :param str id: The security group target 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 `ClusterNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupTargetReference` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_cluster_network_interface',
+ operation_id='get_security_group_target',
)
headers.update(sdk_headers)
@@ -17979,10 +18765,10 @@ def get_cluster_network_interface(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, id)
+ path_param_keys = ['security_group_id', 'id']
+ path_param_values = self.encode_path_vars(security_group_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/interfaces/{id}'.format(**path_param_dict)
+ url = '/security_groups/{security_group_id}/targets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -17993,50 +18779,42 @@ def get_cluster_network_interface(
response = self.send(request, **kwargs)
return response
- def update_cluster_network_interface(
+ def create_security_group_target_binding(
self,
- cluster_network_id: str,
+ security_group_id: str,
id: str,
- cluster_network_interface_patch: 'ClusterNetworkInterfacePatch',
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a cluster network interface.
+ Add a target to a security group.
- This request updates a cluster network interface with the information provided in
- a cluster network interface patch object. The patch object is structured in the
- same way as a retrieved cluster network interface and needs to contain only the
- information to be updated.
+ This request adds a resource to an existing security group. The specified target
+ identifier can be:
+ - A bare metal server network interface identifier
+ - A virtual network interface identifier
+ - A VPN server identifier
+ - A load balancer identifier
+ - An endpoint gateway identifier
+ - An instance network interface identifier
+ When a target is added to a security group, the security group rules are applied
+ to the target. A request body is not required, and if provided, is ignored.
- :param str cluster_network_id: The cluster network identifier.
- :param str id: The cluster network interface identifier.
- :param ClusterNetworkInterfacePatch cluster_network_interface_patch: The
- cluster network interface 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 str security_group_id: The security group identifier.
+ :param str id: The security group target 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 `ClusterNetworkInterface` object
+ :rtype: DetailedResponse with `dict` result representing a `SecurityGroupTargetReference` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
+ if not security_group_id:
+ raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
- if cluster_network_interface_patch is None:
- raise ValueError('cluster_network_interface_patch must be provided')
- if isinstance(cluster_network_interface_patch, ClusterNetworkInterfacePatch):
- cluster_network_interface_patch = convert_model(cluster_network_interface_patch)
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_cluster_network_interface',
+ operation_id='create_security_group_target_binding',
)
headers.update(sdk_headers)
@@ -18045,52 +18823,48 @@ def update_cluster_network_interface(
'generation': self.generation,
}
- data = json.dumps(cluster_network_interface_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, id)
+ path_param_keys = ['security_group_id', 'id']
+ path_param_values = self.encode_path_vars(security_group_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/interfaces/{id}'.format(**path_param_dict)
+ url = '/security_groups/{security_group_id}/targets/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_cluster_network_subnets(
+ #########################
+ # Shares
+ #########################
+
+ def list_share_profiles(
self,
- cluster_network_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
- name: Optional[str] = None,
sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List cluster network subnets.
+ List file share profiles.
- This request lists cluster network subnets in the cluster network. A cluster
- network subnet provides network routing between other cluster network subnets
- within a cluster network.
+ This request lists [file share
+ profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles)
+ available in the region. A file share profile specifies the performance
+ characteristics and pricing model for a file share.
- :param str cluster_network_id: The cluster network 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 name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
: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
@@ -18098,16 +18872,14 @@ def list_cluster_network_subnets(
`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 `ClusterNetworkSubnetCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareProfileCollection` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_cluster_network_subnets',
+ operation_id='list_share_profiles',
)
headers.update(sdk_headers)
@@ -18116,7 +18888,6 @@ def list_cluster_network_subnets(
'generation': self.generation,
'start': start,
'limit': limit,
- 'name': name,
'sort': sort,
}
@@ -18125,10 +18896,7 @@ def list_cluster_network_subnets(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id']
- path_param_values = self.encode_path_vars(cluster_network_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/subnets'.format(**path_param_dict)
+ url = '/share/profiles'
request = self.prepare_request(
method='GET',
url=url,
@@ -18139,39 +18907,30 @@ def list_cluster_network_subnets(
response = self.send(request, **kwargs)
return response
- def create_cluster_network_subnet(
+ def get_share_profile(
self,
- cluster_network_id: str,
- cluster_network_subnet_prototype: 'ClusterNetworkSubnetPrototype',
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a cluster network subnet.
+ Retrieve a file share profile.
- This request creates a new cluster network subnet from a cluster network subnet
- prototype object. The prototype object is structured in the same way as a
- retrieved cluster network subnet, and contains the information necessary to create
- the new cluster network subnet.
+ This request retrieves a single file share profile specified by the name in the
+ URL.
- :param str cluster_network_id: The cluster network identifier.
- :param ClusterNetworkSubnetPrototype cluster_network_subnet_prototype: The
- cluster network subnet prototype object.
+ :param str name: The file share 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 `ClusterNetworkSubnet` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareProfile` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if cluster_network_subnet_prototype is None:
- raise ValueError('cluster_network_subnet_prototype must be provided')
- if isinstance(cluster_network_subnet_prototype, ClusterNetworkSubnetPrototype):
- cluster_network_subnet_prototype = convert_model(cluster_network_subnet_prototype)
+ if not name:
+ raise ValueError('name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_cluster_network_subnet',
+ operation_id='get_share_profile',
)
headers.update(sdk_headers)
@@ -18180,51 +18939,47 @@ def create_cluster_network_subnet(
'generation': self.generation,
}
- data = json.dumps(cluster_network_subnet_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id']
- path_param_values = self.encode_path_vars(cluster_network_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 = '/cluster_networks/{cluster_network_id}/subnets'.format(**path_param_dict)
+ url = '/share/profiles/{name}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_cluster_network_subnet_reserved_ips(
+ def list_shares(
self,
- cluster_network_id: str,
- cluster_network_subnet_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
name: Optional[str] = None,
sort: Optional[str] = None,
+ replication_role: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List cluster network subnet reserved IPs.
+ List file shares.
- This request lists cluster network subnet reserved IPs in the cluster network.
+ This request lists file shares in the region.
- :param str cluster_network_id: The cluster network identifier.
- :param str cluster_network_subnet_id: The cluster network subnet
- 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 resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
:param str sort: (optional) Sorts the returned collection by the specified
@@ -18232,20 +18987,18 @@ def list_cluster_network_subnet_reserved_ips(
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 replication_role: (optional) Filters the collection to file
+ shares with a `replication_role` property matching the specified 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 `ClusterNetworkSubnetReservedIPCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareCollection` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not cluster_network_subnet_id:
- raise ValueError('cluster_network_subnet_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_cluster_network_subnet_reserved_ips',
+ operation_id='list_shares',
)
headers.update(sdk_headers)
@@ -18254,8 +19007,10 @@ def list_cluster_network_subnet_reserved_ips(
'generation': self.generation,
'start': start,
'limit': limit,
+ 'resource_group.id': resource_group_id,
'name': name,
'sort': sort,
+ 'replication_role': replication_role,
}
if 'headers' in kwargs:
@@ -18263,10 +19018,7 @@ def list_cluster_network_subnet_reserved_ips(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id']
- path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips'.format(**path_param_dict)
+ url = '/shares'
request = self.prepare_request(
method='GET',
url=url,
@@ -18277,49 +19029,35 @@ def list_cluster_network_subnet_reserved_ips(
response = self.send(request, **kwargs)
return response
- def create_cluster_network_subnet_reserved_ip(
+ def create_share(
self,
- cluster_network_id: str,
- cluster_network_subnet_id: str,
- *,
- address: Optional[str] = None,
- name: Optional[str] = None,
+ share_prototype: 'SharePrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a cluster network subnet reserved IP.
+ Create a file share.
- This request creates a new cluster network subnet reserved IP from a cluster
- network subnet reserved IP prototype object. The prototype object is structured in
- the same way as a retrieved cluster network subnet reserved IP, and contains the
- information necessary to create the new cluster network subnet reserved IP.
+ This request provisions new file shares from a share prototype object. The new
+ file shares can be a standalone share, a replica share, or both a source and
+ replica share.
+ The prototype object is structured in the same way as a retrieved share, and
+ contains the information necessary to provision the new file shares.
- :param str cluster_network_id: The cluster network identifier.
- :param str cluster_network_subnet_id: The cluster network subnet
- identifier.
- :param str address: (optional) The IP address to reserve, which must not
- already be reserved on the subnet.
- If unspecified, an available address on the subnet will automatically be
- selected.
- :param str name: (optional) The name for this cluster network subnet
- reserved IP. The name must not be used by another reserved IP in the
- cluster network subnet. Names starting with `ibm-` are reserved for
- provider-owned resources, and are not allowed. If unspecified, the name
- will be a hyphenated list of randomly-selected words.
+ :param SharePrototype share_prototype: The file share prototype object.
: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 `ClusterNetworkSubnetReservedIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Share` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not cluster_network_subnet_id:
- raise ValueError('cluster_network_subnet_id must be provided')
+ if share_prototype is None:
+ raise ValueError('share_prototype must be provided')
+ if isinstance(share_prototype, SharePrototype):
+ share_prototype = convert_model(share_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_cluster_network_subnet_reserved_ip',
+ operation_id='create_share',
)
headers.update(sdk_headers)
@@ -18328,12 +19066,7 @@ def create_cluster_network_subnet_reserved_ip(
'generation': self.generation,
}
- data = {
- 'address': address,
- 'name': name,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(share_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -18341,10 +19074,7 @@ def create_cluster_network_subnet_reserved_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id']
- path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips'.format(**path_param_dict)
+ url = '/shares'
request = self.prepare_request(
method='POST',
url=url,
@@ -18356,38 +19086,32 @@ def create_cluster_network_subnet_reserved_ip(
response = self.send(request, **kwargs)
return response
- def delete_cluster_network_subnet_reserved_ip(
+ def delete_share(
self,
- cluster_network_id: str,
- cluster_network_subnet_id: str,
id: str,
*,
if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a cluster network subnet reserved IP.
+ Delete a file share.
- This request deletes a cluster network subnet reserved IP. This operation cannot
- be reversed.
- For this request to succeed, the reserved IP must be unbound. A provider-owned
- reserved IP is not allowed to be deleted.
+ This request deletes a share. This operation cannot be reversed. A share cannot be
+ deleted if it:
+ - has share mount targets
+ - has a `lifecycle_state` of `updating`
+ - has a replication operation in progress
+ If the request is accepted, the share `lifecycle_state` will be set to `deleting`.
+ Once deletion processing completes, it will no longer be retrievable.
- :param str cluster_network_id: The cluster network identifier.
- :param str cluster_network_subnet_id: The cluster network subnet
- identifier.
- :param str id: The cluster network subnet reserved IP identifier.
+ :param str id: The file share 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 `ClusterNetworkSubnetReservedIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Share` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not cluster_network_subnet_id:
- raise ValueError('cluster_network_subnet_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {
@@ -18396,7 +19120,7 @@ def delete_cluster_network_subnet_reserved_ip(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_cluster_network_subnet_reserved_ip',
+ operation_id='delete_share',
)
headers.update(sdk_headers)
@@ -18410,10 +19134,10 @@ def delete_cluster_network_subnet_reserved_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_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 = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
+ url = '/shares/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -18424,39 +19148,29 @@ def delete_cluster_network_subnet_reserved_ip(
response = self.send(request, **kwargs)
return response
- def get_cluster_network_subnet_reserved_ip(
+ def get_share(
self,
- cluster_network_id: str,
- cluster_network_subnet_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a cluster network subnet reserved IP.
+ Retrieve a file share.
- This request retrieves a single cluster network subnet reserved IP specified by
- the identifier in the URL.
+ This request retrieves a single file share specified by the identifier in the URL.
- :param str cluster_network_id: The cluster network identifier.
- :param str cluster_network_subnet_id: The cluster network subnet
- identifier.
- :param str id: The cluster network subnet reserved IP identifier.
+ :param str id: The file share 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 `ClusterNetworkSubnetReservedIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Share` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not cluster_network_subnet_id:
- raise ValueError('cluster_network_subnet_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_cluster_network_subnet_reserved_ip',
+ operation_id='get_share',
)
headers.update(sdk_headers)
@@ -18470,10 +19184,10 @@ def get_cluster_network_subnet_reserved_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_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 = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
+ url = '/shares/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -18484,56 +19198,44 @@ def get_cluster_network_subnet_reserved_ip(
response = self.send(request, **kwargs)
return response
- def update_cluster_network_subnet_reserved_ip(
+ def update_share(
self,
- cluster_network_id: str,
- cluster_network_subnet_id: str,
id: str,
- cluster_network_subnet_reserved_ip_patch: 'ClusterNetworkSubnetReservedIPPatch',
+ share_patch: 'SharePatch',
*,
if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a cluster network subnet reserved IP.
+ Update a file share.
- This request updates a cluster network subnet reserved IP with the information
- provided in a cluster network subnet reserved IP patch object. The patch object is
- structured in the same way as a retrieved cluster network subnet reserved IP and
- needs to contain only the information to be updated.
+ This request updates a share with the information in a provided share patch. The
+ share patch object is structured in the same way as a retrieved share and contains
+ only the information to be updated.
- :param str cluster_network_id: The cluster network identifier.
- :param str cluster_network_subnet_id: The cluster network subnet
- identifier.
- :param str id: The cluster network subnet reserved IP identifier.
- :param ClusterNetworkSubnetReservedIPPatch
- cluster_network_subnet_reserved_ip_patch: The cluster network subnet
- reserved IP patch.
+ :param str id: The file share identifier.
+ :param SharePatch share_patch: The file share 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 `ClusterNetworkSubnetReservedIP` object
+ :rtype: DetailedResponse with `dict` result representing a `Share` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not cluster_network_subnet_id:
- raise ValueError('cluster_network_subnet_id must be provided')
if not id:
raise ValueError('id must be provided')
- if cluster_network_subnet_reserved_ip_patch is None:
- raise ValueError('cluster_network_subnet_reserved_ip_patch must be provided')
- if isinstance(cluster_network_subnet_reserved_ip_patch, ClusterNetworkSubnetReservedIPPatch):
- cluster_network_subnet_reserved_ip_patch = convert_model(cluster_network_subnet_reserved_ip_patch)
+ if share_patch is None:
+ raise ValueError('share_patch must be provided')
+ if isinstance(share_patch, SharePatch):
+ share_patch = convert_model(share_patch)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_cluster_network_subnet_reserved_ip',
+ operation_id='update_share',
)
headers.update(sdk_headers)
@@ -18542,7 +19244,7 @@ def update_cluster_network_subnet_reserved_ip(
'generation': self.generation,
}
- data = json.dumps(cluster_network_subnet_reserved_ip_patch)
+ data = json.dumps(share_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -18550,10 +19252,10 @@ def update_cluster_network_subnet_reserved_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'cluster_network_subnet_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, cluster_network_subnet_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 = '/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
+ url = '/shares/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -18565,102 +19267,47 @@ def update_cluster_network_subnet_reserved_ip(
response = self.send(request, **kwargs)
return response
- def delete_cluster_network_subnet(
+ def list_share_accessor_bindings(
self,
- cluster_network_id: str,
id: str,
*,
- if_match: Optional[str] = None,
- **kwargs,
- ) -> DetailedResponse:
- """
- Delete a cluster network subnet.
-
- This request deletes a cluster network subnet. This operation cannot be reversed.
- For this request to succeed, this cluster subnet must not be attached to a cluster
- network interface.
-
- :param str cluster_network_id: The cluster network identifier.
- :param str id: The cluster network subnet 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 `ClusterNetworkSubnet` object
- """
-
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not id:
- 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_cluster_network_subnet',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
- headers['Accept'] = 'application/json'
-
- path_param_keys = ['cluster_network_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/subnets/{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_cluster_network_subnet(
- self,
- cluster_network_id: str,
- id: str,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a cluster network subnet.
+ List accessor bindings for a file share.
- This request retrieves a single cluster network subnet specified by the identifier
- in the URL.
+ This request lists accessor bindings for a share. Each accessor binding identifies
+ a resource (possibly in another account) with access to this file share including
+ its snapshots.
+ The share accessor bindings will be sorted by their `created_at` property values,
+ with newest bindings first.
- :param str cluster_network_id: The cluster network identifier.
- :param str id: The cluster network subnet identifier.
+ :param str id: The file share 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 `ClusterNetworkSubnet` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareAccessorBindingCollection` object
"""
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_cluster_network_subnet',
+ operation_id='list_share_accessor_bindings',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -18668,10 +19315,10 @@ def get_cluster_network_subnet(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['cluster_network_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_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 = '/cluster_networks/{cluster_network_id}/subnets/{id}'.format(**path_param_dict)
+ url = '/shares/{id}/accessor_bindings'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -18682,112 +19329,33 @@ def get_cluster_network_subnet(
response = self.send(request, **kwargs)
return response
- def update_cluster_network_subnet(
- self,
- cluster_network_id: str,
- id: str,
- cluster_network_subnet_patch: 'ClusterNetworkSubnetPatch',
- *,
- if_match: Optional[str] = None,
- **kwargs,
- ) -> DetailedResponse:
- """
- Update a cluster network subnet.
-
- This request updates a cluster network subnet with the information provided in a
- cluster network subnet patch object. The patch object is structured in the same
- way as a retrieved cluster network subnet and needs to contain only the
- information to be updated.
-
- :param str cluster_network_id: The cluster network identifier.
- :param str id: The cluster network subnet identifier.
- :param ClusterNetworkSubnetPatch cluster_network_subnet_patch: The cluster
- network subnet 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 `ClusterNetworkSubnet` object
- """
-
- if not cluster_network_id:
- raise ValueError('cluster_network_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if cluster_network_subnet_patch is None:
- raise ValueError('cluster_network_subnet_patch must be provided')
- if isinstance(cluster_network_subnet_patch, ClusterNetworkSubnetPatch):
- cluster_network_subnet_patch = convert_model(cluster_network_subnet_patch)
- headers = {
- 'If-Match': if_match,
- }
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='update_cluster_network_subnet',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
-
- data = json.dumps(cluster_network_subnet_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
- headers['Accept'] = 'application/json'
-
- path_param_keys = ['cluster_network_id', 'id']
- path_param_values = self.encode_path_vars(cluster_network_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{cluster_network_id}/subnets/{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_cluster_network(
+ def delete_share_accessor_binding(
self,
+ share_id: str,
id: str,
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a cluster network.
+ Delete a file share accessor binding.
- This request deletes a cluster network. This operation cannot be reversed.
- For this request to succeed, virtual server instances must not reside in this
- cluster network.
+ This request deletes a share accessor binding. This operation cannot be reversed.
- :param str id: The cluster network 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 str share_id: The file share identifier.
+ :param str id: The file share accessor binding 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 `ClusterNetwork` object
+ :rtype: DetailedResponse
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_cluster_network',
+ operation_id='delete_share_accessor_binding',
)
headers.update(sdk_headers)
@@ -18799,12 +19367,11 @@ def delete_cluster_network(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/accessor_bindings/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -18815,30 +19382,34 @@ def delete_cluster_network(
response = self.send(request, **kwargs)
return response
- def get_cluster_network(
+ def get_share_accessor_binding(
self,
+ share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a cluster network.
+ Retrieve a file share accessor binding.
- This request retrieves a single cluster network specified by the identifier in the
- URL.
+ This request retrieves a single accessor binding specified by the identifier in
+ the URL.
- :param str id: The cluster network identifier.
+ :param str share_id: The file share identifier.
+ :param str id: The file share accessor binding 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 `ClusterNetwork` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareAccessorBinding` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_cluster_network',
+ operation_id='get_share_accessor_binding',
)
headers.update(sdk_headers)
@@ -18852,10 +19423,10 @@ def get_cluster_network(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/accessor_bindings/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -18866,45 +19437,50 @@ def get_cluster_network(
response = self.send(request, **kwargs)
return response
- def update_cluster_network(
+ def failover_share(
self,
- id: str,
- cluster_network_patch: 'ClusterNetworkPatch',
+ share_id: str,
*,
- if_match: Optional[str] = None,
+ fallback_policy: Optional[str] = None,
+ timeout: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a cluster.
+ Failover to replica file share.
- This request updates a cluster network with the information provided in a cluster
- network patch object. The patch object is structured in the same way as a
- retrieved cluster network and needs to contain only the information to be updated.
+ This request triggers a failover to the replica file share specified by the
+ identifier in the URL. The failover cannot be started if a source share or the
+ replica share has a `lifecycle_state` of `updating`, or has a replication
+ operation in progress.
+ If `fallback_policy` is specified as `split`, and the request is accepted but the
+ failover operation cannot be performed, a split will be triggered.
- :param str id: The cluster network identifier.
- :param ClusterNetworkPatch cluster_network_patch: The cluster network
- 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 str share_id: The file share identifier.
+ :param str fallback_policy: (optional) The action to take if the failover
+ request is accepted but cannot be performed or times out:
+ - `fail`: Fail the operation, resulting in the replication relationship
+ being unchanged.
+ - `split`: Split the replica from its source, resulting in two individual
+ read-write
+ file shares. Because the final sync was not completed, the replica may
+ be
+ out-of-date. This occurs in disaster recovery scenarios where the
+ source is known to
+ be unreachable.
+ :param int timeout: (optional) The failover timeout in seconds.
+ If the timeout is reached, the `fallback_policy` will be triggered.
: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 `ClusterNetwork` object
+ :rtype: DetailedResponse
"""
- if not id:
- raise ValueError('id must be provided')
- if cluster_network_patch is None:
- raise ValueError('cluster_network_patch must be provided')
- if isinstance(cluster_network_patch, ClusterNetworkPatch):
- cluster_network_patch = convert_model(cluster_network_patch)
- headers = {
- 'If-Match': if_match,
- }
+ if not share_id:
+ raise ValueError('share_id must be provided')
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_cluster_network',
+ operation_id='failover_share',
)
headers.update(sdk_headers)
@@ -18913,20 +19489,24 @@ def update_cluster_network(
'generation': self.generation,
}
- data = json.dumps(cluster_network_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = {
+ 'fallback_policy': fallback_policy,
+ 'timeout': timeout,
+ }
+ 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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/cluster_networks/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/failover'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -18936,51 +19516,51 @@ def update_cluster_network(
response = self.send(request, **kwargs)
return response
- #########################
- # Public gateways
- #########################
-
- def list_public_gateways(
+ def list_share_mount_targets(
self,
+ share_id: str,
*,
+ name: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List public gateways.
+ List mount targets for a file share.
- This request lists public gateways in the region. A public gateway is a virtual
- network device associated with a VPC, which allows access to the Internet. A
- public gateway resides in a zone and can be connected to subnets in the same zone
- only.
+ This request lists mount targets for a file share. A mount target is a network
+ endpoint at which a file share may be mounted. The file share can be mounted by
+ clients in the same VPC and zone after creating share mount targets.
+ The share mount targets will be sorted by their `created_at` property values, with
+ newest targets first.
+ :param str share_id: The file share identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 with a `resource_group.id` property matching 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 `PublicGatewayCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareMountTargetCollection` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_public_gateways',
+ operation_id='list_share_mount_targets',
)
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:
@@ -18988,7 +19568,10 @@ def list_public_gateways(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/public_gateways'
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/shares/{share_id}/mount_targets'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -18999,57 +19582,40 @@ def list_public_gateways(
response = self.send(request, **kwargs)
return response
- def create_public_gateway(
+ def create_share_mount_target(
self,
- vpc: 'VPCIdentity',
- zone: 'ZoneIdentity',
- *,
- floating_ip: Optional['PublicGatewayFloatingIPPrototype'] = None,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
+ share_id: str,
+ share_mount_target_prototype: 'ShareMountTargetPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a public gateway.
+ Create a mount target for a file share.
- This request creates a new public gateway from a public gateway prototype object.
- For this to succeed, the VPC must not already have a public gateway in the
- specified zone.
- If a floating IP is provided, it must be unbound. If a floating IP is not
- provided, one will be created and bound to the public gateway. Once a public
- gateway has been created, its floating IP cannot be unbound. A public gateway must
- be explicitly attached to each subnet it will provide connectivity for.
+ This request creates a new share mount target from a share mount target prototype
+ object.
+ The prototype object is structured in the same way as a retrieved share mount
+ target, and contains the information necessary to provision the new file share
+ mount target.
- :param VPCIdentity vpc: The VPC this public gateway will reside in.
- :param ZoneIdentity zone: The zone this public gateway will reside in.
- :param PublicGatewayFloatingIPPrototype floating_ip: (optional)
- :param str name: (optional) The name for this public gateway. The name must
- not be used by another public gateway in the VPC. 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) will be
- used.
+ :param str share_id: The file share identifier.
+ :param ShareMountTargetPrototype share_mount_target_prototype: The share
+ mount target prototype object.
: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 `PublicGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareMountTarget` object
"""
- if vpc is None:
- raise ValueError('vpc must be provided')
- if zone is None:
- raise ValueError('zone must be provided')
- vpc = convert_model(vpc)
- zone = convert_model(zone)
- if floating_ip is not None:
- floating_ip = convert_model(floating_ip)
- if resource_group is not None:
- resource_group = convert_model(resource_group)
+ if not share_id:
+ raise ValueError('share_id must be provided')
+ if share_mount_target_prototype is None:
+ raise ValueError('share_mount_target_prototype must be provided')
+ if isinstance(share_mount_target_prototype, ShareMountTargetPrototype):
+ share_mount_target_prototype = convert_model(share_mount_target_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_public_gateway',
+ operation_id='create_share_mount_target',
)
headers.update(sdk_headers)
@@ -19058,15 +19624,7 @@ def create_public_gateway(
'generation': self.generation,
}
- data = {
- 'vpc': vpc,
- 'zone': zone,
- 'floating_ip': floating_ip,
- 'name': name,
- 'resource_group': resource_group,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(share_mount_target_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -19074,7 +19632,10 @@ def create_public_gateway(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/public_gateways'
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/shares/{share_id}/mount_targets'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -19086,32 +19647,36 @@ def create_public_gateway(
response = self.send(request, **kwargs)
return response
- def delete_public_gateway(
+ def delete_share_mount_target(
self,
+ share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a public gateway.
+ Delete a file share mount target.
- This request deletes a public gateway. This operation cannot be reversed. For this
- request to succeed, the public gateway must not be attached to any subnets. The
- public gateway's floating IP will be automatically unbound. If the floating IP was
- created when the public gateway was created, it will be deleted.
+ This request deletes a share mount target. This operation cannot be reversed.
+ If the request is accepted, the share mount target `lifecycle_state` will be set
+ to
+ `deleting`. Once deletion processing completes, it will no longer be retrievable.
- :param str id: The public gateway identifier.
+ :param str share_id: The file share identifier.
+ :param str id: The file share mount target 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 `ShareMountTarget` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_public_gateway',
+ operation_id='delete_share_mount_target',
)
headers.update(sdk_headers)
@@ -19123,11 +19688,12 @@ def delete_public_gateway(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/public_gateways/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/mount_targets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -19138,30 +19704,34 @@ def delete_public_gateway(
response = self.send(request, **kwargs)
return response
- def get_public_gateway(
+ def get_share_mount_target(
self,
+ share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a public gateway.
+ Retrieve a file share mount target.
- This request retrieves a single public gateway specified by the identifier in the
- URL.
+ This request retrieves a single share mount target specified by the identifier in
+ the URL.
- :param str id: The public gateway identifier.
+ :param str share_id: The file share identifier.
+ :param str id: The file share mount target 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 `PublicGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareMountTarget` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_public_gateway',
+ operation_id='get_share_mount_target',
)
headers.update(sdk_headers)
@@ -19175,10 +19745,10 @@ def get_public_gateway(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/public_gateways/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/mount_targets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -19189,35 +19759,43 @@ def get_public_gateway(
response = self.send(request, **kwargs)
return response
- def update_public_gateway(
+ def update_share_mount_target(
self,
+ share_id: str,
id: str,
- public_gateway_patch: 'PublicGatewayPatch',
+ share_mount_target_patch: 'ShareMountTargetPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a public gateway.
+ Update a file share mount target.
- This request updates a public gateway's name.
+ This request updates a share mount target with the information provided in a share
+ mount target patch object. The share mount target patch object is structured in
+ the same way as a retrieved share mount target and needs to contain only the
+ information to be updated.
- :param str id: The public gateway identifier.
- :param PublicGatewayPatch public_gateway_patch: The public gateway patch.
+ :param str share_id: The file share identifier.
+ :param str id: The file share mount target identifier.
+ :param ShareMountTargetPatch share_mount_target_patch: The share mount
+ target 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 `PublicGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareMountTarget` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
- if public_gateway_patch is None:
- raise ValueError('public_gateway_patch must be provided')
- if isinstance(public_gateway_patch, PublicGatewayPatch):
- public_gateway_patch = convert_model(public_gateway_patch)
+ if share_mount_target_patch is None:
+ raise ValueError('share_mount_target_patch must be provided')
+ if isinstance(share_mount_target_patch, ShareMountTargetPatch):
+ share_mount_target_patch = convert_model(share_mount_target_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_public_gateway',
+ operation_id='update_share_mount_target',
)
headers.update(sdk_headers)
@@ -19226,7 +19804,7 @@ def update_public_gateway(
'generation': self.generation,
}
- data = json.dumps(public_gateway_patch)
+ data = json.dumps(share_mount_target_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -19234,10 +19812,10 @@ def update_public_gateway(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/public_gateways/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/mount_targets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -19249,73 +19827,64 @@ def update_public_gateway(
response = self.send(request, **kwargs)
return response
- #########################
- # Floating IPs
- #########################
-
- def list_floating_ips(
+ def list_share_snapshots(
self,
+ share_id: str,
*,
+ backup_policy_plan_id: Optional[str] = None,
+ name: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
sort: Optional[str] = None,
- target_id: Optional[str] = None,
- target_crn: Optional[str] = None,
- target_name: Optional[str] = None,
- target_resource_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List floating IPs.
+ List file share snapshots.
- This request lists floating IPs in the region. Floating IPs allow inbound and
- outbound traffic from the Internet to an instance.
+ This request lists snapshots for the specified file share, or across all
+ accessible file shares. A snapshot preserves the data of a share at the time the
+ snapshot was captured.
+ If the file share is a replica, the list will contain snapshots corresponding to
+ snapshots on the source.
+ :param str share_id: The file share identifier, or `-` to wildcard all
+ accessible file shares.
+ :param str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching the
+ specified identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 with a `resource_group.id` property matching 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 str target_id: (optional) Filters the collection to resources with a
- `target.id` property matching the specified identifier.
- :param str target_crn: (optional) Filters the collection to resources with
- a `target.crn` property matching the specified CRN.
- :param str target_name: (optional) Filters the collection to resources with
- a `target.name` property matching the exact specified name.
- :param str target_resource_type: (optional) Filters the collection to
- resources with a `target.resource_type` property matching the specified
- 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 `FloatingIPCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareSnapshotCollection` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_floating_ips',
+ operation_id='list_share_snapshots',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'backup_policy_plan.id': backup_policy_plan_id,
+ 'name': name,
'start': start,
'limit': limit,
- 'resource_group.id': resource_group_id,
'sort': sort,
- 'target.id': target_id,
- 'target.crn': target_crn,
- 'target.name': target_name,
- 'target.resource_type': target_resource_type,
}
if 'headers' in kwargs:
@@ -19323,7 +19892,10 @@ def list_floating_ips(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/floating_ips'
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/shares/{share_id}/snapshots'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -19334,32 +19906,48 @@ def list_floating_ips(
response = self.send(request, **kwargs)
return response
- def create_floating_ip(
+ def create_share_snapshot(
self,
- floating_ip_prototype: 'FloatingIPPrototype',
+ share_id: str,
+ *,
+ name: Optional[str] = None,
+ user_tags: Optional[List[str]] = None,
**kwargs,
) -> DetailedResponse:
"""
- Reserve a floating IP.
+ Create a snapshot for a file share.
- This request reserves a new floating IP.
+ This request creates a new share snapshot from a share snapshot prototype object.
+ The prototype object is structured in the same way as a retrieved share snapshot,
+ and contains the information necessary to create the new share snapshot.
+ The share must have an `access_control_mode` of `security_group`, and a
+ `replication_role` of `source` or `none`.
+ The snapshot will inherit its `resource_group` and encryption settings from the
+ share.
+ If the share has a `replication_role` of `source`, a corresponding snapshot on the
+ replica share will be created with a `status` of `pending`. It will remain in
+ `pending` until the data is synchronized per the replication schedule determined
+ by the replica share's `replication_cron_spec`.
- :param FloatingIPPrototype floating_ip_prototype: The floating IP prototype
- object.
+ :param str share_id: The file share identifier.
+ :param str name: (optional) The name for this share snapshot. The name must
+ not be used by another snapshot for the file share. If unspecified, the
+ name will be a hyphenated list of randomly-selected words.
+ :param List[str] user_tags: (optional) The [user
+ tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
+ this share snapshot.
: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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareSnapshot` object
"""
- if floating_ip_prototype is None:
- raise ValueError('floating_ip_prototype must be provided')
- if isinstance(floating_ip_prototype, FloatingIPPrototype):
- floating_ip_prototype = convert_model(floating_ip_prototype)
+ if not share_id:
+ raise ValueError('share_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_floating_ip',
+ operation_id='create_share_snapshot',
)
headers.update(sdk_headers)
@@ -19368,7 +19956,12 @@ def create_floating_ip(
'generation': self.generation,
}
- data = json.dumps(floating_ip_prototype)
+ data = {
+ 'name': name,
+ 'user_tags': user_tags,
+ }
+ 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:
@@ -19376,7 +19969,10 @@ def create_floating_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/floating_ips'
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/shares/{share_id}/snapshots'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -19388,31 +19984,46 @@ def create_floating_ip(
response = self.send(request, **kwargs)
return response
- def delete_floating_ip(
+ def delete_share_snapshot(
self,
+ share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a floating IP.
+ Delete a share snapshot.
- This request disassociates (if associated) and releases a floating IP. This
- operation cannot be reversed. For this request to succeed, the floating IP must
- not be required by another resource, such as a public gateway.
+ This request deletes a share snapshot. This operation cannot be reversed. For this
+ request to succeed, the share must have a `replication_role` of `source` or
+ `none`.
+ If the request is accepted, the share snapshot `lifecycle_state` will be set to
+ `deleting`. Once deletion processing completes, the share snapshot will no longer
+ be retrievable.
+ Deleting a share snapshot will not affect any previously-accepted requests to
+ create a share from it.
+ If the share has a `replication_role` of `source`, the corresponding snapshot on
+ the replica share will be subsequently moved to a `lifecycle_state` of `deleting`.
+ If the data for the corresponding snapshot has already been synchronized via the
+ replication schedule determined by `replication_cron_spec`, the snapshot will
+ remain available in the replica share's `.snapshot` directory until the next
+ replication sync.
- :param str id: The floating IP identifier.
+ :param str share_id: The file share identifier.
+ :param str id: The share snapshot 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 `ShareSnapshot` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_floating_ip',
+ operation_id='delete_share_snapshot',
)
headers.update(sdk_headers)
@@ -19424,11 +20035,12 @@ def delete_floating_ip(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/floating_ips/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/snapshots/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -19439,30 +20051,34 @@ def delete_floating_ip(
response = self.send(request, **kwargs)
return response
- def get_floating_ip(
+ def get_share_snapshot(
self,
+ share_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a floating IP.
+ Retrieve a share snapshot.
- This request retrieves a single floating IP specified by the identifier in the
+ This request retrieves a single share snapshot specified by the identifier in the
URL.
- :param str id: The floating IP identifier.
+ :param str share_id: The file share identifier.
+ :param str id: The share snapshot 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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareSnapshot` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_floating_ip',
+ operation_id='get_share_snapshot',
)
headers.update(sdk_headers)
@@ -19476,10 +20092,10 @@ def get_floating_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/floating_ips/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/snapshots/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -19490,35 +20106,49 @@ def get_floating_ip(
response = self.send(request, **kwargs)
return response
- def update_floating_ip(
+ def update_share_snapshot(
self,
+ share_id: str,
id: str,
- floating_ip_patch: 'FloatingIPPatch',
+ share_snapshot_patch: 'ShareSnapshotPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a floating IP.
+ Update a share snapshot.
- This request updates a floating IP's name and/or target.
+ This request updates a share snapshot with the information provided in a share
+ snapshot patch object. The share snapshot patch object is structured in the same
+ way as a retrieved share snapshot and needs to contain only the information to be
+ updated.
- :param str id: The floating IP identifier.
- :param FloatingIPPatch floating_ip_patch: The floating IP patch.
+ :param str share_id: The file share identifier.
+ :param str id: The share snapshot identifier.
+ :param ShareSnapshotPatch share_snapshot_patch: The share snapshot 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 `FloatingIP` object
+ :rtype: DetailedResponse with `dict` result representing a `ShareSnapshot` object
"""
+ if not share_id:
+ raise ValueError('share_id must be provided')
if not id:
raise ValueError('id must be provided')
- if floating_ip_patch is None:
- raise ValueError('floating_ip_patch must be provided')
- if isinstance(floating_ip_patch, FloatingIPPatch):
- floating_ip_patch = convert_model(floating_ip_patch)
- headers = {}
+ if share_snapshot_patch is None:
+ raise ValueError('share_snapshot_patch must be provided')
+ if isinstance(share_snapshot_patch, ShareSnapshotPatch):
+ share_snapshot_patch = convert_model(share_snapshot_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_floating_ip',
+ operation_id='update_share_snapshot',
)
headers.update(sdk_headers)
@@ -19527,7 +20157,7 @@ def update_floating_ip(
'generation': self.generation,
}
- data = json.dumps(floating_ip_patch)
+ data = json.dumps(share_snapshot_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -19535,10 +20165,10 @@ def update_floating_ip(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['share_id', 'id']
+ path_param_values = self.encode_path_vars(share_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/floating_ips/{id}'.format(**path_param_dict)
+ url = '/shares/{share_id}/snapshots/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -19550,26 +20180,130 @@ def update_floating_ip(
response = self.send(request, **kwargs)
return response
+ def delete_share_source(
+ self,
+ share_id: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Split the source file share from a replica file share.
+
+ This request removes the replication relationship between a source share and the
+ replica share specified by the identifier in the URL. The replication relationship
+ cannot be removed if a source share or the replica share has a `lifecycle_state`
+ of `updating`, or has a replication operation in progress.
+ This operation cannot be reversed.
+
+ :param str share_id: The file share identifier.
+ :param dict headers: A `dict` containing the request headers
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
+ :rtype: DetailedResponse
+ """
+
+ if not share_id:
+ raise ValueError('share_id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='delete_share_source',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/shares/{share_id}/source'.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_share_source(
+ self,
+ share_id: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Retrieve the source file share for a replica file share.
+
+ This request retrieves the source file share associated with the replica file
+ share specified by the identifier in the URL.
+
+ :param str share_id: The file share 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 `ShareReference` object
+ """
+
+ if not share_id:
+ raise ValueError('share_id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='get_share_source',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+ headers['Accept'] = 'application/json'
+
+ path_param_keys = ['share_id']
+ path_param_values = self.encode_path_vars(share_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/shares/{share_id}/source'.format(**path_param_dict)
+ request = self.prepare_request(
+ method='GET',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
#########################
- # Public address ranges
+ # Snapshots
#########################
- def list_public_address_ranges(
+ def list_snapshot_consistency_groups(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
+ name: Optional[str] = None,
+ sort: Optional[str] = None,
+ backup_policy_plan_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List public address ranges.
+ List snapshot consistency groups.
- This request lists [public address
- ranges](https://cloud.ibm.com/docs/vpc?topic=vpc-about-par) in the region. A
- public address range is a contiguous block of public IP addresses that can be
- bound to a `target` that specifies a `vpc` and a `zone`. Incoming traffic for
- these IP addresses will be routed according to the VPC's ingress routing table.
+ This request lists snapshot consistency groups in the region. A snapshot
+ consistency group is a collection of individual snapshots taken at the same time.
:param str start: (optional) A server-provided token determining what
resource to start the page on.
@@ -19577,16 +20311,26 @@ def list_public_address_ranges(
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :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 str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching 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 `PublicAddressRangeCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotConsistencyGroupCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_public_address_ranges',
+ operation_id='list_snapshot_consistency_groups',
)
headers.update(sdk_headers)
@@ -19596,6 +20340,9 @@ def list_public_address_ranges(
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
+ 'name': name,
+ 'sort': sort,
+ 'backup_policy_plan.id': backup_policy_plan_id,
}
if 'headers' in kwargs:
@@ -19603,7 +20350,7 @@ def list_public_address_ranges(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/public_address_ranges'
+ url = '/snapshot_consistency_groups'
request = self.prepare_request(
method='GET',
url=url,
@@ -19614,51 +20361,36 @@ def list_public_address_ranges(
response = self.send(request, **kwargs)
return response
- def create_public_address_range(
+ def create_snapshot_consistency_group(
self,
- ipv4_address_count: int,
- *,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
- target: Optional['PublicAddressRangeTargetPrototype'] = None,
+ snapshot_consistency_group_prototype: 'SnapshotConsistencyGroupPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a public address range.
+ Create a snapshot consistency group.
- This request creates a new public address range from a public address range
- prototype object. The prototype object is structured in the same way as a
- retrieved public address range, and contains the information necessary to create
- the new public address range.
+ This request creates a new snapshot consistency group from a snapshot consistency
+ group object. The prototype object is structured in the same way as a retrieved
+ consistency group, and contains the information necessary to provision the new
+ snapshot consistency group.
- :param int ipv4_address_count: The total number of public IPv4 addresses
- required. Must be a power of 2.
- :param str name: (optional) The name for this public address range. The
- name must not be used by another public address range in the region. 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) will be
- used.
- :param PublicAddressRangeTargetPrototype target: (optional) The target to
- bind this public address range to. If unspecified, the public address
- range will not be bound to a target at creation.
+ :param SnapshotConsistencyGroupPrototype
+ snapshot_consistency_group_prototype: The snapshot consistency group
+ prototype object.
: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 `PublicAddressRange` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotConsistencyGroup` object
"""
- if ipv4_address_count is None:
- raise ValueError('ipv4_address_count must be provided')
- if resource_group is not None:
- resource_group = convert_model(resource_group)
- if target is not None:
- target = convert_model(target)
+ if snapshot_consistency_group_prototype is None:
+ raise ValueError('snapshot_consistency_group_prototype must be provided')
+ if isinstance(snapshot_consistency_group_prototype, SnapshotConsistencyGroupPrototype):
+ snapshot_consistency_group_prototype = convert_model(snapshot_consistency_group_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_public_address_range',
+ operation_id='create_snapshot_consistency_group',
)
headers.update(sdk_headers)
@@ -19667,14 +20399,7 @@ def create_public_address_range(
'generation': self.generation,
}
- data = {
- 'ipv4_address_count': ipv4_address_count,
- 'name': name,
- 'resource_group': resource_group,
- 'target': target,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(snapshot_consistency_group_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -19682,7 +20407,7 @@ def create_public_address_range(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/public_address_ranges'
+ url = '/snapshot_consistency_groups'
request = self.prepare_request(
method='POST',
url=url,
@@ -19694,22 +20419,22 @@ def create_public_address_range(
response = self.send(request, **kwargs)
return response
- def delete_public_address_range(
+ def delete_snapshot_consistency_group(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a public address range.
+ Delete a snapshot consistency group.
- This request deletes a public address range. If the public address range is bound
- to a
- `target`, it will be unbound. This operation cannot be reversed.
+ This request deletes snapshot consistency group. This operation cannot be
+ reversed. If the `delete_snapshots_on_delete` property is `true`, all snapshots in
+ the consistency group will also be deleted.
- :param str id: The public address range identifier.
+ :param str id: The snapshot consistency group 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 `PublicAddressRange` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotConsistencyGroup` object
"""
if not id:
@@ -19718,7 +20443,7 @@ def delete_public_address_range(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_public_address_range',
+ operation_id='delete_snapshot_consistency_group',
)
headers.update(sdk_headers)
@@ -19735,7 +20460,7 @@ def delete_public_address_range(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/public_address_ranges/{id}'.format(**path_param_dict)
+ url = '/snapshot_consistency_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -19746,21 +20471,21 @@ def delete_public_address_range(
response = self.send(request, **kwargs)
return response
- def get_public_address_range(
+ def get_snapshot_consistency_group(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a public address range.
+ Retrieve a snapshot consistency group.
- This request retrieves a single public address range specified by the identifier
- in the URL.
+ This request retrieves a single snapshot consistency group specified by the
+ identifier in the URL.
- :param str id: The public address range identifier.
+ :param str id: The snapshot consistency group 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 `PublicAddressRange` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotConsistencyGroup` object
"""
if not id:
@@ -19769,7 +20494,7 @@ def get_public_address_range(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_public_address_range',
+ operation_id='get_snapshot_consistency_group',
)
headers.update(sdk_headers)
@@ -19786,7 +20511,7 @@ def get_public_address_range(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/public_address_ranges/{id}'.format(**path_param_dict)
+ url = '/snapshot_consistency_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -19797,39 +20522,46 @@ def get_public_address_range(
response = self.send(request, **kwargs)
return response
- def update_public_address_range(
+ def update_snapshot_consistency_group(
self,
id: str,
- public_address_range_patch: 'PublicAddressRangePatch',
+ snapshot_consistency_group_patch: 'SnapshotConsistencyGroupPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a public address range.
+ Update a snapshot consistency group.
- This request updates a public address range with the information in a provided
- public address range patch. The public address range patch object is structured in
- the same way as a retrieved public address range and contains only the information
- to be updated.
+ This request updates a snapshot consistency group with the information in a
+ provided snapshot consistency group patch. The snapshot consistency group patch
+ object is structured in the same way as a retrieved snapshot consistency group and
+ contains only the information to be updated.
- :param str id: The public address range identifier.
- :param PublicAddressRangePatch public_address_range_patch: The public
- address range patch.
+ :param str id: The snapshot consistency group identifier.
+ :param SnapshotConsistencyGroupPatch snapshot_consistency_group_patch: The
+ snapshot consistency group 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 `PublicAddressRange` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotConsistencyGroup` object
"""
if not id:
raise ValueError('id must be provided')
- if public_address_range_patch is None:
- raise ValueError('public_address_range_patch must be provided')
- if isinstance(public_address_range_patch, PublicAddressRangePatch):
- public_address_range_patch = convert_model(public_address_range_patch)
- headers = {}
+ if snapshot_consistency_group_patch is None:
+ raise ValueError('snapshot_consistency_group_patch must be provided')
+ if isinstance(snapshot_consistency_group_patch, SnapshotConsistencyGroupPatch):
+ snapshot_consistency_group_patch = convert_model(snapshot_consistency_group_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_public_address_range',
+ operation_id='update_snapshot_consistency_group',
)
headers.update(sdk_headers)
@@ -19838,7 +20570,7 @@ def update_public_address_range(
'generation': self.generation,
}
- data = json.dumps(public_address_range_patch)
+ data = json.dumps(snapshot_consistency_group_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -19849,7 +20581,7 @@ def update_public_address_range(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/public_address_ranges/{id}'.format(**path_param_dict)
+ url = '/snapshot_consistency_groups/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -19861,43 +20593,163 @@ def update_public_address_range(
response = self.send(request, **kwargs)
return response
- #########################
- # Network ACLs
- #########################
+ def delete_snapshots(
+ self,
+ source_volume_id: str,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ Delete a filtered collection of snapshots.
- def list_network_acls(
+ This request deletes snapshots that match the specified filter. This operation
+ cannot be reversed.
+
+ :param str source_volume_id: Filters the collection to resources with a
+ `source_volume.id` property matching 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
+ """
+
+ if not source_volume_id:
+ raise ValueError('source_volume_id must be provided')
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='delete_snapshots',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ 'source_volume.id': source_volume_id,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+
+ url = '/snapshots'
+ request = self.prepare_request(
+ method='DELETE',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
+ def list_snapshots(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ tag: Optional[str] = None,
resource_group_id: Optional[str] = None,
+ name: Optional[str] = None,
+ source_volume_id: Optional[str] = None,
+ source_volume_crn: Optional[str] = None,
+ source_image_id: Optional[str] = None,
+ source_image_crn: Optional[str] = None,
+ sort: Optional[str] = None,
+ backup_policy_plan_id: Optional[str] = None,
+ copies_id: Optional[str] = None,
+ copies_name: Optional[str] = None,
+ copies_crn: Optional[str] = None,
+ copies_remote_region_name: Optional[str] = None,
+ source_snapshot_id: Optional[str] = None,
+ source_snapshot_remote_region_name: Optional[str] = None,
+ source_volume_remote_region_name: Optional[str] = None,
+ source_image_remote_region_name: Optional[str] = None,
+ clones_zone_name: Optional[str] = None,
+ snapshot_consistency_group_id: Optional[str] = None,
+ snapshot_consistency_group_crn: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List network ACLs.
+ List snapshots.
- This request lists network ACLs in the region. A network ACL defines a set of
- packet filtering rules for traffic in and out of the subnets the network ACL is
- attached to. No traffic is allowed by default. Both allow and deny rules can be
- defined, and rules are stateless so that reverse traffic in response to allowed
- traffic is not automatically allowed.
+ This request lists snapshots in the region. A snapshot preserves the data of a
+ volume at the time the snapshot is created.
: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 tag: (optional) Filters the collection to resources with an item
+ in the `tags` property matching the exact specified tag.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str source_volume_id: (optional) Filters the collection to resources
+ with a `source_volume.id` property matching the specified identifier.
+ :param str source_volume_crn: (optional) Filters the collection to
+ resources with a `source_volume.crn` property matching the specified CRN.
+ :param str source_image_id: (optional) Filters the collection to resources
+ with a `source_image.id` property matching the specified identifier.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no source image or any existent
+ source image, respectively.
+ :param str source_image_crn: (optional) Filters the collection to resources
+ with a `source_image.crn` property matching the specified CRN.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no source image or any existent
+ source image, respectively.
+ :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 str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching the
+ specified identifier.
+ :param str copies_id: (optional) Filters the collection to snapshots with
+ an item in the `copies` property with an `id` property matching the
+ specified identifier.
+ :param str copies_name: (optional) Filters the collection to snapshots with
+ an item in the `copies` property with a `name` property matching the exact
+ specified name.
+ :param str copies_crn: (optional) Filters the collection to snapshots with
+ an item in the `copies` property with a `crn` property matching the
+ specified CRN.
+ :param str copies_remote_region_name: (optional) Filters the collection to
+ snapshots with an item in the `copies` property with a
+ `remote.region.name` property matching the exact specified name.
+ :param str source_snapshot_id: (optional) Filters the collection to
+ resources with a `source_snapshot.id` property matching the specified
+ identifier.
+ :param str source_snapshot_remote_region_name: (optional) Filters the
+ collection to resources with a `source_snapshot.remote.region.name`
+ property matching the exact specified name.
+ :param str source_volume_remote_region_name: (optional) Filters the
+ collection to resources with a `source_volume.remote.region.name` property
+ matching the exact specified name.
+ :param str source_image_remote_region_name: (optional) Filters the
+ collection to resources with a `source_image.remote.region.name` property
+ matching the exact specified name.
+ :param str clones_zone_name: (optional) Filters the collection to snapshots
+ with an item in the `clones` property with a `zone.name` property matching
+ the exact specified name.
+ :param str snapshot_consistency_group_id: (optional) Filters the collection
+ to resources with a `snapshot_consistency_group.id` property matching the
+ specified identifier.
+ :param str snapshot_consistency_group_crn: (optional) Filters the
+ collection to resources with a `snapshot_consistency_group.crn` property
+ matching 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 `NetworkACLCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_network_acls',
+ operation_id='list_snapshots',
)
headers.update(sdk_headers)
@@ -19906,7 +20758,26 @@ def list_network_acls(
'generation': self.generation,
'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,
+ 'copies[].id': copies_id,
+ 'copies[].name': copies_name,
+ 'copies[].crn': copies_crn,
+ 'copies[].remote.region.name': copies_remote_region_name,
+ 'source_snapshot.id': source_snapshot_id,
+ 'source_snapshot.remote.region.name': source_snapshot_remote_region_name,
+ 'source_volume.remote.region.name': source_volume_remote_region_name,
+ 'source_image.remote.region.name': source_image_remote_region_name,
+ 'clones[].zone.name': clones_zone_name,
+ 'snapshot_consistency_group.id': snapshot_consistency_group_id,
+ 'snapshot_consistency_group.crn': snapshot_consistency_group_crn,
}
if 'headers' in kwargs:
@@ -19914,7 +20785,7 @@ def list_network_acls(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/network_acls'
+ url = '/snapshots'
request = self.prepare_request(
method='GET',
url=url,
@@ -19925,34 +20796,33 @@ def list_network_acls(
response = self.send(request, **kwargs)
return response
- def create_network_acl(
+ def create_snapshot(
self,
- network_acl_prototype: 'NetworkACLPrototype',
+ snapshot_prototype: 'SnapshotPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a network ACL.
+ Create a snapshot.
- This request creates a new stateless network ACL from a network ACL prototype
- object. The prototype object is structured in the same way as a retrieved network
- ACL, and contains the information necessary to create the new network ACL.
+ This request creates a new snapshot from a snapshot prototype object. The
+ prototype object is structured in the same way as a retrieved snapshot, and
+ contains the information necessary to provision the new snapshot.
- :param NetworkACLPrototype network_acl_prototype: The network ACL prototype
- object.
+ :param SnapshotPrototype snapshot_prototype: The snapshot prototype object.
: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 `NetworkACL` object
+ :rtype: DetailedResponse with `dict` result representing a `Snapshot` object
"""
- if network_acl_prototype is None:
- raise ValueError('network_acl_prototype must be provided')
- if isinstance(network_acl_prototype, NetworkACLPrototype):
- network_acl_prototype = convert_model(network_acl_prototype)
+ if snapshot_prototype is None:
+ raise ValueError('snapshot_prototype must be provided')
+ if isinstance(snapshot_prototype, SnapshotPrototype):
+ snapshot_prototype = convert_model(snapshot_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_network_acl',
+ operation_id='create_snapshot',
)
headers.update(sdk_headers)
@@ -19961,7 +20831,7 @@ def create_network_acl(
'generation': self.generation,
}
- data = json.dumps(network_acl_prototype)
+ data = json.dumps(snapshot_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -19969,7 +20839,7 @@ def create_network_acl(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/network_acls'
+ url = '/snapshots'
request = self.prepare_request(
method='POST',
url=url,
@@ -19981,19 +20851,21 @@ def create_network_acl(
response = self.send(request, **kwargs)
return response
- def delete_network_acl(
+ def delete_snapshot(
self,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a network ACL.
+ Delete a snapshot.
- This request deletes a network ACL. This operation cannot be reversed. For this
- request to succeed, the network ACL must not be the default network ACL for any
- VPCs, and the network ACL must not be attached to any subnets.
+ This request deletes a snapshot. This operation cannot be reversed.
- :param str id: The network ACL identifier.
+ :param str id: The snapshot 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
@@ -20001,11 +20873,13 @@ def delete_network_acl(
if not id:
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_network_acl',
+ operation_id='delete_snapshot',
)
headers.update(sdk_headers)
@@ -20021,7 +20895,7 @@ def delete_network_acl(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/network_acls/{id}'.format(**path_param_dict)
+ url = '/snapshots/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -20032,21 +20906,20 @@ def delete_network_acl(
response = self.send(request, **kwargs)
return response
- def get_network_acl(
+ def get_snapshot(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a network ACL.
+ Retrieve a snapshot.
- This request retrieves a single network ACL specified by the identifier in the
- URL.
+ This request retrieves a single snapshot specified by the identifier in the URL.
- :param str id: The network ACL identifier.
+ :param str id: The snapshot 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 `NetworkACL` object
+ :rtype: DetailedResponse with `dict` result representing a `Snapshot` object
"""
if not id:
@@ -20055,7 +20928,7 @@ def get_network_acl(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_network_acl',
+ operation_id='get_snapshot',
)
headers.update(sdk_headers)
@@ -20072,7 +20945,7 @@ def get_network_acl(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/network_acls/{id}'.format(**path_param_dict)
+ url = '/snapshots/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -20083,35 +20956,44 @@ def get_network_acl(
response = self.send(request, **kwargs)
return response
- def update_network_acl(
+ def update_snapshot(
self,
id: str,
- network_acl_patch: 'NetworkACLPatch',
+ snapshot_patch: 'SnapshotPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a network ACL.
+ Update a snapshot.
- This request updates a network ACL's name.
+ This request updates a snapshot with the information in a provided snapshot patch.
+ The snapshot consistency group patch object is structured in the same way as a
+ retrieved snapshot and contains only the information to be updated.
- :param str id: The network ACL identifier.
- :param NetworkACLPatch network_acl_patch: The network ACL patch.
+ :param str id: The snapshot identifier.
+ :param SnapshotPatch snapshot_patch: The snapshot 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 `NetworkACL` object
+ :rtype: DetailedResponse with `dict` result representing a `Snapshot` object
"""
if not id:
raise ValueError('id must be provided')
- if network_acl_patch is None:
- raise ValueError('network_acl_patch must be provided')
- if isinstance(network_acl_patch, NetworkACLPatch):
- network_acl_patch = convert_model(network_acl_patch)
- headers = {}
+ if snapshot_patch is None:
+ raise ValueError('snapshot_patch must be provided')
+ if isinstance(snapshot_patch, SnapshotPatch):
+ snapshot_patch = convert_model(snapshot_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_network_acl',
+ operation_id='update_snapshot',
)
headers.update(sdk_headers)
@@ -20120,7 +21002,7 @@ def update_network_acl(
'generation': self.generation,
}
- data = json.dumps(network_acl_patch)
+ data = json.dumps(snapshot_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -20131,7 +21013,7 @@ def update_network_acl(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/network_acls/{id}'.format(**path_param_dict)
+ url = '/snapshots/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -20143,49 +21025,36 @@ def update_network_acl(
response = self.send(request, **kwargs)
return response
- def list_network_acl_rules(
+ def list_snapshot_clones(
self,
- network_acl_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- direction: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List rules for a network ACL.
+ List clones for a snapshot.
- This request lists rules for a network ACL. These rules can allow or deny traffic
- between a source CIDR block and a destination CIDR block over a particular
- protocol and port range.
+ This request lists clones for a snapshot. Use a clone to quickly restore a
+ snapshot within the clone's zone.
- :param str network_acl_id: The network ACL 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 direction: (optional) Filters the collection to rules with a
- `direction` property matching the specified value.
+ :param str id: The snapshot 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 `NetworkACLRuleCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotCloneCollection` object
"""
- if not network_acl_id:
- raise ValueError('network_acl_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_network_acl_rules',
+ operation_id='list_snapshot_clones',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'direction': direction,
}
if 'headers' in kwargs:
@@ -20193,10 +21062,10 @@ def list_network_acl_rules(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['network_acl_id']
- path_param_values = self.encode_path_vars(network_acl_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 = '/network_acls/{network_acl_id}/rules'.format(**path_param_dict)
+ url = '/snapshots/{id}/clones'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -20207,38 +21076,34 @@ def list_network_acl_rules(
response = self.send(request, **kwargs)
return response
- def create_network_acl_rule(
+ def delete_snapshot_clone(
self,
- network_acl_id: str,
- network_acl_rule_prototype: 'NetworkACLRulePrototype',
+ id: str,
+ zone_name: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a rule for a network ACL.
+ Delete a snapshot clone.
- This request creates a new rule from a network ACL rule prototype object. The
- prototype object is structured in the same way as a retrieved rule, and contains
- the information necessary to create the new rule.
+ This request deletes a snapshot clone. This operation cannot be reversed, but an
+ equivalent clone may be recreated from the snapshot.
- :param str network_acl_id: The network ACL identifier.
- :param NetworkACLRulePrototype network_acl_rule_prototype: The network ACL
- rule prototype object.
+ :param str id: The snapshot identifier.
+ :param str zone_name: The zone 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 `NetworkACLRule` object
+ :rtype: DetailedResponse
"""
- if not network_acl_id:
- raise ValueError('network_acl_id must be provided')
- if network_acl_rule_prototype is None:
- raise ValueError('network_acl_rule_prototype must be provided')
- if isinstance(network_acl_rule_prototype, NetworkACLRulePrototype):
- network_acl_rule_prototype = convert_model(network_acl_rule_prototype)
+ if not id:
+ raise ValueError('id must be provided')
+ if not zone_name:
+ raise ValueError('zone_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_network_acl_rule',
+ operation_id='delete_snapshot_clone',
)
headers.update(sdk_headers)
@@ -20247,56 +21112,52 @@ def create_network_acl_rule(
'generation': self.generation,
}
- data = json.dumps(network_acl_rule_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['network_acl_id']
- path_param_values = self.encode_path_vars(network_acl_id)
+ path_param_keys = ['id', 'zone_name']
+ path_param_values = self.encode_path_vars(id, zone_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/network_acls/{network_acl_id}/rules'.format(**path_param_dict)
+ url = '/snapshots/{id}/clones/{zone_name}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_network_acl_rule(
+ def get_snapshot_clone(
self,
- network_acl_id: str,
id: str,
+ zone_name: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a network ACL rule.
+ Retrieve a snapshot clone.
- This request deletes a rule. This operation cannot be reversed.
+ This request retrieves a single clone specified by the snapshot identifier and
+ zone name in the URL.
- :param str network_acl_id: The network ACL identifier.
- :param str id: The rule identifier.
+ :param str id: The snapshot identifier.
+ :param str zone_name: The zone name.
: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 `SnapshotClone` object
"""
- if not network_acl_id:
- raise ValueError('network_acl_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if not zone_name:
+ raise ValueError('zone_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_network_acl_rule',
+ operation_id='get_snapshot_clone',
)
headers.update(sdk_headers)
@@ -20308,13 +21169,14 @@ def delete_network_acl_rule(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['network_acl_id', 'id']
- path_param_values = self.encode_path_vars(network_acl_id, id)
+ path_param_keys = ['id', 'zone_name']
+ path_param_values = self.encode_path_vars(id, zone_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/network_acls/{network_acl_id}/rules/{id}'.format(**path_param_dict)
+ url = '/snapshots/{id}/clones/{zone_name}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -20323,33 +21185,35 @@ def delete_network_acl_rule(
response = self.send(request, **kwargs)
return response
- def get_network_acl_rule(
+ def create_snapshot_clone(
self,
- network_acl_id: str,
id: str,
+ zone_name: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a network ACL rule.
+ Create a clone for a snapshot.
- This request retrieves a single rule specified by the identifier in the URL.
+ This request creates a new clone for a snapshot in the specified zone. A request
+ body is not required, and if provided, is ignored. If the snapshot already has a
+ clone in the zone, it is returned.
- :param str network_acl_id: The network ACL identifier.
- :param str id: The rule identifier.
+ :param str id: The snapshot identifier.
+ :param str zone_name: The zone 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 `NetworkACLRule` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotClone` object
"""
- if not network_acl_id:
- raise ValueError('network_acl_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if not zone_name:
+ raise ValueError('zone_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_network_acl_rule',
+ operation_id='create_snapshot_clone',
)
headers.update(sdk_headers)
@@ -20363,12 +21227,12 @@ def get_network_acl_rule(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['network_acl_id', 'id']
- path_param_values = self.encode_path_vars(network_acl_id, id)
+ path_param_keys = ['id', 'zone_name']
+ path_param_values = self.encode_path_vars(id, zone_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/network_acls/{network_acl_id}/rules/{id}'.format(**path_param_dict)
+ url = '/snapshots/{id}/clones/{zone_name}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PUT',
url=url,
headers=headers,
params=params,
@@ -20377,97 +21241,91 @@ def get_network_acl_rule(
response = self.send(request, **kwargs)
return response
- def update_network_acl_rule(
+ def list_snapshot_instance_profiles(
self,
- network_acl_id: str,
id: str,
- network_acl_rule_patch: 'NetworkACLRulePatch',
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a network ACL rule.
+ List instance profiles compatible with a snapshot.
- This request updates a rule with the information in a provided rule patch. The
- rule patch object contains only the information to be updated. The request will
- fail if the provided patch includes properties that are not used by the rule's
- protocol.
+ This request lists instance profiles compatible with a snapshot's
+ `allowed_use.instance`, `operating_system.architecture` and
+ `operating_system.user_data_format` properties, sorted by ascending `name`
+ property values. The specified snapshot must be bootable.
- :param str network_acl_id: The network ACL identifier.
- :param str id: The rule identifier.
- :param NetworkACLRulePatch network_acl_rule_patch: The network ACL rule
- patch.
+ :param str id: The snapshot 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 `NetworkACLRule` object
+ :rtype: DetailedResponse with `dict` result representing a `SnapshotInstanceProfileCollection` object
"""
- if not network_acl_id:
- raise ValueError('network_acl_id must be provided')
if not id:
raise ValueError('id must be provided')
- if network_acl_rule_patch is None:
- raise ValueError('network_acl_rule_patch must be provided')
- if isinstance(network_acl_rule_patch, NetworkACLRulePatch):
- network_acl_rule_patch = convert_model(network_acl_rule_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_network_acl_rule',
+ operation_id='list_snapshot_instance_profiles',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
- data = json.dumps(network_acl_rule_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['network_acl_id', 'id']
- path_param_values = self.encode_path_vars(network_acl_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 = '/network_acls/{network_acl_id}/rules/{id}'.format(**path_param_dict)
+ url = '/snapshots/{id}/instance_profiles'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
#########################
- # Security groups
+ # Subnets
#########################
- def list_security_groups(
+ def list_subnets(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
+ zone_name: Optional[str] = None,
vpc_id: Optional[str] = None,
vpc_crn: Optional[str] = None,
vpc_name: Optional[str] = None,
+ routing_table_id: Optional[str] = None,
+ routing_table_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List security groups.
+ List subnets.
- This request lists security groups in the region. A security group defines a set
- of packet filtering rules to allow traffic in and out of the resources targeted by
- the security group. No traffic is allowed by default. Security group rules are
- stateful so that reverse traffic in response to allowed traffic is automatically
- allowed.
+ This request lists subnets in the region. Subnets are contiguous ranges of IP
+ addresses specified in CIDR block notation. Each subnet is within a particular
+ zone and cannot span multiple zones or regions.
:param str start: (optional) A server-provided token determining what
resource to start the page on.
@@ -20475,22 +21333,28 @@ def list_security_groups(
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
:param str vpc_id: (optional) Filters the collection to resources with a
`vpc.id` property matching the specified identifier.
:param str vpc_crn: (optional) Filters the collection to resources with a
`vpc.crn` property matching the specified CRN.
:param str vpc_name: (optional) Filters the collection to resources with a
`vpc.name` property matching the exact specified name.
+ :param str routing_table_id: (optional) Filters the collection to subnets
+ with a `routing_table.id` property matching the specified identifier.
+ :param str routing_table_name: (optional) Filters the collection to subnets
+ with a `routing_table.name` property matching 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 `SecurityGroupCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `SubnetCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_security_groups',
+ operation_id='list_subnets',
)
headers.update(sdk_headers)
@@ -20500,9 +21364,12 @@ def list_security_groups(
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
+ 'zone.name': zone_name,
'vpc.id': vpc_id,
'vpc.crn': vpc_crn,
'vpc.name': vpc_name,
+ 'routing_table.id': routing_table_id,
+ 'routing_table.name': routing_table_name,
}
if 'headers' in kwargs:
@@ -20510,7 +21377,7 @@ def list_security_groups(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/security_groups'
+ url = '/subnets'
request = self.prepare_request(
method='GET',
url=url,
@@ -20521,53 +21388,34 @@ def list_security_groups(
response = self.send(request, **kwargs)
return response
- def create_security_group(
+ def create_subnet(
self,
- vpc: 'VPCIdentity',
- *,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
- rules: Optional[List['SecurityGroupRulePrototype']] = None,
+ subnet_prototype: 'SubnetPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create a security group.
+ Create a subnet.
- This request creates a new security group from a security group prototype object.
- The prototype object is structured in the same way as a retrieved security group,
- and contains the information necessary to create the new security group. If
- security group rules are included in the prototype object, those rules will be
- added to the security group. Each security group is scoped to one VPC. Only
- resources in that VPC can be added to the security group.
+ This request creates a new subnet from a subnet prototype object. The prototype
+ object is structured in the same way as a retrieved subnet, and contains the
+ information necessary to create the new subnet. For this request to succeed, the
+ prototype's CIDR block must not overlap with an existing subnet in the VPC.
- :param VPCIdentity vpc: The VPC this security group will reside in.
- :param str name: (optional) The name for this security group. The name must
- not be used by another security group for the VPC. 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) will be
- used.
- :param List[SecurityGroupRulePrototype] rules: (optional) The prototype
- objects for rules to be created for this security group. If unspecified, no
- rules will be created, resulting in no traffic being allowed.
+ :param SubnetPrototype subnet_prototype: The subnet prototype object.
: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 `SecurityGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `Subnet` object
"""
- if vpc is None:
- raise ValueError('vpc must be provided')
- vpc = convert_model(vpc)
- if resource_group is not None:
- resource_group = convert_model(resource_group)
- if rules is not None:
- rules = [convert_model(x) for x in rules]
+ if subnet_prototype is None:
+ raise ValueError('subnet_prototype must be provided')
+ if isinstance(subnet_prototype, SubnetPrototype):
+ subnet_prototype = convert_model(subnet_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_security_group',
+ operation_id='create_subnet',
)
headers.update(sdk_headers)
@@ -20576,14 +21424,7 @@ def create_security_group(
'generation': self.generation,
}
- data = {
- 'vpc': vpc,
- 'name': name,
- 'resource_group': resource_group,
- 'rules': rules,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(subnet_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -20591,7 +21432,7 @@ def create_security_group(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/security_groups'
+ url = '/subnets'
request = self.prepare_request(
method='POST',
url=url,
@@ -20603,19 +21444,23 @@ def create_security_group(
response = self.send(request, **kwargs)
return response
- def delete_security_group(
+ def delete_subnet(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a security group.
+ Delete a subnet.
- This request deletes a security group. A security group cannot be deleted if it is
- referenced by any security group targets or rules. Additionally, a VPC's default
- security group cannot be deleted. This operation cannot be reversed.
+ This request deletes a subnet. This operation cannot be reversed. For this request
+ to succeed, the subnet must not be referenced by any bare metal server network
+ interfaces, instance network interfaces, virtual network interfaces, VPN gateways,
+ or load balancers. A delete operation automatically detaches the subnet from any
+ network ACLs, public gateways, or endpoint gateways. All flow log collectors with
+ `auto_delete` set to `true` targeting the subnet or any resource in the subnet are
+ automatically deleted.
- :param str id: The security group identifier.
+ :param str id: The subnet identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
@@ -20627,7 +21472,7 @@ def delete_security_group(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_security_group',
+ operation_id='delete_subnet',
)
headers.update(sdk_headers)
@@ -20643,7 +21488,7 @@ def delete_security_group(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/security_groups/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -20654,21 +21499,20 @@ def delete_security_group(
response = self.send(request, **kwargs)
return response
- def get_security_group(
+ def get_subnet(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a security group.
+ Retrieve a subnet.
- This request retrieves a single security group specified by the identifier in the
- URL path.
+ This request retrieves a single subnet specified by the identifier in the URL.
- :param str id: The security group identifier.
+ :param str id: The subnet 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 `SecurityGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `Subnet` object
"""
if not id:
@@ -20677,7 +21521,7 @@ def get_security_group(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_security_group',
+ operation_id='get_subnet',
)
headers.update(sdk_headers)
@@ -20694,7 +21538,7 @@ def get_security_group(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/security_groups/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -20705,37 +21549,37 @@ def get_security_group(
response = self.send(request, **kwargs)
return response
- def update_security_group(
+ def update_subnet(
self,
id: str,
- security_group_patch: 'SecurityGroupPatch',
+ subnet_patch: 'SubnetPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a security group.
+ Update a subnet.
- This request updates a security group with the information provided in a security
- group patch object. The security group patch object is structured in the same way
- as a retrieved security group and contains only the information to be updated.
+ This request updates a subnet with the information in a provided subnet patch. The
+ subnet patch object is structured in the same way as a retrieved subnet and
+ contains only the information to be updated.
- :param str id: The security group identifier.
- :param SecurityGroupPatch security_group_patch: The security group patch.
+ :param str id: The subnet identifier.
+ :param SubnetPatch subnet_patch: The subnet 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 `SecurityGroup` object
+ :rtype: DetailedResponse with `dict` result representing a `Subnet` object
"""
if not id:
raise ValueError('id must be provided')
- if security_group_patch is None:
- raise ValueError('security_group_patch must be provided')
- if isinstance(security_group_patch, SecurityGroupPatch):
- security_group_patch = convert_model(security_group_patch)
+ if subnet_patch is None:
+ raise ValueError('subnet_patch must be provided')
+ if isinstance(subnet_patch, SubnetPatch):
+ subnet_patch = convert_model(subnet_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_security_group',
+ operation_id='update_subnet',
)
headers.update(sdk_headers)
@@ -20744,7 +21588,7 @@ def update_security_group(
'generation': self.generation,
}
- data = json.dumps(security_group_patch)
+ data = json.dumps(subnet_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -20755,7 +21599,7 @@ def update_security_group(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/security_groups/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -20767,31 +21611,30 @@ def update_security_group(
response = self.send(request, **kwargs)
return response
- def list_security_group_rules(
+ def get_subnet_network_acl(
self,
- security_group_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List rules in a security group.
+ Retrieve a subnet's attached network ACL.
- This request lists rules in a security group. These rules define what traffic the
- security group permits. Security group rules are stateful, such that reverse
- traffic in response to allowed traffic is automatically permitted.
+ This request retrieves the network ACL attached to the subnet specified by the
+ identifier in the URL.
- :param str security_group_id: The security group identifier.
+ :param str id: The subnet 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 `SecurityGroupRuleCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACL` object
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_security_group_rules',
+ operation_id='get_subnet_network_acl',
)
headers.update(sdk_headers)
@@ -20805,10 +21648,10 @@ def list_security_group_rules(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['security_group_id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/rules'.format(**path_param_dict)
+ url = '/subnets/{id}/network_acl'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -20819,44 +21662,36 @@ def list_security_group_rules(
response = self.send(request, **kwargs)
return response
- def create_security_group_rule(
+ def replace_subnet_network_acl(
self,
- security_group_id: str,
- security_group_rule_prototype: 'SecurityGroupRulePrototype',
+ id: str,
+ network_acl_identity: 'NetworkACLIdentity',
**kwargs,
) -> DetailedResponse:
"""
- Create a rule for a security group.
+ Replace the network ACL for a subnet.
- This request creates a new security group rule from a security group rule
- prototype object. The prototype object is structured in the same way as a
- retrieved security group rule and contains the information necessary to create the
- rule. As part of creating a new rule in a security group, the rule is applied to
- all the networking interfaces in the security group. Rules specify which IP
- traffic a security group will allow. Security group rules are stateful, such that
- reverse traffic in response to allowed traffic is automatically permitted. A rule
- allowing inbound TCP traffic on port 80 also allows outbound TCP traffic on port
- 80 without the need for an additional rule.
+ This request replaces the existing network ACL for a subnet with the network ACL
+ specified in the request body.
- :param str security_group_id: The security group identifier.
- :param SecurityGroupRulePrototype security_group_rule_prototype: The
- properties of the security group rule to be created.
+ :param str id: The subnet identifier.
+ :param NetworkACLIdentity network_acl_identity: The network ACL identity.
: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 `SecurityGroupRule` object
+ :rtype: DetailedResponse with `dict` result representing a `NetworkACL` object
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
- if security_group_rule_prototype is None:
- raise ValueError('security_group_rule_prototype must be provided')
- if isinstance(security_group_rule_prototype, SecurityGroupRulePrototype):
- security_group_rule_prototype = convert_model(security_group_rule_prototype)
+ if not id:
+ raise ValueError('id must be provided')
+ if network_acl_identity is None:
+ raise ValueError('network_acl_identity must be provided')
+ if isinstance(network_acl_identity, NetworkACLIdentity):
+ network_acl_identity = convert_model(network_acl_identity)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_security_group_rule',
+ operation_id='replace_subnet_network_acl',
)
headers.update(sdk_headers)
@@ -20865,7 +21700,7 @@ def create_security_group_rule(
'generation': self.generation,
}
- data = json.dumps(security_group_rule_prototype)
+ data = json.dumps(network_acl_identity)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -20873,12 +21708,12 @@ def create_security_group_rule(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['security_group_id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/rules'.format(**path_param_dict)
+ url = '/subnets/{id}/network_acl'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PUT',
url=url,
headers=headers,
params=params,
@@ -20888,35 +21723,30 @@ def create_security_group_rule(
response = self.send(request, **kwargs)
return response
- def delete_security_group_rule(
+ def unset_subnet_public_gateway(
self,
- security_group_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a security group rule.
+ Detach a public gateway from a subnet.
- This request deletes a security group rule. This operation cannot be reversed.
- Removing a security group rule will not end existing connections allowed by that
- rule.
+ This request detaches the public gateway from the subnet specified by the subnet
+ identifier in the URL.
- :param str security_group_id: The security group identifier.
- :param str id: The rule identifier.
+ :param str id: The subnet identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_security_group_rule',
+ operation_id='unset_subnet_public_gateway',
)
headers.update(sdk_headers)
@@ -20929,10 +21759,10 @@ def delete_security_group_rule(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['security_group_id', 'id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/rules/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}/public_gateway'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -20943,34 +21773,30 @@ def delete_security_group_rule(
response = self.send(request, **kwargs)
return response
- def get_security_group_rule(
+ def get_subnet_public_gateway(
self,
- security_group_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a security group rule.
+ Retrieve a subnet's attached public gateway.
- This request retrieves a single security group rule specified by the identifier in
- the URL path.
+ This request retrieves the public gateway attached to the subnet specified by the
+ identifier in the URL.
- :param str security_group_id: The security group identifier.
- :param str id: The rule identifier.
+ :param str id: The subnet 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 `SecurityGroupRule` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicGateway` object
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_security_group_rule',
+ operation_id='get_subnet_public_gateway',
)
headers.update(sdk_headers)
@@ -20984,10 +21810,10 @@ def get_security_group_rule(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['security_group_id', 'id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/rules/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}/public_gateway'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -20998,43 +21824,38 @@ def get_security_group_rule(
response = self.send(request, **kwargs)
return response
- def update_security_group_rule(
+ def set_subnet_public_gateway(
self,
- security_group_id: str,
id: str,
- security_group_rule_patch: 'SecurityGroupRulePatch',
+ public_gateway_identity: 'PublicGatewayIdentity',
**kwargs,
) -> DetailedResponse:
"""
- Update a security group rule.
+ Attach a public gateway to a subnet.
- This request updates a security group rule with the information in a provided rule
- patch object. The rule patch object contains only the information to be updated.
- The request will fail if the provided patch includes properties that are not used
- by the rule's protocol.
+ This request attaches the public gateway, specified in the request body, to the
+ subnet specified by the subnet identifier in the URL. The public gateway must have
+ the same VPC and zone as the subnet.
- :param str security_group_id: The security group identifier.
- :param str id: The rule identifier.
- :param SecurityGroupRulePatch security_group_rule_patch: The security group
- rule patch.
+ :param str id: The subnet identifier.
+ :param PublicGatewayIdentity public_gateway_identity: The public gateway
+ identity.
: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 `SecurityGroupRule` object
+ :rtype: DetailedResponse with `dict` result representing a `PublicGateway` object
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
- if security_group_rule_patch is None:
- raise ValueError('security_group_rule_patch must be provided')
- if isinstance(security_group_rule_patch, SecurityGroupRulePatch):
- security_group_rule_patch = convert_model(security_group_rule_patch)
+ if public_gateway_identity is None:
+ raise ValueError('public_gateway_identity must be provided')
+ if isinstance(public_gateway_identity, PublicGatewayIdentity):
+ public_gateway_identity = convert_model(public_gateway_identity)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_security_group_rule',
+ operation_id='set_subnet_public_gateway',
)
headers.update(sdk_headers)
@@ -21043,20 +21864,20 @@ def update_security_group_rule(
'generation': self.generation,
}
- data = json.dumps(security_group_rule_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = json.dumps(public_gateway_identity)
+ headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['security_group_id', 'id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/rules/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}/public_gateway'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='PUT',
url=url,
headers=headers,
params=params,
@@ -21066,156 +21887,30 @@ def update_security_group_rule(
response = self.send(request, **kwargs)
return response
- def list_security_group_targets(
- self,
- security_group_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- **kwargs,
- ) -> DetailedResponse:
- """
- List targets associated with a security group.
-
- This request lists targets associated with a security group, to which the rules in
- the security group are applied.
-
- :param str security_group_id: The security group 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 `SecurityGroupTargetCollection` object
- """
-
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='list_security_group_targets',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- 'start': start,
- 'limit': limit,
- }
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
- headers['Accept'] = 'application/json'
-
- path_param_keys = ['security_group_id']
- path_param_values = self.encode_path_vars(security_group_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/security_groups/{security_group_id}/targets'.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_security_group_target_binding(
- self,
- security_group_id: str,
- id: str,
- **kwargs,
- ) -> DetailedResponse:
- """
- Remove a target from a security group.
-
- This request removes a target from a security group. For this request to succeed,
- the target must be attached to at least one other security group. The specified
- target identifier can be:
- - A bare metal server network interface identifier
- - A virtual network interface identifier
- - A VPN server identifier
- - A load balancer identifier
- - An endpoint gateway identifier
- - An instance network interface identifier
- Security groups are stateful, so any changes to a target's security groups are
- applied to new connections. Existing connections are not affected.
-
- :param str security_group_id: The security group identifier.
- :param str id: The security group target identifier.
- :param dict headers: A `dict` containing the request headers
- :return: A `DetailedResponse` containing the result, headers and HTTP status code.
- :rtype: DetailedResponse
- """
-
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='delete_security_group_target_binding',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
-
- path_param_keys = ['security_group_id', 'id']
- path_param_values = self.encode_path_vars(security_group_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/security_groups/{security_group_id}/targets/{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_security_group_target(
+ def get_subnet_routing_table(
self,
- security_group_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a security group target.
+ Retrieve a subnet's attached routing table.
- This request retrieves a single target specified by the identifier in the URL
- path. The target must be an existing target of the security group.
+ This request retrieves the routing table attached to the subnet specified by the
+ identifier in the URL.
- :param str security_group_id: The security group identifier.
- :param str id: The security group target identifier.
+ :param str id: The subnet 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 `SecurityGroupTargetReference` object
+ :rtype: DetailedResponse with `dict` result representing a `RoutingTable` object
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_security_group_target',
+ operation_id='get_subnet_routing_table',
)
headers.update(sdk_headers)
@@ -21229,10 +21924,10 @@ def get_security_group_target(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['security_group_id', 'id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/targets/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}/routing_table'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -21243,42 +21938,40 @@ def get_security_group_target(
response = self.send(request, **kwargs)
return response
- def create_security_group_target_binding(
+ def replace_subnet_routing_table(
self,
- security_group_id: str,
id: str,
+ routing_table_identity: 'RoutingTableIdentity',
**kwargs,
) -> DetailedResponse:
"""
- Add a target to a security group.
+ Replace the routing table for a subnet.
- This request adds a resource to an existing security group. The specified target
- identifier can be:
- - A bare metal server network interface identifier
- - A virtual network interface identifier
- - A VPN server identifier
- - A load balancer identifier
- - An endpoint gateway identifier
- - An instance network interface identifier
- When a target is added to a security group, the security group rules are applied
- to the target. A request body is not required, and if provided, is ignored.
+ This request replaces the existing routing table for a subnet with the routing
+ table specified in the request body.
+ For this request to succeed, the routing table `route_direct_link_ingress`,
+ `route_internet_ingress`, `route_transit_gateway_ingress`, and
+ `route_vpc_zone_ingress` properties must be `false`.
- :param str security_group_id: The security group identifier.
- :param str id: The security group target identifier.
+ :param str id: The subnet identifier.
+ :param RoutingTableIdentity routing_table_identity: The routing table
+ identity.
: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 `SecurityGroupTargetReference` object
+ :rtype: DetailedResponse with `dict` result representing a `RoutingTable` object
"""
- if not security_group_id:
- raise ValueError('security_group_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if routing_table_identity is None:
+ raise ValueError('routing_table_identity must be provided')
+ if isinstance(routing_table_identity, RoutingTableIdentity):
+ routing_table_identity = convert_model(routing_table_identity)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_security_group_target_binding',
+ operation_id='replace_subnet_routing_table',
)
headers.update(sdk_headers)
@@ -21287,54 +21980,78 @@ def create_security_group_target_binding(
'generation': self.generation,
}
+ data = json.dumps(routing_table_identity)
+ headers['content-type'] = 'application/json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['security_group_id', 'id']
- path_param_values = self.encode_path_vars(security_group_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 = '/security_groups/{security_group_id}/targets/{id}'.format(**path_param_dict)
+ url = '/subnets/{id}/routing_table'.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
- #########################
- # VPN gateways
- #########################
-
- def list_ike_policies(
+ def list_subnet_reserved_ips(
self,
+ subnet_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ sort: Optional[str] = None,
+ target_id: Optional[str] = None,
+ target_crn: Optional[str] = None,
+ target_name: Optional[str] = None,
+ target_resource_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List IKE policies.
+ List reserved IPs in a subnet.
- This request lists IKE policies in the region.
+ This request lists reserved IPs in a subnet. A reserved IP resource will exist for
+ every address in the subnet which is not available for use.
+ :param str subnet_id: The subnet 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 str target_id: (optional) Filters the collection to resources with a
+ `target.id` property matching the specified identifier.
+ :param str target_crn: (optional) Filters the collection to resources with
+ a `target.crn` property matching the specified CRN.
+ :param str target_name: (optional) Filters the collection to resources with
+ a `target.name` property matching the exact specified name.
+ :param str target_resource_type: (optional) Filters the collection to
+ resources with a `target.resource_type` property matching the specified
+ 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 `IKEPolicyCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollection` object
"""
+ if not subnet_id:
+ raise ValueError('subnet_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_ike_policies',
+ operation_id='list_subnet_reserved_ips',
)
headers.update(sdk_headers)
@@ -21343,6 +22060,11 @@ def list_ike_policies(
'generation': self.generation,
'start': start,
'limit': limit,
+ 'sort': sort,
+ 'target.id': target_id,
+ 'target.crn': target_crn,
+ 'target.name': target_name,
+ 'target.resource_type': target_resource_type,
}
if 'headers' in kwargs:
@@ -21350,7 +22072,10 @@ def list_ike_policies(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/ike_policies'
+ path_param_keys = ['subnet_id']
+ path_param_values = self.encode_path_vars(subnet_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/subnets/{subnet_id}/reserved_ips'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -21361,55 +22086,56 @@ def list_ike_policies(
response = self.send(request, **kwargs)
return response
- def create_ike_policy(
+ def create_subnet_reserved_ip(
self,
- authentication_algorithm: str,
- dh_group: int,
- encryption_algorithm: str,
- ike_version: int,
+ subnet_id: str,
*,
- key_lifetime: Optional[int] = None,
+ address: Optional[str] = None,
+ auto_delete: Optional[bool] = None,
name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
+ target: Optional['ReservedIPTargetPrototype'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create an IKE policy.
+ Reserve an IP in a subnet.
- This request creates a new IKE policy.
+ This request reserves an IP address in a subnet. If the provided prototype object
+ includes an `address`, the address must not already be reserved.
- :param str authentication_algorithm: The authentication algorithm.
- :param int dh_group: The Diffie-Hellman group.
- :param str encryption_algorithm: The encryption algorithm.
- :param int ike_version: The IKE protocol version.
- :param int key_lifetime: (optional) The key lifetime in seconds.
- :param str name: (optional) The name for this IKE policy. The name must not
- be used by another IKE policies in the region. 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) will be
- used.
+ :param str subnet_id: The subnet identifier.
+ :param str address: (optional) The IP address to reserve, which must not
+ already be reserved on the subnet.
+ If unspecified, an available address on the subnet will automatically be
+ selected.
+ :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 name for this reserved IP. The name must
+ not be used by another reserved IP in the subnet. Names starting with
+ `ibm-` are reserved for provider-owned resources, and are not allowed. If
+ unspecified, the name will be a hyphenated list of randomly-selected words.
+ :param ReservedIPTargetPrototype target: (optional) The target to bind this
+ reserved IP to. The target must be in the same VPC.
+ The following targets are supported:
+ - An endpoint gateway not already bound to a reserved IP in the subnet's
+ zone.
+ - A virtual network interface.
+ If unspecified, the reserved IP will be created unbound.
: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 `IKEPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
"""
- if authentication_algorithm is None:
- raise ValueError('authentication_algorithm must be provided')
- if dh_group is None:
- raise ValueError('dh_group must be provided')
- if encryption_algorithm is None:
- raise ValueError('encryption_algorithm must be provided')
- if ike_version is None:
- raise ValueError('ike_version must be provided')
- if resource_group is not None:
- resource_group = convert_model(resource_group)
+ if not subnet_id:
+ raise ValueError('subnet_id must be provided')
+ 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_ike_policy',
+ operation_id='create_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -21419,13 +22145,10 @@ def create_ike_policy(
}
data = {
- 'authentication_algorithm': authentication_algorithm,
- 'dh_group': dh_group,
- 'encryption_algorithm': encryption_algorithm,
- 'ike_version': ike_version,
- 'key_lifetime': key_lifetime,
+ 'address': address,
+ 'auto_delete': auto_delete,
'name': name,
- 'resource_group': resource_group,
+ 'target': target,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -21436,7 +22159,10 @@ def create_ike_policy(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/ike_policies'
+ path_param_keys = ['subnet_id']
+ path_param_values = self.encode_path_vars(subnet_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/subnets/{subnet_id}/reserved_ips'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -21448,31 +22174,37 @@ def create_ike_policy(
response = self.send(request, **kwargs)
return response
- def delete_ike_policy(
+ def delete_subnet_reserved_ip(
self,
+ subnet_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an IKE policy.
+ Delete a reserved IP.
- This request deletes an IKE policy. This operation cannot be reversed. For this
- request to succeed, there must not be any VPN gateway connections using this
- policy.
+ This request releases a reserved IP. This operation cannot be reversed.
+ For this request to succeed, the reserved IP must not be required by another
+ resource, such as a bare metal server network interface, instance network
+ interface or virtual network interface for which it is the primary IP. A
+ provider-owned reserved IP is not allowed to be deleted.
- :param str id: The IKE policy identifier.
+ :param str subnet_id: The subnet 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 not subnet_id:
+ raise ValueError('subnet_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_ike_policy',
+ operation_id='delete_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -21485,10 +22217,10 @@ def delete_ike_policy(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['subnet_id', 'id']
+ path_param_values = self.encode_path_vars(subnet_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/ike_policies/{id}'.format(**path_param_dict)
+ url = '/subnets/{subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -21499,29 +22231,34 @@ def delete_ike_policy(
response = self.send(request, **kwargs)
return response
- def get_ike_policy(
+ def get_subnet_reserved_ip(
self,
+ subnet_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an IKE policy.
+ Retrieve a reserved IP.
- This request retrieves a single IKE policy specified by the identifier in the URL.
+ This request retrieves a single reserved IP specified by the identifier in the
+ URL.
- :param str id: The IKE policy identifier.
+ :param str subnet_id: The subnet 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 `IKEPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
"""
+ if not subnet_id:
+ raise ValueError('subnet_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_ike_policy',
+ operation_id='get_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -21535,10 +22272,10 @@ def get_ike_policy(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['subnet_id', 'id']
+ path_param_values = self.encode_path_vars(subnet_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/ike_policies/{id}'.format(**path_param_dict)
+ url = '/subnets/{subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -21549,35 +22286,42 @@ def get_ike_policy(
response = self.send(request, **kwargs)
return response
- def update_ike_policy(
+ def update_subnet_reserved_ip(
self,
+ subnet_id: str,
id: str,
- ike_policy_patch: 'IKEPolicyPatch',
+ reserved_ip_patch: 'ReservedIPPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an IKE policy.
+ Update a reserved IP.
- This request updates the properties of an existing IKE policy.
+ This request updates a reserved IP with the information in a provided reserved IP
+ patch. The reserved IP patch object is structured in the same way as a retrieved
+ reserved IP and contains only the information to be updated.
+ A provider-owned reserved IP is not allowed to be updated.
- :param str id: The IKE policy identifier.
- :param IKEPolicyPatch ike_policy_patch: The IKE policy patch.
+ :param str subnet_id: The subnet identifier.
+ :param str id: The reserved IP identifier.
+ :param ReservedIPPatch reserved_ip_patch: The reserved IP 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 `IKEPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object
"""
+ if not subnet_id:
+ raise ValueError('subnet_id must be provided')
if not id:
raise ValueError('id must be provided')
- if ike_policy_patch is None:
- raise ValueError('ike_policy_patch must be provided')
- if isinstance(ike_policy_patch, IKEPolicyPatch):
- ike_policy_patch = convert_model(ike_policy_patch)
+ if reserved_ip_patch is None:
+ raise ValueError('reserved_ip_patch must be provided')
+ if isinstance(reserved_ip_patch, ReservedIPPatch):
+ reserved_ip_patch = convert_model(reserved_ip_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_ike_policy',
+ operation_id='update_subnet_reserved_ip',
)
headers.update(sdk_headers)
@@ -21586,7 +22330,7 @@ def update_ike_policy(
'generation': self.generation,
}
- data = json.dumps(ike_policy_patch)
+ data = json.dumps(reserved_ip_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -21594,10 +22338,10 @@ def update_ike_policy(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['subnet_id', 'id']
+ path_param_values = self.encode_path_vars(subnet_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/ike_policies/{id}'.format(**path_param_dict)
+ url = '/subnets/{subnet_id}/reserved_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -21609,89 +22353,46 @@ def update_ike_policy(
response = self.send(request, **kwargs)
return response
- def list_ike_policy_connections(
- self,
- id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- **kwargs,
- ) -> DetailedResponse:
- """
- List VPN gateway connections that use a specified IKE policy.
-
- This request lists VPN gateway connections that use an IKE policy.
-
- :param str id: The IKE 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 `IKEPolicyConnectionCollection` object
- """
-
- if not id:
- raise ValueError('id must be provided')
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='list_ike_policy_connections',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- 'start': start,
- 'limit': limit,
- }
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['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 = '/ike_policies/{id}/connections'.format(**path_param_dict)
- request = self.prepare_request(
- method='GET',
- url=url,
- headers=headers,
- params=params,
- )
-
- response = self.send(request, **kwargs)
- return response
+ #########################
+ # Virtual network interfaces
+ #########################
- def list_ipsec_policies(
+ def list_virtual_network_interfaces(
self,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List IPsec policies.
+ List virtual network interfaces.
- This request lists IPsec policies in the region.
+ This request lists virtual network interfaces in the region. A virtual network
+ interface is a logical abstraction of a virtual network interface in a subnet, and
+ may be attached to a target resource.
+ The virtual network interfaces will be sorted by their `created_at` property
+ values, with newest virtual network interfaces first. Virtual network interfaces
+ with identical
+ `created_at` property values will in turn be sorted by ascending `name` property
+ values.
: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 with a `resource_group.id` property matching 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 `IPsecPolicyCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VirtualNetworkInterfaceCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_ipsec_policies',
+ operation_id='list_virtual_network_interfaces',
)
headers.update(sdk_headers)
@@ -21700,6 +22401,7 @@ def list_ipsec_policies(
'generation': self.generation,
'start': start,
'limit': limit,
+ 'resource_group.id': resource_group_id,
}
if 'headers' in kwargs:
@@ -21707,7 +22409,7 @@ def list_ipsec_policies(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/ipsec_policies'
+ url = '/virtual_network_interfaces'
request = self.prepare_request(
method='GET',
url=url,
@@ -21718,59 +22420,118 @@ def list_ipsec_policies(
response = self.send(request, **kwargs)
return response
- def create_ipsec_policy(
+ def create_virtual_network_interface(
self,
- authentication_algorithm: str,
- encryption_algorithm: str,
- pfs: str,
*,
- key_lifetime: Optional[int] = None,
+ allow_ip_spoofing: Optional[bool] = None,
+ auto_delete: Optional[bool] = None,
+ enable_infrastructure_nat: Optional[bool] = None,
+ ips: Optional[List['VirtualNetworkInterfaceIPPrototype']] = None,
name: Optional[str] = None,
+ primary_ip: Optional['VirtualNetworkInterfacePrimaryIPPrototype'] = None,
+ protocol_state_filtering_mode: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
+ security_groups: Optional[List['SecurityGroupIdentity']] = None,
+ subnet: Optional['SubnetIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create an IPsec policy.
+ Create a virtual network interface.
- This request creates a new IPsec policy.
+ This request creates a new virtual network interface from a virtual network
+ interface prototype object. The prototype object is structured in the same way as
+ a retrieved virtual network interface, and contains the information necessary to
+ create the new virtual network interface.
- :param str authentication_algorithm: The authentication algorithm
- Must be `disabled` if and only if the `encryption_algorithm` is
- `aes128gcm16`,
- `aes192gcm16`, or `aes256gcm16`
- The `md5` and `sha1` algorithms have been deprecated.
- :param str encryption_algorithm: The encryption algorithm
- The `authentication_algorithm` must be `disabled` if and only if
- `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`
- The `triple_des` algorithm has been deprecated.
- :param str pfs: The Perfect Forward Secrecy group.
- Groups `group_2` and `group_5` have been deprecated.
- :param int key_lifetime: (optional) The key lifetime in seconds.
- :param str name: (optional) The name for this IPsec policy. The name must
- not be used by another IPsec policies in the region. If unspecified, the
- name will be a hyphenated list of randomly-selected words.
+ :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 auto_delete: (optional) Indicates whether this virtual network
+ interface will be automatically deleted when
+ `target` is deleted. Must be `false` if the virtual network interface is
+ unbound.
+ :param bool enable_infrastructure_nat: (optional) If `true`:
+ - The VPC infrastructure performs any needed NAT operations.
+ - `floating_ips` must not have more than one floating IP.
+ If `false`:
+ - Packets are passed unchanged to/from the virtual network interface,
+ allowing the workload to perform any needed NAT operations.
+ - `allow_ip_spoofing` must be `false`.
+ - Can only be attached to a `target` with a `resource_type` of
+ `bare_metal_server_network_attachment`.
+ :param List[VirtualNetworkInterfaceIPPrototype] ips: (optional) The
+ additional IP addresses to bind to the virtual network interface. Each item
+ may be either a reserved IP identity, or a reserved IP prototype object
+ which will be used to create a new reserved IP. All IP addresses must be in
+ the primary IP's subnet.
+ If reserved IP identities are provided, the specified reserved IPs must be
+ unbound.
+ If reserved IP prototype objects with addresses are provided, the addresses
+ must be available on the virtual network interface's subnet. For any
+ prototype objects that do not specify an address, an available address on
+ the subnet will be automatically selected and reserved.
+ :param str name: (optional) The name for this virtual network interface.
+ The name must not be used by another virtual network interface in the VPC.
+ If unspecified, the name will be a hyphenated list of randomly-selected
+ words. Names beginning with `ibm-` are reserved for provider-owned
+ resources, and are not allowed.
+ :param VirtualNetworkInterfacePrimaryIPPrototype primary_ip: (optional) The
+ primary IP address to bind to the virtual network interface. May be either
+ a
+ reserved IP identity, or a reserved IP prototype object which will be used
+ to create a
+ new reserved IP.
+ If a reserved IP identity is provided, the specified reserved IP must be
+ unbound.
+ If a reserved IP prototype object with an address is provided, the address
+ must be
+ available on the virtual network interface's subnet. If no address is
+ specified,
+ an available address on the subnet will be automatically selected and
+ reserved.
+ :param str protocol_state_filtering_mode: (optional) The protocol state
+ filtering mode to use for this virtual network interface. If
+ `auto`, protocol state packet filtering is enabled or disabled based on the
+ virtual network interface's `target` resource type:
+ - `bare_metal_server_network_attachment`: disabled
+ - `instance_network_attachment`: enabled
+ - `share_mount_target`: enabled
+ Protocol state filtering monitors each network connection flowing over this
+ virtual network interface, and drops any packets that are invalid based on
+ the current connection state and protocol. See [Protocol state filtering
+ mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering)
+ for more information.
: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) will be
used.
+ :param List[SecurityGroupIdentity] security_groups: (optional) The security
+ groups to use for this virtual network interface. If unspecified, the
+ default security group of the VPC for the subnet is used.
+ :param SubnetIdentity subnet: (optional) The associated subnet. Required if
+ `primary_ip` does not specify a reserved IP
+ identity.
: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 `IPsecPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `VirtualNetworkInterface` object
"""
- if authentication_algorithm is None:
- raise ValueError('authentication_algorithm must be provided')
- if encryption_algorithm is None:
- raise ValueError('encryption_algorithm must be provided')
- if pfs is None:
- raise ValueError('pfs must be provided')
+ if ips is not None:
+ ips = [convert_model(x) for x in ips]
+ if primary_ip is not None:
+ primary_ip = convert_model(primary_ip)
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 subnet is not None:
+ subnet = convert_model(subnet)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_ipsec_policy',
+ operation_id='create_virtual_network_interface',
)
headers.update(sdk_headers)
@@ -21780,12 +22541,16 @@ def create_ipsec_policy(
}
data = {
- 'authentication_algorithm': authentication_algorithm,
- 'encryption_algorithm': encryption_algorithm,
- 'pfs': pfs,
- 'key_lifetime': key_lifetime,
+ 'allow_ip_spoofing': allow_ip_spoofing,
+ 'auto_delete': auto_delete,
+ 'enable_infrastructure_nat': enable_infrastructure_nat,
+ 'ips': ips,
'name': name,
+ 'primary_ip': primary_ip,
+ 'protocol_state_filtering_mode': protocol_state_filtering_mode,
'resource_group': resource_group,
+ 'security_groups': security_groups,
+ 'subnet': subnet,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -21796,7 +22561,7 @@ def create_ipsec_policy(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/ipsec_policies'
+ url = '/virtual_network_interfaces'
request = self.prepare_request(
method='POST',
url=url,
@@ -21808,22 +22573,23 @@ def create_ipsec_policy(
response = self.send(request, **kwargs)
return response
- def delete_ipsec_policy(
+ def delete_virtual_network_interfaces(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an IPsec policy.
+ Delete a virtual network interface.
- This request deletes an IPsec policy. This operation cannot be reversed. For this
- request to succeed, there must not be any VPN gateway connections using this
- policy.
+ This request deletes a virtual network interface. This operation cannot be
+ reversed. For this request to succeed, the virtual network interface must not be
+ required by another resource, such as the primary network attachment for an
+ instance.
- :param str id: The IPsec policy identifier.
+ :param str id: The virtual 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
+ :rtype: DetailedResponse with `dict` result representing a `VirtualNetworkInterface` object
"""
if not id:
@@ -21832,7 +22598,7 @@ def delete_ipsec_policy(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_ipsec_policy',
+ operation_id='delete_virtual_network_interfaces',
)
headers.update(sdk_headers)
@@ -21844,11 +22610,12 @@ def delete_ipsec_policy(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/ipsec_policies/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -21859,21 +22626,21 @@ def delete_ipsec_policy(
response = self.send(request, **kwargs)
return response
- def get_ipsec_policy(
+ def get_virtual_network_interface(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an IPsec policy.
+ Retrieve a virtual network interface.
- This request retrieves a single IPsec policy specified by the identifier in the
- URL.
+ This request retrieves a single virtual network interface specified by the
+ identifier in the URL.
- :param str id: The IPsec policy identifier.
+ :param str id: The virtual 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 `IPsecPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `VirtualNetworkInterface` object
"""
if not id:
@@ -21882,7 +22649,7 @@ def get_ipsec_policy(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_ipsec_policy',
+ operation_id='get_virtual_network_interface',
)
headers.update(sdk_headers)
@@ -21899,7 +22666,7 @@ def get_ipsec_policy(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/ipsec_policies/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -21910,35 +22677,39 @@ def get_ipsec_policy(
response = self.send(request, **kwargs)
return response
- def update_ipsec_policy(
+ def update_virtual_network_interface(
self,
id: str,
- i_psec_policy_patch: 'IPsecPolicyPatch',
+ virtual_network_interface_patch: 'VirtualNetworkInterfacePatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an IPsec policy.
+ Update a virtual network interface.
- This request updates the properties of an existing IPsec policy.
+ This request updates a virtual network interface with the information in a
+ provided virtual network interface patch. The virtual network interface patch
+ object is structured in the same way as a retrieved virtual network interface and
+ contains only the information to be updated.
- :param str id: The IPsec policy identifier.
- :param IPsecPolicyPatch i_psec_policy_patch: The IPsec policy patch.
+ :param str id: The virtual network interface identifier.
+ :param VirtualNetworkInterfacePatch virtual_network_interface_patch: The
+ virtual network interface 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 `IPsecPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `VirtualNetworkInterface` object
"""
if not id:
raise ValueError('id must be provided')
- if i_psec_policy_patch is None:
- raise ValueError('i_psec_policy_patch must be provided')
- if isinstance(i_psec_policy_patch, IPsecPolicyPatch):
- i_psec_policy_patch = convert_model(i_psec_policy_patch)
+ if virtual_network_interface_patch is None:
+ raise ValueError('virtual_network_interface_patch must be provided')
+ if isinstance(virtual_network_interface_patch, VirtualNetworkInterfacePatch):
+ virtual_network_interface_patch = convert_model(virtual_network_interface_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_ipsec_policy',
+ operation_id='update_virtual_network_interface',
)
headers.update(sdk_headers)
@@ -21947,7 +22718,7 @@ def update_ipsec_policy(
'generation': self.generation,
}
- data = json.dumps(i_psec_policy_patch)
+ data = json.dumps(virtual_network_interface_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -21958,7 +22729,7 @@ def update_ipsec_policy(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/ipsec_policies/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -21970,35 +22741,42 @@ def update_ipsec_policy(
response = self.send(request, **kwargs)
return response
- def list_ipsec_policy_connections(
+ def list_network_interface_floating_ips(
self,
- id: str,
+ virtual_network_interface_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List VPN gateway connections that use a specified IPsec policy.
+ List floating IPs associated with a virtual network interface.
- This request lists VPN gateway connections that use an IPsec policy.
+ This request lists floating IPs associated with a virtual network interface.
- :param str id: The IPsec policy identifier.
+ :param str virtual_network_interface_id: The virtual network interface
+ 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
+ `-name` sorts the collection by the `name` 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 `IPsecPolicyConnectionCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIPCollectionVirtualNetworkInterfaceContext` object
"""
- if not id:
- raise ValueError('id must be provided')
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_ipsec_policy_connections',
+ operation_id='list_network_interface_floating_ips',
)
headers.update(sdk_headers)
@@ -22007,6 +22785,7 @@ def list_ipsec_policy_connections(
'generation': self.generation,
'start': start,
'limit': limit,
+ 'sort': sort,
}
if 'headers' in kwargs:
@@ -22014,10 +22793,10 @@ def list_ipsec_policy_connections(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['virtual_network_interface_id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/ipsec_policies/{id}/connections'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -22028,65 +22807,53 @@ def list_ipsec_policy_connections(
response = self.send(request, **kwargs)
return response
- def list_vpn_gateways(
+ def remove_network_interface_floating_ip(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- sort: Optional[str] = None,
- mode: Optional[str] = None,
+ virtual_network_interface_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List VPN gateways.
+ Disassociate a floating IP from a virtual network interface.
- This request lists VPN gateways in the region.
+ This request disassociates the specified floating IP from the specified virtual
+ network interface.
- :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 with a `resource_group.id` property matching the specified
+ :param str virtual_network_interface_id: The virtual network interface
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 str mode: (optional) Filters the collection to VPN gateways with a
- `mode` property matching the specified value.
+ :param str id: The floating 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 `VPNGatewayCollection` object
+ :rtype: DetailedResponse
"""
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpn_gateways',
+ operation_id='remove_network_interface_floating_ip',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'resource_group.id': resource_group_id,
- 'sort': sort,
- 'mode': mode,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- url = '/vpn_gateways'
+ path_param_keys = ['virtual_network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -22095,32 +22862,35 @@ def list_vpn_gateways(
response = self.send(request, **kwargs)
return response
- def create_vpn_gateway(
+ def get_network_interface_floating_ip(
self,
- vpn_gateway_prototype: 'VPNGatewayPrototype',
+ virtual_network_interface_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a VPN gateway.
+ Retrieve associated floating IP.
- This request creates a new VPN gateway.
+ This request retrieves a specified floating IP if it is associated with the
+ virtual network interface specified in the URL.
- :param VPNGatewayPrototype vpn_gateway_prototype: The VPN gateway prototype
- object.
+ :param str virtual_network_interface_id: The virtual network interface
+ identifier.
+ :param str id: The floating 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 `VPNGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `FloatingIPReference` object
"""
- if vpn_gateway_prototype is None:
- raise ValueError('vpn_gateway_prototype must be provided')
- if isinstance(vpn_gateway_prototype, VPNGatewayPrototype):
- vpn_gateway_prototype = convert_model(vpn_gateway_prototype)
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpn_gateway',
+ operation_id='get_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -22129,52 +22899,66 @@ def create_vpn_gateway(
'generation': self.generation,
}
- data = json.dumps(vpn_gateway_prototype)
- headers['content-type'] = 'application/json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/vpn_gateways'
+ path_param_keys = ['virtual_network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_vpn_gateway(
+ def add_network_interface_floating_ip(
self,
+ virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPN gateway.
+ Add an association between a floating IP and a virtual network interface.
- This request deletes a VPN gateway. This operation cannot be reversed. For this
- request to succeed, the VPN gateway must not have a `status` of `pending`, and
- there must not be any VPC routes using the VPN gateway's connections as a next
- hop.
+ This request adds an association between the specified floating IP and the
+ specified virtual network interface.
+ If the virtual network interface has `enable_infrastructure_nat` set to `true`, no
+ more than one floating IP can be associated, and network address translation is
+ performed between the floating IP address and the virtual network interface's
+ `primary_ip` address.
+ If the virtual network interface has `enable_infrastructure_nat` set to `false`,
+ packets are passed unchanged to/from the virtual network interface.
+ The floating IP must:
+ - be in the same `zone` as the virtual network interface
+ - not currently be associated with another resource
+ The virtual network interface's `target` must not currently be a file share mount
+ target.
+ A request body is not required, and if provided, is ignored.
- :param str id: The VPN gateway identifier.
+ :param str virtual_network_interface_id: The virtual network interface
+ identifier.
+ :param str id: The floating IP 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 `FloatingIPReference` object
"""
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpn_gateway',
+ operation_id='add_network_interface_floating_ip',
)
headers.update(sdk_headers)
@@ -22186,164 +22970,58 @@ def delete_vpn_gateway(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = '/vpn_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_vpn_gateway(
- self,
- id: str,
- **kwargs,
- ) -> DetailedResponse:
- """
- Retrieve a VPN gateway.
-
- This request retrieves a single VPN gateway specified by the identifier in the
- URL.
-
- :param str id: The VPN 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 `VPNGateway` object
- """
-
- if not id:
- raise ValueError('id must be provided')
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='get_vpn_gateway',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['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 = '/vpn_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_vpn_gateway(
- self,
- id: str,
- vpn_gateway_patch: 'VPNGatewayPatch',
- **kwargs,
- ) -> DetailedResponse:
- """
- Update a VPN gateway.
-
- This request updates the properties of an existing VPN gateway.
-
- :param str id: The VPN gateway identifier.
- :param VPNGatewayPatch vpn_gateway_patch: The VPN 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 `VPNGateway` object
- """
-
- if not id:
- raise ValueError('id must be provided')
- if vpn_gateway_patch is None:
- raise ValueError('vpn_gateway_patch must be provided')
- if isinstance(vpn_gateway_patch, VPNGatewayPatch):
- vpn_gateway_patch = convert_model(vpn_gateway_patch)
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='update_vpn_gateway',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
-
- data = json.dumps(vpn_gateway_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
- headers['Accept'] = 'application/json'
-
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['virtual_network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_vpn_gateway_connections(
+ def list_virtual_network_interface_ips(
self,
- vpn_gateway_id: str,
+ virtual_network_interface_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
- status: Optional[str] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List connections of a VPN gateway.
+ List reserved IPs bound to a virtual network interface.
- This request lists connections of a VPN gateway.
+ This request lists reserved IPs bound to a virtual network interface.
- :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str virtual_network_interface_id: The virtual network interface
+ 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 status: (optional) Filters the collection to VPN gateway
- connections with a `status` property matching the specified value.
+ :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
+ `-name` sorts the collection by the `name` 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 `VPNGatewayConnectionCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollectionVirtualNetworkInterfaceContext` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpn_gateway_connections',
+ operation_id='list_virtual_network_interface_ips',
)
headers.update(sdk_headers)
@@ -22352,7 +23030,7 @@ def list_vpn_gateway_connections(
'generation': self.generation,
'start': start,
'limit': limit,
- 'status': status,
+ 'sort': sort,
}
if 'headers' in kwargs:
@@ -22360,10 +23038,10 @@ def list_vpn_gateway_connections(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id']
- path_param_values = self.encode_path_vars(vpn_gateway_id)
+ path_param_keys = ['virtual_network_interface_id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/ips'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -22374,96 +23052,37 @@ def list_vpn_gateway_connections(
response = self.send(request, **kwargs)
return response
- def create_vpn_gateway_connection(
- self,
- vpn_gateway_id: str,
- vpn_gateway_connection_prototype: 'VPNGatewayConnectionPrototype',
- **kwargs,
- ) -> DetailedResponse:
- """
- Create a connection for a VPN gateway.
-
- This request creates a new VPN gateway connection.
-
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param VPNGatewayConnectionPrototype vpn_gateway_connection_prototype: The
- VPN gateway connection prototype object.
- :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 `VPNGatewayConnection` object
- """
-
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
- if vpn_gateway_connection_prototype is None:
- raise ValueError('vpn_gateway_connection_prototype must be provided')
- if isinstance(vpn_gateway_connection_prototype, VPNGatewayConnectionPrototype):
- vpn_gateway_connection_prototype = convert_model(vpn_gateway_connection_prototype)
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='create_vpn_gateway_connection',
- )
- headers.update(sdk_headers)
-
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
-
- data = json.dumps(vpn_gateway_connection_prototype)
- headers['content-type'] = 'application/json'
-
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
- headers['Accept'] = 'application/json'
-
- path_param_keys = ['vpn_gateway_id']
- path_param_values = self.encode_path_vars(vpn_gateway_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections'.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_vpn_gateway_connection(
+ def remove_virtual_network_interface_ip(
self,
- vpn_gateway_id: str,
+ virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPN gateway connection.
+ Unbind a reserved IP from a virtual network interface.
- This request deletes a VPN gateway connection. This operation cannot be reversed.
- For this request to succeed, there must not be VPC routes using this VPN
- connection as a next hop.
+ This request unbinds the specified reserved IP from the specified virtual network
+ interface. If the reserved IP has `auto_delete` set to `true`, the reserved IP
+ will be deleted.
+ The reserved IP for the `primary_ip` cannot be unbound.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
+ :param str virtual_network_interface_id: The virtual 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
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpn_gateway_connection',
+ operation_id='remove_virtual_network_interface_ip',
)
headers.update(sdk_headers)
@@ -22476,10 +23095,10 @@ def delete_vpn_gateway_connection(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['vpn_gateway_id', 'id']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id)
+ path_param_keys = ['virtual_network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -22490,34 +23109,35 @@ def delete_vpn_gateway_connection(
response = self.send(request, **kwargs)
return response
- def get_vpn_gateway_connection(
+ def get_virtual_network_interface_ip(
self,
- vpn_gateway_id: str,
+ virtual_network_interface_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPN gateway connection.
+ Retrieve bound reserved IP.
- This request retrieves a single VPN gateway connection specified by the identifier
- in the URL.
+ This request retrieves the specified reserved IP address if it is bound to the
+ virtual network interface specified in the URL.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
+ :param str virtual_network_interface_id: The virtual 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 `VPNGatewayConnection` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIPReference` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpn_gateway_connection',
+ operation_id='get_virtual_network_interface_ip',
)
headers.update(sdk_headers)
@@ -22531,10 +23151,10 @@ def get_vpn_gateway_connection(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id)
+ path_param_keys = ['virtual_network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -22545,40 +23165,38 @@ def get_vpn_gateway_connection(
response = self.send(request, **kwargs)
return response
- def update_vpn_gateway_connection(
+ def add_virtual_network_interface_ip(
self,
- vpn_gateway_id: str,
+ virtual_network_interface_id: str,
id: str,
- vpn_gateway_connection_patch: 'VPNGatewayConnectionPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a VPN gateway connection.
+ Bind a reserved IP to a virtual network interface.
- This request updates the properties of an existing VPN gateway connection.
+ This request binds the specified reserved IP to the specified virtual network
+ interface.
+ The reserved IP must currently be unbound and in the primary IP's subnet. The
+ virtual network interface's `target` must not currently be a file share mount
+ target.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param VPNGatewayConnectionPatch vpn_gateway_connection_patch: The VPN
- gateway connection patch.
+ :param str virtual_network_interface_id: The virtual 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 `VPNGatewayConnection` object
+ :rtype: DetailedResponse with `dict` result representing a `ReservedIPReference` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
+ if not virtual_network_interface_id:
+ raise ValueError('virtual_network_interface_id must be provided')
if not id:
raise ValueError('id must be provided')
- if vpn_gateway_connection_patch is None:
- raise ValueError('vpn_gateway_connection_patch must be provided')
- if isinstance(vpn_gateway_connection_patch, VPNGatewayConnectionPatch):
- vpn_gateway_connection_patch = convert_model(vpn_gateway_connection_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpn_gateway_connection',
+ operation_id='add_virtual_network_interface_ip',
)
headers.update(sdk_headers)
@@ -22587,63 +23205,65 @@ def update_vpn_gateway_connection(
'generation': self.generation,
}
- data = json.dumps(vpn_gateway_connection_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id)
+ path_param_keys = ['virtual_network_interface_id', 'id']
+ path_param_values = self.encode_path_vars(virtual_network_interface_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}'.format(**path_param_dict)
+ url = '/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_vpn_gateway_connections_local_cidrs(
+ #########################
+ # Volumes
+ #########################
+
+ def list_volume_profiles(
self,
- vpn_gateway_id: str,
- id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List local CIDRs for a VPN gateway connection.
+ List volume profiles.
- This request lists local CIDRs for a VPN gateway connection.
- This request is only supported for policy mode VPN gateways.
+ This request lists [volume
+ profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles)
+ available in the region. A volume profile specifies the performance
+ characteristics and pricing model for a volume.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection 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 `VPNGatewayConnectionCIDRs` object
+ :rtype: DetailedResponse with `dict` result representing a `VolumeProfileCollection` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
- if not id:
- raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpn_gateway_connections_local_cidrs',
+ operation_id='list_volume_profiles',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -22651,10 +23271,7 @@ def list_vpn_gateway_connections_local_cidrs(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs'.format(**path_param_dict)
+ url = '/volume/profiles'
request = self.prepare_request(
method='GET',
url=url,
@@ -22665,38 +23282,29 @@ def list_vpn_gateway_connections_local_cidrs(
response = self.send(request, **kwargs)
return response
- def remove_vpn_gateway_connections_local_cidr(
+ def get_volume_profile(
self,
- vpn_gateway_id: str,
- id: str,
- cidr: str,
+ name: str,
**kwargs,
) -> DetailedResponse:
"""
- Remove a local CIDR from a VPN gateway connection.
+ Retrieve a volume profile.
- This request removes a CIDR from a VPN gateway connection.
- This request is only supported for policy mode VPN gateways.
+ This request retrieves a single volume profile specified by the name in the URL.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param str cidr: The IP address range in CIDR block notation.
+ :param str name: The volume profile name.
: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 `VolumeProfile` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if not cidr:
- raise ValueError('cidr must be provided')
+ if not name:
+ raise ValueError('name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='remove_vpn_gateway_connections_local_cidr',
+ operation_id='get_volume_profile',
)
headers.update(sdk_headers)
@@ -22708,13 +23316,14 @@ def remove_vpn_gateway_connections_local_cidr(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
+ path_param_keys = ['name']
+ path_param_values = self.encode_path_vars(name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}'.format(**path_param_dict)
+ url = '/volume/profiles/{name}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -22723,55 +23332,84 @@ def remove_vpn_gateway_connections_local_cidr(
response = self.send(request, **kwargs)
return response
- def check_vpn_gateway_connections_local_cidr(
+ def list_volumes(
self,
- vpn_gateway_id: str,
- id: str,
- cidr: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ attachment_state: Optional[str] = None,
+ encryption: Optional[str] = None,
+ name: Optional[str] = None,
+ operating_system_family: Optional[str] = None,
+ operating_system_architecture: Optional[str] = None,
+ tag: Optional[str] = None,
+ zone_name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Check if the specified local CIDR exists on a VPN gateway connection.
+ List volumes.
- 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.
+ This request lists volumes in the region. Volumes are network-connected block
+ storage devices that may be attached to one or more instances in the same region.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param str cidr: The IP address range in CIDR block notation.
+ :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 attachment_state: (optional) Filters the collection to volumes
+ with an `attachment_state` property matching the specified value.
+ :param str encryption: (optional) Filters the collection to resources with
+ an `encryption` property matching the specified value.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str operating_system_family: (optional) Filters the collection to
+ resources with an `operating_system.family` property matching the specified
+ operating system family.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no operating system or any operating
+ system, respectively.
+ :param str operating_system_architecture: (optional) Filters the collection
+ to resources with an `operating_system.architecture` property matching the
+ specified operating system architecture.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no operating system or any operating
+ system, respectively.
+ :param str tag: (optional) Filters the collection to resources with an item
+ in the `tags` property matching the exact specified tag.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching 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
+ :rtype: DetailedResponse with `dict` result representing a `VolumeCollection` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if not cidr:
- raise ValueError('cidr must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='check_vpn_gateway_connections_local_cidr',
+ operation_id='list_volumes',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'attachment_state': attachment_state,
+ 'encryption': encryption,
+ 'name': name,
+ 'operating_system.family': operating_system_family,
+ 'operating_system.architecture': operating_system_architecture,
+ 'tag': tag,
+ 'zone.name': zone_name,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}'.format(**path_param_dict)
+ url = '/volumes'
request = self.prepare_request(
method='GET',
url=url,
@@ -22782,40 +23420,33 @@ def check_vpn_gateway_connections_local_cidr(
response = self.send(request, **kwargs)
return response
- def add_vpn_gateway_connections_local_cidr(
+ def create_volume(
self,
- vpn_gateway_id: str,
- id: str,
- cidr: str,
+ volume_prototype: 'VolumePrototype',
**kwargs,
) -> DetailedResponse:
"""
- Set a local CIDR on a VPN gateway connection.
+ Create a volume.
- 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.
+ This request creates a new volume from a volume prototype object. The prototype
+ object is structured in the same way as a retrieved volume, and contains the
+ information necessary to create the new volume.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param str cidr: The IP address range in CIDR block notation.
+ :param VolumePrototype volume_prototype: The volume prototype object.
: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 `Volume` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- if not cidr:
- raise ValueError('cidr must be provided')
+ if volume_prototype is None:
+ raise ValueError('volume_prototype must be provided')
+ if isinstance(volume_prototype, VolumePrototype):
+ volume_prototype = convert_model(volume_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='add_vpn_gateway_connections_local_cidr',
+ operation_id='create_volume',
)
headers.update(sdk_headers)
@@ -22824,52 +23455,56 @@ def add_vpn_gateway_connections_local_cidr(
'generation': self.generation,
}
+ data = json.dumps(volume_prototype)
+ headers['content-type'] = 'application/json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}'.format(**path_param_dict)
+ url = '/volumes'
request = self.prepare_request(
- method='PUT',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_vpn_gateway_connections_peer_cidrs(
+ def delete_volume(
self,
- vpn_gateway_id: str,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List peer CIDRs for a VPN gateway connection.
+ Delete a volume.
- This request lists peer CIDRs for a VPN gateway connection.
- This request is only supported for policy mode VPN gateways.
+ This request deletes a volume. This operation cannot be reversed. For this request
+ to succeed, the volume must not be attached to any instances.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
+ :param str id: The volume 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 `VPNGatewayConnectionCIDRs` object
+ :rtype: DetailedResponse
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
if not id:
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='list_vpn_gateway_connections_peer_cidrs',
+ operation_id='delete_volume',
)
headers.update(sdk_headers)
@@ -22881,14 +23516,13 @@ def list_vpn_gateway_connections_peer_cidrs(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id']
- path_param_values = self.encode_path_vars(vpn_gateway_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 = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs'.format(**path_param_dict)
+ url = '/volumes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -22897,38 +23531,29 @@ def list_vpn_gateway_connections_peer_cidrs(
response = self.send(request, **kwargs)
return response
- def remove_vpn_gateway_connections_peer_cidr(
+ def get_volume(
self,
- vpn_gateway_id: str,
id: str,
- cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Remove a peer CIDR from a VPN gateway connection.
+ Retrieve a volume.
- This request removes a CIDR from a VPN gateway connection.
- This request is only supported for policy mode VPN gateways.
+ This request retrieves a single volume specified by the identifier in the URL.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param str cidr: The IP address range in CIDR block notation.
+ :param str id: The volume 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 `Volume` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
- if not cidr:
- raise ValueError('cidr must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='remove_vpn_gateway_connections_peer_cidr',
+ operation_id='get_volume',
)
headers.update(sdk_headers)
@@ -22940,13 +23565,14 @@ def remove_vpn_gateway_connections_peer_cidr(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}'.format(**path_param_dict)
+ url = '/volumes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -22955,39 +23581,44 @@ def remove_vpn_gateway_connections_peer_cidr(
response = self.send(request, **kwargs)
return response
- def check_vpn_gateway_connections_peer_cidr(
+ def update_volume(
self,
- vpn_gateway_id: str,
id: str,
- cidr: str,
+ volume_patch: 'VolumePatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Check if the specified peer CIDR exists on a VPN gateway connection.
+ Update a volume.
- 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.
+ This request updates a volume with the information in a provided volume patch. The
+ volume patch object is structured in the same way as a retrieved volume and
+ contains only the information to be updated.
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param str cidr: The IP address range in CIDR block notation.
+ :param str id: The volume identifier.
+ :param VolumePatch volume_patch: The volume 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
+ :rtype: DetailedResponse with `dict` result representing a `Volume` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
- if not cidr:
- raise ValueError('cidr must be provided')
- headers = {}
+ if volume_patch is None:
+ raise ValueError('volume_patch must be provided')
+ if isinstance(volume_patch, VolumePatch):
+ volume_patch = convert_model(volume_patch)
+ headers = {
+ 'If-Match': if_match,
+ }
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='check_vpn_gateway_connections_peer_cidr',
+ operation_id='update_volume',
)
headers.update(sdk_headers)
@@ -22996,76 +23627,83 @@ def check_vpn_gateway_connections_peer_cidr(
'generation': self.generation,
}
+ data = json.dumps(volume_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}'.format(**path_param_dict)
+ url = '/volumes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def add_vpn_gateway_connections_peer_cidr(
+ def list_volume_instance_profiles(
self,
- vpn_gateway_id: str,
id: str,
- cidr: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Set a peer CIDR on a VPN gateway connection.
+ List instance profiles compatible with a volume.
- 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.
+ This request lists instance profiles compatible with a volume's
+ `allowed_use.instance`, `operating_system.architecture` and
+ `operating_system.user_data_format` properties, sorted by ascending `name`
+ property values. The specified volume must be bootable (have an `operating_system`
+ property).
- :param str vpn_gateway_id: The VPN gateway identifier.
- :param str id: The VPN gateway connection identifier.
- :param str cidr: The IP address range in CIDR block notation.
+ :param str id: The volume 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 `VolumeInstanceProfileCollection` object
"""
- if not vpn_gateway_id:
- raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
- if not cidr:
- raise ValueError('cidr must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='add_vpn_gateway_connections_peer_cidr',
+ operation_id='list_volume_instance_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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
- path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
+ path_param_keys = ['id']
+ path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}'.format(**path_param_dict)
+ url = '/volumes/{id}/instance_profiles'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -23075,58 +23713,54 @@ def add_vpn_gateway_connections_peer_cidr(
return response
#########################
- # VPN servers
+ # VPCs
#########################
- def list_vpn_servers(
+ def list_vpcs(
self,
*,
- name: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
resource_group_id: Optional[str] = None,
- sort: Optional[str] = None,
+ classic_access: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- List VPN servers.
+ List VPCs.
- This request lists VPN servers.
+ This request lists VPCs in the region. A VPC is a virtual network that belongs to
+ an account and provides logical isolation from other networks. A VPC is made up of
+ resources in one or more zones. VPCs are regional, and each VPC can contain
+ resources in multiple zones in a region.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching 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 with a `resource_group.id` property matching 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 bool classic_access: (optional) Filters the collection to VPCs with
+ a `classic_access` property matching the specified 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 `VPNServerCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VPCCollection` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpn_servers',
+ operation_id='list_vpcs',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'name': name,
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
- 'sort': sort,
+ 'classic_access': classic_access,
}
if 'headers' in kwargs:
@@ -23134,7 +23768,7 @@ def list_vpn_servers(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/vpn_servers'
+ url = '/vpcs'
request = self.prepare_request(
method='GET',
url=url,
@@ -23145,94 +23779,78 @@ def list_vpn_servers(
response = self.send(request, **kwargs)
return response
- def create_vpn_server(
+ def create_vpc(
self,
- certificate: 'CertificateInstanceIdentity',
- client_authentication: List['VPNServerAuthenticationPrototype'],
- client_ip_pool: str,
- subnets: List['SubnetIdentity'],
*,
- client_dns_server_ips: Optional[List['IP']] = None,
- client_idle_timeout: Optional[int] = None,
- enable_split_tunneling: Optional[bool] = None,
+ address_prefix_management: Optional[str] = None,
+ classic_access: Optional[bool] = None,
+ dns: Optional['VPCDNSPrototype'] = None,
name: Optional[str] = None,
- port: Optional[int] = None,
- protocol: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
- security_groups: Optional[List['SecurityGroupIdentity']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a VPN server.
+ Create a VPC.
- This request creates a new VPN server.
+ This request creates a new VPC from a VPC prototype object. The prototype object
+ is structured in the same way as a retrieved VPC, and contains the information
+ necessary to create the new VPC.
+ The system will automatically create the following additional resources for the
+ VPC:
+ - Unless `address_prefix_management` is `manual`, a [default address
+ prefix](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-address-prefix) for
+ each zone
+ - A [default network
+ ACL](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-network-acl)
+ - A [default routing
+ table](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-routing-table)
+ - A [default security
+ group](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-security-group).
- :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 name for this VPN server. The name must not
- be used by another VPN server in the VPC. If unspecified, the name will be
- a hyphenated list of randomly-selected words.
- :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 str address_prefix_management: (optional) Indicates whether a
+ [default address
+ prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes)
+ will be automatically created for each zone in this VPC. If `manual`, this
+ VPC will be created with no default address prefixes.
+ Since address prefixes are managed identically regardless of whether they
+ were automatically created, the value is not preserved as a VPC property.
+ :param bool classic_access: (optional) Deprecated: Indicates whether this
+ VPC will be connected to Classic Infrastructure. If true, this VPC's
+ resources will 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.
+ Setting this property to `true` is supported only for accounts that have
+ been
+ [granted
+ approval](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure).
+ Instead, use a [Transit
+ Gateway](https://cloud.ibm.com/docs/transit-gateway) to connect this VPC to
+ Classic Infrastructure.
+ :param VPCDNSPrototype dns: (optional) The DNS configuration for this VPC.
+ If unspecified, the system will assign DNS servers capable of resolving
+ hosts and endpoint
+ gateways within this VPC, and hosts on the internet.
+ :param str name: (optional) The name for this VPC. The name must not be
+ used by another VPC in the region. 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) will be
used.
- :param List[SecurityGroupIdentity] security_groups: (optional) The security
- groups to use for this VPN server. 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 `VPNServer` object
+ :rtype: DetailedResponse with `dict` result representing a `VPC` object
"""
- 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 client_dns_server_ips is not None:
- client_dns_server_ips = [convert_model(x) for x in client_dns_server_ips]
+ if dns is not None:
+ dns = convert_model(dns)
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_vpn_server',
+ operation_id='create_vpc',
)
headers.update(sdk_headers)
@@ -23242,18 +23860,11 @@ def create_vpn_server(
}
data = {
- 'certificate': certificate,
- 'client_authentication': client_authentication,
- 'client_ip_pool': client_ip_pool,
- 'subnets': subnets,
- 'client_dns_server_ips': client_dns_server_ips,
- 'client_idle_timeout': client_idle_timeout,
- 'enable_split_tunneling': enable_split_tunneling,
+ 'address_prefix_management': address_prefix_management,
+ 'classic_access': classic_access,
+ 'dns': dns,
'name': name,
- 'port': port,
- 'protocol': protocol,
'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)
@@ -23264,7 +23875,7 @@ def create_vpn_server(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/vpn_servers'
+ url = '/vpcs'
request = self.prepare_request(
method='POST',
url=url,
@@ -23276,7 +23887,7 @@ def create_vpn_server(
response = self.send(request, **kwargs)
return response
- def delete_vpn_server(
+ def delete_vpc(
self,
id: str,
*,
@@ -23284,11 +23895,20 @@ def delete_vpn_server(
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPN server.
+ Delete a VPC.
- This request deletes a VPN server. This operation cannot be reversed.
+ This request deletes a VPC. This operation cannot be reversed.
+ For this request to succeed:
+ - Instances, subnets, public gateways, endpoint gateways, and private path service
+ gateways must not reside in this VPC
+ - The VPC must not be providing DNS resolution for any other VPCs
+ - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero
+ All security groups and network ACLs associated with the VPC are automatically
+ deleted. All flow log collectors with `auto_delete` set to `true` targeting the
+ VPC or any resource in the VPC are automatically deleted. All public address
+ ranges attached to the VPC are automatically detached.
- :param str id: The VPN server identifier.
+ :param str id: The VPC 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
@@ -23304,7 +23924,7 @@ def delete_vpn_server(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpn_server',
+ operation_id='delete_vpc',
)
headers.update(sdk_headers)
@@ -23320,7 +23940,7 @@ def delete_vpn_server(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{id}'.format(**path_param_dict)
+ url = '/vpcs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -23331,20 +23951,20 @@ def delete_vpn_server(
response = self.send(request, **kwargs)
return response
- def get_vpn_server(
+ def get_vpc(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPN server.
+ Retrieve a VPC.
- This request retrieves a single VPN server specified by the identifier in the URL.
+ This request retrieves a single VPC specified by the identifier in the URL.
- :param str id: The VPN server identifier.
+ :param str id: The VPC 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 `VPNServer` object
+ :rtype: DetailedResponse with `dict` result representing a `VPC` object
"""
if not id:
@@ -23353,7 +23973,7 @@ def get_vpn_server(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpn_server',
+ operation_id='get_vpc',
)
headers.update(sdk_headers)
@@ -23370,7 +23990,7 @@ def get_vpn_server(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{id}'.format(**path_param_dict)
+ url = '/vpcs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -23381,43 +24001,44 @@ def get_vpn_server(
response = self.send(request, **kwargs)
return response
- def update_vpn_server(
+ def update_vpc(
self,
id: str,
- vpn_server_patch: 'VPNServerPatch',
+ vpc_patch: 'VPCPatch',
*,
if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a VPN server.
+ Update a VPC.
- This request updates the properties of an existing VPN server. Any updates other
- than to `name` will cause all connected VPN clients to be disconnected.
+ This request updates a VPC with the information provided in a VPC patch object.
+ The patch object is structured in the same way as a retrieved VPC and needs to
+ contain only the information to be updated.
- :param str id: The VPN server identifier.
- :param VPNServerPatch vpn_server_patch: The VPN server patch.
+ :param str id: The VPC identifier.
+ :param VPCPatch vpc_patch: The VPC 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 `VPNServer` object
+ :rtype: DetailedResponse with `dict` result representing a `VPC` object
"""
if not id:
raise ValueError('id must be provided')
- 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)
+ if vpc_patch is None:
+ raise ValueError('vpc_patch must be provided')
+ if isinstance(vpc_patch, VPCPatch):
+ vpc_patch = convert_model(vpc_patch)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpn_server',
+ operation_id='update_vpc',
)
headers.update(sdk_headers)
@@ -23426,7 +24047,7 @@ def update_vpn_server(
'generation': self.generation,
}
- data = json.dumps(vpn_server_patch)
+ data = json.dumps(vpc_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -23437,7 +24058,7 @@ def update_vpn_server(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{id}'.format(**path_param_dict)
+ url = '/vpcs/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -23449,22 +24070,22 @@ def update_vpn_server(
response = self.send(request, **kwargs)
return response
- def get_vpn_server_client_configuration(
+ def get_vpc_default_network_acl(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve client configuration.
+ Retrieve a VPC's default network ACL.
- 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.
+ This request retrieves the default network ACL for the VPC specified by the
+ identifier in the URL. The default network ACL is applied to any new subnets in
+ the VPC which do not specify a network ACL.
- :param str id: The VPN server identifier.
+ :param str id: The VPC identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
- :rtype: DetailedResponse with `str` result
+ :rtype: DetailedResponse with `dict` result representing a `DefaultNetworkACL` object
"""
if not id:
@@ -23473,7 +24094,7 @@ def get_vpn_server_client_configuration(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpn_server_client_configuration',
+ operation_id='get_vpc_default_network_acl',
)
headers.update(sdk_headers)
@@ -23485,12 +24106,12 @@ def get_vpn_server_client_configuration(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'text/plain'
+ 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 = '/vpn_servers/{id}/client_configuration'.format(**path_param_dict)
+ url = '/vpcs/{id}/default_network_acl'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -23501,50 +24122,37 @@ def get_vpn_server_client_configuration(
response = self.send(request, **kwargs)
return response
- def list_vpn_server_clients(
+ def get_vpc_default_routing_table(
self,
- vpn_server_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- sort: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List VPN clients for a VPN server.
+ Retrieve a VPC's default routing table.
- This request retrieves connected VPN clients, and any disconnected VPN clients
- that the VPN server has not yet deleted based on its auto-deletion policy.
+ This request retrieves the default routing table for the VPC specified by the
+ identifier in the URL. The default routing table is associated with any subnets in
+ the VPC which have not been explicitly associated with another routing table.
- :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 str id: The VPC 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 `VPNServerClientCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `DefaultRoutingTable` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpn_server_clients',
+ operation_id='get_vpc_default_routing_table',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'sort': sort,
}
if 'headers' in kwargs:
@@ -23552,10 +24160,10 @@ def list_vpn_server_clients(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id']
- path_param_values = self.encode_path_vars(vpn_server_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 = '/vpn_servers/{vpn_server_id}/clients'.format(**path_param_dict)
+ url = '/vpcs/{id}/default_routing_table'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -23566,35 +24174,31 @@ def list_vpn_server_clients(
response = self.send(request, **kwargs)
return response
- def delete_vpn_server_client(
+ def get_vpc_default_security_group(
self,
- vpn_server_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPN client.
+ Retrieve a VPC's default security group.
- 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.
+ This request retrieves the default security group for the VPC specified by the
+ identifier in the URL. Resources created in this VPC that allow a security group
+ to be optionally specified will use this security group by default.
- :param str vpn_server_id: The VPN server identifier.
- :param str id: The VPN client identifier.
+ :param str id: The VPC 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 `DefaultSecurityGroup` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpn_server_client',
+ operation_id='get_vpc_default_security_group',
)
headers.update(sdk_headers)
@@ -23606,13 +24210,14 @@ def delete_vpn_server_client(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id', 'id']
- path_param_values = self.encode_path_vars(vpn_server_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 = '/vpn_servers/{vpn_server_id}/clients/{id}'.format(**path_param_dict)
+ url = '/vpcs/{id}/default_security_group'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -23621,39 +24226,43 @@ def delete_vpn_server_client(
response = self.send(request, **kwargs)
return response
- def get_vpn_server_client(
+ def list_vpc_address_prefixes(
self,
- vpn_server_id: str,
- id: str,
+ vpc_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPN client.
+ List address prefixes for a VPC.
- This request retrieves a single VPN client specified by the identifier in the URL.
+ This request lists address pool prefixes for a VPC.
- :param str vpn_server_id: The VPN server identifier.
- :param str id: The VPN client identifier.
+ :param str vpc_id: The VPC 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 `VPNServerClient` object
+ :rtype: DetailedResponse with `dict` result representing a `AddressPrefixCollection` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpn_server_client',
+ operation_id='list_vpc_address_prefixes',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -23661,10 +24270,10 @@ def get_vpn_server_client(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id', 'id']
- path_param_values = self.encode_path_vars(vpn_server_id, id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/clients/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/address_prefixes'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -23675,36 +24284,58 @@ def get_vpn_server_client(
response = self.send(request, **kwargs)
return response
- def disconnect_vpn_client(
+ def create_vpc_address_prefix(
self,
- vpn_server_id: str,
- id: str,
+ vpc_id: str,
+ cidr: str,
+ zone: 'ZoneIdentity',
+ *,
+ is_default: Optional[bool] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Disconnect a VPN client.
+ Create an address prefix for a VPC.
- 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.
+ This request creates a new prefix from a prefix prototype object. The prototype
+ object is structured in the same way as a retrieved prefix, and contains the
+ information necessary to create the new prefix.
- :param str vpn_server_id: The VPN server identifier.
- :param str id: The VPN client identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str cidr: The IPv4 range of the address prefix, expressed in CIDR
+ format. The range 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 address prefix's CIDR must be between `/9`
+ (8,388,608 addresses) and `/29` (8 addresses).
+ :param ZoneIdentity zone: The zone this address prefix will reside in.
+ :param bool is_default: (optional) Indicates whether this will be the
+ default address prefix for this zone in this VPC. If `true`, the VPC must
+ not have a default address prefix for this zone.
+ :param str name: (optional) The name for this address prefix. The name must
+ not be used by another address prefix for the VPC. 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
+ :rtype: DetailedResponse with `dict` result representing a `AddressPrefix` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if cidr is None:
+ raise ValueError('cidr must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ zone = convert_model(zone)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='disconnect_vpn_client',
+ operation_id='create_vpc_address_prefix',
)
headers.update(sdk_headers)
@@ -23713,84 +24344,82 @@ def disconnect_vpn_client(
'generation': self.generation,
}
+ data = {
+ 'cidr': cidr,
+ 'zone': zone,
+ 'is_default': is_default,
+ '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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id', 'id']
- path_param_values = self.encode_path_vars(vpn_server_id, id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/clients/{id}/disconnect'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/address_prefixes'.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 list_vpn_server_routes(
+ def delete_vpc_address_prefix(
self,
- vpn_server_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- sort: Optional[str] = None,
+ vpc_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List VPN routes for a VPN server.
+ Delete an address prefix.
- This request lists 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.
+ This request deletes a prefix. This operation cannot be reversed. The request will
+ fail if any subnets use addresses from this prefix.
- :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 str vpc_id: The VPC identifier.
+ :param str id: The prefix 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 `VPNServerRouteCollection` object
+ :rtype: DetailedResponse
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_vpn_server_routes',
+ operation_id='delete_vpc_address_prefix',
)
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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id']
- path_param_values = self.encode_path_vars(vpn_server_id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/routes'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/address_prefixes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -23799,52 +24428,33 @@ def list_vpn_server_routes(
response = self.send(request, **kwargs)
return response
- def create_vpn_server_route(
+ def get_vpc_address_prefix(
self,
- vpn_server_id: str,
- destination: str,
- *,
- action: Optional[str] = None,
- name: Optional[str] = None,
+ vpc_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Create a VPN route for a VPN server.
+ Retrieve an address prefix.
- 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.
+ This request retrieves a single prefix specified by the identifier in the URL.
- :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.
- :param str name: (optional) The name for this VPN server route. The name
- must not be used by another route for the VPN server. If unspecified, the
- name will be a hyphenated list of randomly-selected words.
+ :param str vpc_id: The VPC identifier.
+ :param str id: The prefix 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 `VPNServerRoute` object
+ :rtype: DetailedResponse with `dict` result representing a `AddressPrefix` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
- if destination is None:
- raise ValueError('destination must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_vpn_server_route',
+ operation_id='get_vpc_address_prefix',
)
headers.update(sdk_headers)
@@ -23853,62 +24463,60 @@ def create_vpn_server_route(
'generation': self.generation,
}
- data = {
- 'destination': destination,
- 'action': action,
- '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id']
- path_param_values = self.encode_path_vars(vpn_server_id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/routes'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/address_prefixes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_vpn_server_route(
+ def update_vpc_address_prefix(
self,
- vpn_server_id: str,
+ vpc_id: str,
id: str,
+ address_prefix_patch: 'AddressPrefixPatch',
**kwargs,
) -> DetailedResponse:
"""
- Delete a VPN route.
+ Update an address prefix.
- This request deletes a VPN route. This operation cannot be reversed.
+ This request updates a prefix with the information in a provided prefix patch. The
+ prefix patch object is structured in the same way as a retrieved prefix and
+ contains only the information to be updated.
- :param str vpn_server_id: The VPN server identifier.
- :param str id: The VPN route identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str id: The prefix identifier.
+ :param AddressPrefixPatch address_prefix_patch: The prefix patch.
: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 `AddressPrefix` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if address_prefix_patch is None:
+ raise ValueError('address_prefix_patch must be provided')
+ if isinstance(address_prefix_patch, AddressPrefixPatch):
+ address_prefix_patch = convert_model(address_prefix_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_vpn_server_route',
+ operation_id='update_vpc_address_prefix',
)
headers.update(sdk_headers)
@@ -23917,57 +24525,106 @@ def delete_vpn_server_route(
'generation': self.generation,
}
+ data = json.dumps(address_prefix_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id', 'id']
- path_param_values = self.encode_path_vars(vpn_server_id, id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/address_prefixes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_vpn_server_route(
+ def list_vpc_dns_resolution_bindings(
self,
- vpn_server_id: str,
- id: str,
+ vpc_id: str,
+ *,
+ sort: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ name: Optional[str] = None,
+ vpc_crn: Optional[str] = None,
+ vpc_name: Optional[str] = None,
+ account_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a VPN route.
+ List DNS resolution bindings for a VPC.
- This request retrieves a single VPN route specified by the identifier in the URL.
+ This request lists DNS resolution bindings for a VPC. A DNS resolution binding
+ represents an association with another VPC for centralizing DNS name resolution.
+ If the VPC specified by the identifier in the URL is a DNS hub VPC (has
+ `dns.enable_hub` set to `true`) then there is one binding for each VPC bound to
+ the hub VPC. The endpoint gateways in the bound VPCs can allow (using
+ `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS
+ names.
+ If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there
+ is at most one binding (to a hub VPC). The endpoint gateways in the VPC specified
+ by the identifier in the URL can allow (using `allow_dns_resolution_binding`) its
+ hub VPC to centralize resolution of their DNS names.
+ To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must
+ delegate DNS resolution to its hub VPC by setting `dns.resolver.type` to
+ `delegate`.
+ The bindings will be sorted by their `created_at` property values, with newest
+ bindings first. Bindings with identical `created_at` property values will in turn
+ be sorted by ascending `name` property values.
- :param str vpn_server_id: The VPN server identifier.
- :param str id: The VPN route identifier.
+ :param str vpc_id: The VPC 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 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 name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param str account_id: (optional) Filters the collection to resources with
+ a `vpc.remote.account.id` property matching the specified account
+ 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 `VPNServerRoute` object
+ :rtype: DetailedResponse with `dict` result representing a `VPCDNSResolutionBindingCollection` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_vpn_server_route',
+ operation_id='list_vpc_dns_resolution_bindings',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'sort': sort,
+ 'start': start,
+ 'limit': limit,
+ 'name': name,
+ 'vpc.crn': vpc_crn,
+ 'vpc.name': vpc_name,
+ 'account.id': account_id,
}
if 'headers' in kwargs:
@@ -23975,10 +24632,10 @@ def get_vpn_server_route(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id', 'id']
- path_param_values = self.encode_path_vars(vpn_server_id, id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/dns_resolution_bindings'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -23989,41 +24646,61 @@ def get_vpn_server_route(
response = self.send(request, **kwargs)
return response
- def update_vpn_server_route(
+ def create_vpc_dns_resolution_binding(
self,
- vpn_server_id: str,
- id: str,
- vpn_server_route_patch: 'VPNServerRoutePatch',
+ vpc_id: str,
+ vpc: 'VPCIdentity',
+ *,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a VPN route.
+ Create a DNS resolution binding.
- 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.
+ This request creates a new DNS resolution binding from a DNS resolution binding
+ prototype object. The prototype object is structured in the same way as a
+ retrieved DNS resolution binding, and contains the information necessary to create
+ the new DNS resolution binding.
+ For this request to succeed:
+ - The VPC specified by the identifier in the URL must not already have a DNS
+ resolution
+ binding
+ - The VPC specified by the identifier in the URL must have `dns.enable_hub` set to
+ `false`
+ - The updated DNS sharing connected topology must not contain more than one
+ endpoint
+ gateway with `allow_dns_resolution_binding` set to `true` targeting the same
+ service.
+ See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-vpe-dns-sharing) for
+ more information.
- :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 str vpc_id: The VPC identifier.
+ :param VPCIdentity vpc: The VPC to bind this VPC to for DNS resolution. The
+ VPC must be different from the VPC
+ specified in the URL, must have `dns.enable_hub` set to `true`, and may be
+ in a
+ different account (subject to IAM policies).
+ Additionally, the VPC specified in the URL (this VPC) must have
+ `dns.enable_hub` set
+ to `false` and a `dns.resolution_binding_count` of zero.
+ :param str name: (optional) The name for this DNS resolution binding. The
+ name must not be used by another DNS resolution binding for the VPC. 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 `VPNServerRoute` object
+ :rtype: DetailedResponse with `dict` result representing a `VPCDNSResolutionBinding` object
"""
- if not vpn_server_id:
- raise ValueError('vpn_server_id must be provided')
- if not id:
- raise ValueError('id must be provided')
- 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)
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if vpc is None:
+ raise ValueError('vpc must be provided')
+ vpc = convert_model(vpc)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_vpn_server_route',
+ operation_id='create_vpc_dns_resolution_binding',
)
headers.update(sdk_headers)
@@ -24032,20 +24709,25 @@ def update_vpn_server_route(
'generation': self.generation,
}
- data = json.dumps(vpn_server_route_patch)
- headers['content-type'] = 'application/merge-patch+json'
+ data = {
+ 'vpc': vpc,
+ '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['vpn_server_id', 'id']
- path_param_values = self.encode_path_vars(vpn_server_id, id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/dns_resolution_bindings'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -24055,45 +24737,42 @@ def update_vpn_server_route(
response = self.send(request, **kwargs)
return response
- #########################
- # Load balancers
- #########################
-
- def list_load_balancer_profiles(
+ def delete_vpc_dns_resolution_binding(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ vpc_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List load balancer profiles.
+ Delete a DNS resolution binding.
- This request lists load balancer profiles available in the region. A load balancer
- profile specifies the performance characteristics and pricing model for a load
- balancer.
+ This request deletes a DNS resolution binding. This operation cannot be reversed.
+ For this request to succeed, the VPC specified by the identifier in the URL must
+ not have
+ `dns.resolver.type` set to `delegated`.
- :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 vpc_id: The VPC identifier.
+ :param str id: The DNS resolution binding 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 `LoadBalancerProfileCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VPCDNSResolutionBinding` object
"""
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_load_balancer_profiles',
+ operation_id='delete_vpc_dns_resolution_binding',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
if 'headers' in kwargs:
@@ -24101,9 +24780,12 @@ def list_load_balancer_profiles(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/load_balancer/profiles'
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/vpcs/{vpc_id}/dns_resolution_bindings/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -24112,29 +24794,34 @@ def list_load_balancer_profiles(
response = self.send(request, **kwargs)
return response
- def get_load_balancer_profile(
+ def get_vpc_dns_resolution_binding(
self,
- name: str,
+ vpc_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer profile.
+ Retrieve a DNS resolution binding.
- This request retrieves a load balancer profile specified by the name in the URL.
+ This request retrieves a single DNS resolution binding specified by the identifier
+ in the URL.
- :param str name: The load balancer profile name.
+ :param str vpc_id: The VPC identifier.
+ :param str id: The DNS resolution binding 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 `LoadBalancerProfile` object
+ :rtype: DetailedResponse with `dict` result representing a `VPCDNSResolutionBinding` object
"""
- if not name:
- raise ValueError('name must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not id:
+ 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_profile',
+ operation_id='get_vpc_dns_resolution_binding',
)
headers.update(sdk_headers)
@@ -24148,10 +24835,10 @@ def get_load_balancer_profile(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['name']
- path_param_values = self.encode_path_vars(name)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancer/profiles/{name}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/dns_resolution_bindings/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -24162,237 +24849,236 @@ def get_load_balancer_profile(
response = self.send(request, **kwargs)
return response
- def list_load_balancers(
+ def update_vpc_dns_resolution_binding(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
+ vpc_id: str,
+ id: str,
+ vpcdns_resolution_binding_patch: 'VPCDNSResolutionBindingPatch',
**kwargs,
) -> DetailedResponse:
"""
- List load balancers.
+ Update a DNS resolution binding.
- This request lists load balancers in the region.
+ This request updates a DNS resolution binding with the information in a provided
+ DNS resolution binding patch. The DNS resolution binding patch object is
+ structured in the same way as a retrieved DNS resolution binding and contains only
+ the information to be updated.
- :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 vpc_id: The VPC identifier.
+ :param str id: The DNS resolution binding identifier.
+ :param VPCDNSResolutionBindingPatch vpcdns_resolution_binding_patch: The
+ DNS resolution binding 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 `LoadBalancerCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VPCDNSResolutionBinding` object
"""
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ if vpcdns_resolution_binding_patch is None:
+ raise ValueError('vpcdns_resolution_binding_patch must be provided')
+ if isinstance(vpcdns_resolution_binding_patch, VPCDNSResolutionBindingPatch):
+ vpcdns_resolution_binding_patch = convert_model(vpcdns_resolution_binding_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_load_balancers',
+ operation_id='update_vpc_dns_resolution_binding',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
}
+ data = json.dumps(vpcdns_resolution_binding_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/load_balancers'
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/vpcs/{vpc_id}/dns_resolution_bindings/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def create_load_balancer(
+ def list_vpc_routes(
self,
- is_public: bool,
- subnets: List['SubnetIdentity'],
+ vpc_id: str,
*,
- dns: Optional['LoadBalancerDNSPrototype'] = None,
- is_private_path: Optional[bool] = None,
- listeners: Optional[List['LoadBalancerListenerPrototypeLoadBalancerContext']] = None,
- logging: Optional['LoadBalancerLoggingPrototype'] = None,
- name: Optional[str] = None,
- pools: Optional[List['LoadBalancerPoolPrototypeLoadBalancerContext']] = None,
- profile: Optional['LoadBalancerProfileIdentity'] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
- route_mode: Optional[bool] = None,
- security_groups: Optional[List['SecurityGroupIdentity']] = None,
+ zone_name: Optional[str] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a load balancer.
+ List routes in a VPC's default routing table.
- This request creates and provisions a new load balancer.
+ This request lists routes in the VPC's default routing table. Each route is
+ zone-specific and directs any packets matching its destination CIDR block to a
+ `next_hop` IP address. The most specific route matching a packet's destination
+ will be used. If multiple equally-specific routes exist, traffic will be
+ distributed across them.
- :param bool is_public: Indicates whether this load balancer is public.
- At present,
- - If `route_mode` is set to `true`, the load balancer must be private.
- - If `is_private_path` is specified, it must be set to `false`.
- :param List[SubnetIdentity] subnets: The subnets to provision this load
- balancer in. The subnets must be in the same VPC.
- - If 'availability' is specified as `subnet` in the profile, the load
- balancer's availability will depend on the availability of the zones that
- the subnets reside in.
- - If 'availability' is specified as `region` in the profile, the load
- balancer remains available as long as any zone in the region is available.
- Only members in healthy zones will be sent new connections.
- Load balancers in the `network` family allow only one subnet to be
- specified.
- :param LoadBalancerDNSPrototype dns: (optional) The DNS configuration for
- this load balancer.
- If unspecified, DNS `A` records for this load balancer's `hostname`
- property will be added
- to the public DNS zone `lb.appdomain.cloud`. Otherwise, those DNS `A`
- records will be
- added to the specified `zone`.
- Not supported by private path load balancers.
- :param bool is_private_path: (optional) Indicates whether this is a private
- path load balancer.
- :param List[LoadBalancerListenerPrototypeLoadBalancerContext] listeners:
- (optional) The listeners of this load balancer.
- :param LoadBalancerLoggingPrototype 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. If unspecified, `datapath.active` will
- be `false`.
- To activate logging, the load balancer profile must support the specified
- logging type.
- :param str name: (optional) The name for this load balancer. The name must
- not be used by another load balancer in the VPC. If unspecified, the name
- will be a hyphenated list of randomly-selected words.
- :param List[LoadBalancerPoolPrototypeLoadBalancerContext] 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) will be
- used.
- :param bool route_mode: (optional) Indicates whether [route
- mode](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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 str vpc_id: The VPC identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching 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 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 `RouteCollectionVPCContext` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
- 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 dns is not None:
- dns = convert_model(dns)
- 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]
+ logging.warning('A deprecated operation has been invoked: list_vpc_routes')
+
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_load_balancer',
+ operation_id='list_vpc_routes',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'zone.name': zone_name,
+ 'start': start,
+ 'limit': limit,
}
- data = {
- 'is_public': is_public,
- 'subnets': subnets,
- 'dns': dns,
- 'is_private_path': is_private_path,
- '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/load_balancers'
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/vpcs/{vpc_id}/routes'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_load_balancer(
+ def create_vpc_route(
self,
- id: str,
+ vpc_id: str,
+ destination: str,
+ zone: 'ZoneIdentity',
*,
- if_match: Optional[str] = None,
+ action: Optional[str] = None,
+ advertise: Optional[bool] = None,
+ name: Optional[str] = None,
+ next_hop: Optional['RouteNextHopPrototype'] = None,
+ priority: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a load balancer.
+ Create a route in a VPC's default routing table.
- This request deletes a load balancer. This operation cannot be reversed. A load
- balancer cannot be deleted if its `provisioning_status` is `delete_pending` or it
- is referenced by a resource.
+ This request creates a new route in the VPC's default routing table. The route
+ prototype object is structured in the same way as a retrieved route, and contains
+ the information necessary to create the new route. The request will fail if the
+ new route will cause a loop.
- :param str id: The load balancer 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 str vpc_id: The VPC identifier.
+ :param str destination: The destination CIDR of the route. The host
+ identifier in the CIDR must be zero.
+ At most two routes per `zone` in a table can have the same `destination`
+ and
+ `priority`, 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.
+ If subnets are attached to the route's routing table, egress traffic from
+ those
+ subnets in this zone will be subject to this route. If this route's routing
+ table
+ has any of `route_direct_link_ingress`, `route_internet_ingress`,
+ `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`,
+ traffic
+ from those ingress sources arriving 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 system-provided routes
+ - `delegate_vpc`: delegate to system-provided routes, ignoring
+ Internet-bound routes
+ - `deliver`: deliver the packet to the specified `next_hop`
+ - `drop`: drop the packet.
+ :param bool advertise: (optional) Indicates whether this route will be
+ advertised to the ingress sources specified by the `advertise_routes_to`
+ routing table property.
+ All routes in a routing table with the same `destination` and `zone` must
+ have the same
+ `advertise` value.
+ :param str name: (optional) The name for this route. The name must not be
+ used by another route in the routing table. Names starting with `ibm-` are
+ reserved for system-provided routes, and are not allowed. If unspecified,
+ the name will be a hyphenated list of randomly-selected words.
+ :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`,
+ the next hop that packets will be delivered to (must not be
+ `0.0.0.0`). For other `action` values, it must be omitted or specified as
+ `0.0.0.0`.
+ At most two routes per `zone` in a table can have the same `destination`
+ and `priority`,
+ and only when each route has an `action` of `deliver` and `next_hop` is an
+ IP address.
+ :param int priority: (optional) The priority of this route. Smaller values
+ have higher priority.
+ If a routing table contains multiple routes with the same `zone` and
+ `destination`, the route with the highest priority (smallest value) is
+ selected. If two routes have the same `destination` and `priority`, traffic
+ is distributed between them.
: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 `Route` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
- if not id:
- raise ValueError('id must be provided')
- headers = {
- 'If-Match': if_match,
- }
+ logging.warning('A deprecated operation has been invoked: create_vpc_route')
+
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if destination is None:
+ raise ValueError('destination must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ zone = convert_model(zone)
+ if next_hop is not None:
+ next_hop = convert_model(next_hop)
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_load_balancer',
+ operation_id='create_vpc_route',
)
headers.update(sdk_headers)
@@ -24401,48 +25087,70 @@ def delete_load_balancer(
'generation': self.generation,
}
+ data = {
+ 'destination': destination,
+ 'zone': zone,
+ 'action': action,
+ 'advertise': advertise,
+ 'name': name,
+ 'next_hop': next_hop,
+ 'priority': priority,
+ }
+ 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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancers/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/routes'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def get_load_balancer(
+ def delete_vpc_route(
self,
+ vpc_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer.
+ Delete a VPC route.
- This request retrieves a single load balancer specified by the identifier in the
- URL path.
+ This request deletes a route. This operation cannot be reversed.
- :param str id: The load balancer identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str id: The 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 `LoadBalancer` object
+ :rtype: DetailedResponse
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
+ logging.warning('A deprecated operation has been invoked: delete_vpc_route')
+
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
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',
+ operation_id='delete_vpc_route',
)
headers.update(sdk_headers)
@@ -24454,14 +25162,13 @@ def get_load_balancer(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancers/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -24470,45 +25177,37 @@ def get_load_balancer(
response = self.send(request, **kwargs)
return response
- def update_load_balancer(
+ def get_vpc_route(
self,
+ vpc_id: str,
id: str,
- load_balancer_patch: 'LoadBalancerPatch',
- *,
- if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a load balancer.
+ Retrieve a VPC route.
- This request updates a load balancer with the information in a provided load
- balancer patch. The load balancer patch object is structured in the same way as a
- retrieved load balancer and contains only the information to be updated. A load
- balancer can only be updated if its `provisioning_status` is `active`.
+ This request retrieves a single route specified by the identifier in the URL.
- :param str id: The load balancer identifier.
- :param LoadBalancerPatch load_balancer_patch: The load balancer 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 str vpc_id: The VPC identifier.
+ :param str id: The 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 `LoadBalancer` object
+ :rtype: DetailedResponse with `dict` result representing a `Route` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
+ logging.warning('A deprecated operation has been invoked: get_vpc_route')
+
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
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-Match': if_match,
- }
+ headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_load_balancer',
+ operation_id='get_vpc_route',
)
headers.update(sdk_headers)
@@ -24517,52 +25216,64 @@ def update_load_balancer(
'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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancers/{id}'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def get_load_balancer_statistics(
+ def update_vpc_route(
self,
+ vpc_id: str,
id: str,
+ route_patch: 'RoutePatch',
**kwargs,
) -> DetailedResponse:
"""
- List statistics of a load balancer.
+ Update a VPC route.
- This request lists statistics of a load balancer.
+ This request updates a route with the information in a provided route patch. The
+ route patch object is structured in the same way as a retrieved route and contains
+ only the information to be updated.
- :param str id: The load balancer identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str id: The route identifier.
+ :param RoutePatch route_patch: The 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 `LoadBalancerStatistics` object
+ :rtype: DetailedResponse with `dict` result representing a `Route` object
+
+ Deprecated: this method is deprecated and may be removed in a future release.
"""
+ logging.warning('A deprecated operation has been invoked: update_vpc_route')
+
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if route_patch is None:
+ raise ValueError('route_patch must be provided')
+ if isinstance(route_patch, RoutePatch):
+ route_patch = convert_model(route_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_load_balancer_statistics',
+ operation_id='update_vpc_route',
)
headers.update(sdk_headers)
@@ -24571,54 +25282,74 @@ def get_load_balancer_statistics(
'generation': self.generation,
}
+ data = json.dumps(route_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancers/{id}/statistics'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def list_load_balancer_listeners(
+ def list_vpc_routing_tables(
self,
- load_balancer_id: str,
+ vpc_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ is_default: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- List listeners for a load balancer.
+ List routing tables for a VPC.
- This request lists listeners for a load balancer.
+ This request lists routing tables for a VPC. Each subnet in a VPC is associated
+ with a routing table, which controls delivery of packets sent on that subnet
+ according to the action of the most specific matching route in the table. If
+ multiple equally-specific routes exist, traffic will be distributed across them.
+ If no routes match, delivery will be controlled by the system's built-in routes.
- :param str load_balancer_id: The load balancer identifier.
+ :param str vpc_id: The VPC 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 bool is_default: (optional) Filters the collection to routing tables
+ with an `is_default` property matching the specified 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 `LoadBalancerListenerCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `RoutingTableCollection` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_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_vpc_routing_tables',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'is_default': is_default,
}
if 'headers' in kwargs:
@@ -24626,10 +25357,10 @@ def list_load_balancer_listeners(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['load_balancer_id']
- path_param_values = self.encode_path_vars(load_balancer_id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/routing_tables'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -24640,139 +25371,109 @@ def list_load_balancer_listeners(
response = self.send(request, **kwargs)
return response
- def create_load_balancer_listener(
+ def create_vpc_routing_table(
self,
- load_balancer_id: str,
- protocol: str,
+ vpc_id: str,
*,
- accept_proxy_protocol: Optional[bool] = None,
- certificate_instance: Optional['CertificateInstanceIdentity'] = None,
- connection_limit: Optional[int] = None,
- default_pool: Optional['LoadBalancerPoolIdentity'] = None,
- https_redirect: Optional['LoadBalancerListenerHTTPSRedirectPrototype'] = None,
- idle_connection_timeout: Optional[int] = None,
- policies: Optional[List['LoadBalancerListenerPolicyPrototype']] = None,
- port: Optional[int] = None,
- port_max: Optional[int] = None,
- port_min: Optional[int] = None,
+ accept_routes_from: Optional[List['ResourceFilter']] = None,
+ advertise_routes_to: Optional[List[str]] = None,
+ name: Optional[str] = None,
+ route_direct_link_ingress: Optional[bool] = None,
+ route_internet_ingress: Optional[bool] = None,
+ route_transit_gateway_ingress: Optional[bool] = None,
+ route_vpc_zone_ingress: Optional[bool] = None,
+ routes: Optional[List['RoutePrototype']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a listener for a load balancer.
+ Create a routing table for a VPC.
- This request creates a new listener for a load balancer.
+ This request creates a routing table from a routing table prototype object. The
+ prototype object is structured in the same way as a retrieved routing table, and
+ contains the information necessary to create the new routing table.
+ At present, the routing table's `resource_group` will be inherited from its VPC,
+ but may be specifiable in the future.
- :param str load_balancer_id: The load balancer identifier.
- :param str protocol: The listener protocol. Each listener in the load
- balancer must have a non-overlapping port range and `protocol` combination.
- 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`.
- Additional restrictions:
- - If `default_pool` is set, the pool's protocol must match, or be
- compatible with
- the listener's protocol. At present, the compatible protocols are `http`
- and
- `https`.
- - 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 to use for SSL termination. The listener must have a
- `protocol` of `https`.
- :param int connection_limit: (optional) The concurrent connection limit for
- the listener. If reached, incoming connections may be queued or rejected.
- Supported for load balancers in the `application` family.
- If unspecified, the limit will be `15000` for load balancers in the
- `application` family.
- :param LoadBalancerPoolIdentity default_pool: (optional) The default pool
- for this listener. If `https_redirect` is specified, the
- default pool will not be used.
- If specified, the 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.
- If unspecified, this listener will be created with no default pool, but one
- may be
- subsequently set.
- :param LoadBalancerListenerHTTPSRedirectPrototype https_redirect:
- (optional) The target listener that requests will be redirected to if none
- of the listener's
- `policies` match.
- If specified, this listener must have a `protocol` of `http`, and the
- target
- listener must have a `protocol` of `https`.
- :param int idle_connection_timeout: (optional) The idle connection timeout
- of the listener in seconds.
- Supported for load balancers in the `application` family.
- If unspecified, the timeout will be `50` for load balancers in the
- `application` family.
- :param List[LoadBalancerListenerPolicyPrototype] policies: (optional) The
- policy prototype objects for this listener. The load balancer must be in
- the
- `application` family.
- :param int port: (optional) The listener port number. Each listener in the
- load balancer must have a non-overlapping port range and `protocol`
- combination. Protocol values of `tcp`, `http` and `https` share the TCP
- port space.
- If `port_min` is also specified, `port` must have the same value as
- `port_min`.
- :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`.
- Only network load balancers with `route_mode`, `is_public` or
- `is_private_path` set to
- `true` support different values for `port_min` and `port_max`. If
- `route_mode` is set to `true`, the value must be `65535`.
- The specified port range must not overlap with port ranges used by other
- listeners for this load balancer using the same protocol. Protocol values
- of `tcp`, `http` and
- `https` share the TCP port space.
- :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`.
- If specified, `port_max` must also be specified, and must not be smaller.
- If unspecified, `port_max` must also be unspecified.
- If `port` is also specified, `port_min` must have the same value as `port`.
- Only network load balancers with `route_mode`, `is_public` or
- `is_private_path` set to
- `true` support different values for `port_min` and `port_max`. If
- `route_mode` is set to `true`, the value must be `1`.
- The specified port range must not overlap with port ranges used by other
- listeners for this load balancer using the same protocol. Protocol values
- of `tcp`, `http` and
- `https` share the TCP port space.
+ :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.
+ If specified, `resource_type` must be `vpn_gateway` or `vpn_server`.
+ :param List[str] advertise_routes_to: (optional) The ingress sources to
+ advertise routes to. Routes in the table with `advertise` enabled will be
+ advertised to these sources.
+ :param str name: (optional) The name for this routing table. The name must
+ not be used by another routing table in the VPC. If unspecified, the name
+ will be a hyphenated list of randomly-selected words.
+ :param bool route_direct_link_ingress: (optional) If set to `true`, this
+ routing table will be used to route traffic that originates from [Direct
+ Link](https://cloud.ibm.com/docs/dl) to this VPC. The VPC must not already
+ have a routing table with this property set to `true`.
+ 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 in a subnet in the route's `zone`
+ that is able to accept traffic. Therefore, if an incoming packet matches a
+ route with a `next_hop` of 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_internet_ingress: (optional) If set to `true`, this
+ routing table will be used to route traffic that originates from the
+ internet. For this to succeed, the VPC must not already have a routing
+ table with this property set to `true`.
+ Incoming traffic will be routed according to the routing table with two
+ exceptions:
+ - Traffic destined for IP addresses associated with public gateways will
+ not be
+ subject to routes in this routing table.
+ - Routes with an `action` of `deliver` are treated as `drop` unless the
+ `next_hop` is
+ an IP address in a subnet in the route's `zone` that is able to accept
+ traffic.
+ Therefore, if an incoming packet matches a route with a `next_hop` of a
+ VPN gateway
+ connection, the packet will be dropped.
+ :param bool route_transit_gateway_ingress: (optional) If set to `true`,
+ this routing table will be used to route traffic that originates from
+ [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC.
+ The VPC must not already have a routing table with this property set to
+ `true`.
+ 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 in a subnet in the route's `zone`
+ that is able to accept traffic. Therefore, if an incoming packet matches a
+ route with a `next_hop` of a VPN gateway connection, the packet will be
+ dropped.
+ :param bool route_vpc_zone_ingress: (optional) If set to `true`, this
+ routing table will be used to route traffic that originates from subnets in
+ other zones in this VPC. The VPC must not already have a routing table with
+ this property set to `true`.
+ 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 in a subnet in the route's `zone`
+ that is able to accept traffic. Therefore, if an incoming packet matches a
+ route with a `next_hop` of a VPN gateway connection, the packet will be
+ dropped.
+ :param List[RoutePrototype] routes: (optional) The prototype objects for
+ routes to create for this routing table. If unspecified, the routing table
+ will be created with no routes.
: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 with `dict` result representing a `RoutingTable` object
"""
- if not load_balancer_id:
- 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 not vpc_id:
+ 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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_load_balancer_listener',
+ operation_id='create_vpc_routing_table',
)
headers.update(sdk_headers)
@@ -24782,17 +25483,14 @@ def create_load_balancer_listener(
}
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,
- 'idle_connection_timeout': idle_connection_timeout,
- 'policies': policies,
- 'port': port,
- 'port_max': port_max,
- 'port_min': port_min,
+ 'accept_routes_from': accept_routes_from,
+ 'advertise_routes_to': advertise_routes_to,
+ 'name': name,
+ 'route_direct_link_ingress': route_direct_link_ingress,
+ 'route_internet_ingress': route_internet_ingress,
+ 'route_transit_gateway_ingress': route_transit_gateway_ingress,
+ 'route_vpc_zone_ingress': route_vpc_zone_ingress,
+ 'routes': routes,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -24803,10 +25501,10 @@ def create_load_balancer_listener(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['load_balancer_id']
- path_param_values = self.encode_path_vars(load_balancer_id)
+ path_param_keys = ['vpc_id']
+ path_param_values = self.encode_path_vars(vpc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict)
+ url = '/vpcs/{vpc_id}/routing_tables'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -24818,35 +25516,41 @@ def create_load_balancer_listener(
response = self.send(request, **kwargs)
return response
- def delete_load_balancer_listener(
+ def delete_vpc_routing_table(
self,
- load_balancer_id: str,
+ vpc_id: str,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a load balancer listener.
+ Delete a VPC routing table.
- 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 deletes a routing table. A routing table cannot be deleted if it is
+ associated with any subnets in the VPC. Additionally, a VPC's default routing
+ table cannot be deleted. This operation cannot be reversed.
- :param str load_balancer_id: The load balancer identifier.
- :param str id: The listener identifier.
+ :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
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
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_listener',
+ operation_id='delete_vpc_routing_table',
)
headers.update(sdk_headers)
@@ -24859,10 +25563,10 @@ def delete_load_balancer_listener(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['load_balancer_id', 'id']
- path_param_values = self.encode_path_vars(load_balancer_id, id)
+ path_param_keys = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_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)
+ url = '/vpcs/{vpc_id}/routing_tables/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -24873,34 +25577,34 @@ def delete_load_balancer_listener(
response = self.send(request, **kwargs)
return response
- def get_load_balancer_listener(
+ def get_vpc_routing_table(
self,
- load_balancer_id: str,
+ vpc_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer listener.
+ Retrieve a VPC routing table.
- This request retrieves a single listener specified by the identifier in the URL
- path.
+ This request retrieves a single routing table specified by the identifier in the
+ URL.
- :param str load_balancer_id: The load balancer identifier.
- :param str id: The listener identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str id: The routing table 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 with `dict` result representing a `RoutingTable` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
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='get_vpc_routing_table',
)
headers.update(sdk_headers)
@@ -24914,10 +25618,10 @@ def get_load_balancer_listener(
del kwargs['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 = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_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)
+ url = '/vpcs/{vpc_id}/routing_tables/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -24928,40 +25632,48 @@ def get_load_balancer_listener(
response = self.send(request, **kwargs)
return response
- def update_load_balancer_listener(
+ def update_vpc_routing_table(
self,
- load_balancer_id: str,
+ vpc_id: str,
id: str,
- load_balancer_listener_patch: 'LoadBalancerListenerPatch',
+ routing_table_patch: 'RoutingTablePatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a load balancer listener.
+ Update a VPC routing table.
- This request updates a load balancer listener from a listener patch.
+ This request updates a routing table with the information in a provided routing
+ table patch. The patch object is structured in the same way as a retrieved table
+ and contains only the information to be updated.
- :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 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 `LoadBalancerListener` object
+ :rtype: DetailedResponse with `dict` result representing a `RoutingTable` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
if not id:
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 = {}
+ if routing_table_patch is None:
+ raise ValueError('routing_table_patch must be provided')
+ if isinstance(routing_table_patch, RoutingTablePatch):
+ routing_table_patch = convert_model(routing_table_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_listener',
+ operation_id='update_vpc_routing_table',
)
headers.update(sdk_headers)
@@ -24970,7 +25682,7 @@ def update_load_balancer_listener(
'generation': self.generation,
}
- data = json.dumps(load_balancer_listener_patch)
+ data = json.dumps(routing_table_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -24978,10 +25690,10 @@ def update_load_balancer_listener(
del kwargs['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 = ['vpc_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_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)
+ url = '/vpcs/{vpc_id}/routing_tables/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -24993,41 +25705,53 @@ def update_load_balancer_listener(
response = self.send(request, **kwargs)
return response
- def list_load_balancer_listener_policies(
+ def list_vpc_routing_table_routes(
self,
- load_balancer_id: str,
- listener_id: str,
+ vpc_id: str,
+ routing_table_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List policies for a load balancer listener.
+ List routes in a VPC routing table.
- This request lists policies for a load balancer listener. A policy consists of
- rules to match against each incoming request, and an action to apply to the
- request if a rule matches.
+ This request lists routes in a VPC routing table. If subnets are associated with
+ this routing table, delivery of packets sent on a subnet is performed according to
+ the action of the most specific matching route in the table (provided the subnet
+ and route are in the same zone). If multiple equally-specific routes exist, the
+ route with the highest priority will be used. If two matching routes have the same
+ destination and priority, traffic will be distributed between them. If no routes
+ match, delivery will be controlled by the system's built-in routes.
- :param str load_balancer_id: The load balancer identifier.
- :param str listener_id: The listener identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str routing_table_id: The routing table 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 `LoadBalancerListenerPolicyCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `RouteCollection` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not routing_table_id:
+ raise ValueError('routing_table_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_vpc_routing_table_routes',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -25035,10 +25759,10 @@ def list_load_balancer_listener_policies(
del kwargs['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 = ['vpc_id', 'routing_table_id']
+ path_param_values = self.encode_path_vars(vpc_id, routing_table_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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -25049,84 +25773,97 @@ def list_load_balancer_listener_policies(
response = self.send(request, **kwargs)
return response
- def create_load_balancer_listener_policy(
+ def create_vpc_routing_table_route(
self,
- load_balancer_id: str,
- listener_id: str,
- action: str,
- priority: int,
+ vpc_id: str,
+ routing_table_id: str,
+ destination: str,
+ zone: 'ZoneIdentity',
*,
+ action: Optional[str] = None,
+ advertise: Optional[bool] = None,
name: Optional[str] = None,
- rules: Optional[List['LoadBalancerListenerPolicyRulePrototype']] = None,
- target: Optional['LoadBalancerListenerPolicyTargetPrototype'] = None,
+ next_hop: Optional['RouteNextHopPrototype'] = None,
+ priority: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a policy for a load balancer listener.
+ Create a route in a VPC routing table.
- This request creates a new policy from a load balancer listener policy object. The
- prototype object is structured in the same way as a retrieved policy, and contains
- the information necessary to create the new policy. For this request to succeed,
- the load balancer must be in the `application` family.
+ This request creates a new VPC route from a VPC route prototype object. The
+ prototype object is structured in the same way as a retrieved VPC route and
+ contains the information necessary to create the route.
- :param str load_balancer_id: The load balancer identifier.
- :param str listener_id: The listener identifier.
- :param str action: The policy action:
- - `forward_to_listener`: Requests will be forwarded to the specified
- `target` listener.
- - `forward_to_pool`: Requests will be forwarded to the specified `target`
- pool.
- - `https_redirect`: Requests will be redirected to the specified
- `target.listener`.
- This listener must have a `protocol` of `http`, and the target listener
- must
- have a `protocol` of `https`.
- - `redirect`: Requests will be redirected to the specified `target.url`
- - `reject`: Requests will be rejected with a `403` status code.
- :param int priority: The priority of the policy. The priority is unique
- across all policies for this load balancer listener. Lower value indicates
- higher priority.
- :param str name: (optional) The name for this policy. The name must not be
- used by another policy for the load balancer listener. If unspecified, the
- name will be a hyphenated list of randomly-selected words.
- :param List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The
- rule prototype objects for this policy.
- :param LoadBalancerListenerPolicyTargetPrototype target: (optional) - If
- `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity`
- in this
- load balancer to forward to.
- - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to
- specify a pool in
- this load balancer to forward to.
- - If `action` is `https_redirect`, use
- `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener
- on this
- load balancer to redirect to.
- - If `action` is `redirect`, use
- `LoadBalancerListenerPolicyRedirectURLPrototype`to
- specify a URL to redirect to.
+ :param str vpc_id: The VPC identifier.
+ :param str routing_table_id: The routing table identifier.
+ :param str destination: The destination CIDR of the route. The host
+ identifier in the CIDR must be zero.
+ At most two routes per `zone` in a table can have the same `destination`
+ and
+ `priority`, 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.
+ If subnets are attached to the route's routing table, egress traffic from
+ those
+ subnets in this zone will be subject to this route. If this route's routing
+ table
+ has any of `route_direct_link_ingress`, `route_internet_ingress`,
+ `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`,
+ traffic
+ from those ingress sources arriving 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 system-provided routes
+ - `delegate_vpc`: delegate to system-provided routes, ignoring
+ Internet-bound routes
+ - `deliver`: deliver the packet to the specified `next_hop`
+ - `drop`: drop the packet.
+ :param bool advertise: (optional) Indicates whether this route will be
+ advertised to the ingress sources specified by the `advertise_routes_to`
+ routing table property.
+ All routes in a routing table with the same `destination` and `zone` must
+ have the same
+ `advertise` value.
+ :param str name: (optional) The name for this route. The name must not be
+ used by another route in the routing table. Names starting with `ibm-` are
+ reserved for system-provided routes, and are not allowed. If unspecified,
+ the name will be a hyphenated list of randomly-selected words.
+ :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`,
+ the next hop that packets will be delivered to (must not be
+ `0.0.0.0`). For other `action` values, it must be omitted or specified as
+ `0.0.0.0`.
+ At most two routes per `zone` in a table can have the same `destination`
+ and `priority`,
+ and only when each route has an `action` of `deliver` and `next_hop` is an
+ IP address.
+ :param int priority: (optional) The priority of this route. Smaller values
+ have higher priority.
+ If a routing table contains multiple routes with the same `zone` and
+ `destination`, the route with the highest priority (smallest value) is
+ selected. If two routes have the same `destination` and `priority`, traffic
+ is distributed between them.
: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 `Route` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- 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 not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not routing_table_id:
+ raise ValueError('routing_table_id must be provided')
+ if destination is None:
+ raise ValueError('destination must be provided')
+ if zone is None:
+ raise ValueError('zone must be provided')
+ zone = convert_model(zone)
+ if next_hop is not None:
+ next_hop = convert_model(next_hop)
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_vpc_routing_table_route',
)
headers.update(sdk_headers)
@@ -25136,11 +25873,13 @@ def create_load_balancer_listener_policy(
}
data = {
+ 'destination': destination,
+ 'zone': zone,
'action': action,
- 'priority': priority,
+ 'advertise': advertise,
'name': name,
- 'rules': rules,
- 'target': target,
+ 'next_hop': next_hop,
+ 'priority': priority,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -25151,10 +25890,10 @@ def create_load_balancer_listener_policy(
del kwargs['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 = ['vpc_id', 'routing_table_id']
+ path_param_values = self.encode_path_vars(vpc_id, routing_table_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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -25166,37 +25905,38 @@ def create_load_balancer_listener_policy(
response = self.send(request, **kwargs)
return response
- def delete_load_balancer_listener_policy(
+ def delete_vpc_routing_table_route(
self,
- load_balancer_id: str,
- listener_id: str,
+ vpc_id: str,
+ routing_table_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a load balancer listener policy.
+ Delete a VPC routing table route.
- Deletes a policy of the load balancer listener. This operation cannot be reversed.
+ This request deletes a VPC route. This operation cannot be reversed. Only VPC
+ routes with an `origin` of `user` are allowed to be deleted.
- :param str load_balancer_id: The load balancer identifier.
- :param str listener_id: The listener identifier.
- :param str id: The policy identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str routing_table_id: The routing table identifier.
+ :param str id: The VPC routing table 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 not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not routing_table_id:
+ raise ValueError('routing_table_id must be provided')
if not id:
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_vpc_routing_table_route',
)
headers.update(sdk_headers)
@@ -25209,10 +25949,10 @@ def delete_load_balancer_listener_policy(
headers.update(kwargs.get('headers'))
del kwargs['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 = ['vpc_id', 'routing_table_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, routing_table_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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -25223,37 +25963,38 @@ def delete_load_balancer_listener_policy(
response = self.send(request, **kwargs)
return response
- def get_load_balancer_listener_policy(
+ def get_vpc_routing_table_route(
self,
- load_balancer_id: str,
- listener_id: str,
+ vpc_id: str,
+ routing_table_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer listener policy.
+ Retrieve a VPC routing table route.
- Retrieve a single policy specified by the identifier in the URL path.
+ This request retrieves a single VPC route specified by the identifier in the URL
+ path.
- :param str load_balancer_id: The load balancer identifier.
- :param str listener_id: The listener identifier.
- :param str id: The policy identifier.
+ :param str vpc_id: The VPC identifier.
+ :param str routing_table_id: The routing table identifier.
+ :param str id: The VPC routing table 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 `Route` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not routing_table_id:
+ raise ValueError('routing_table_id must be provided')
if not id:
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_vpc_routing_table_route',
)
headers.update(sdk_headers)
@@ -25267,10 +26008,10 @@ def get_load_balancer_listener_policy(
del kwargs['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 = ['vpc_id', 'routing_table_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, routing_table_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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -25281,46 +26022,46 @@ def get_load_balancer_listener_policy(
response = self.send(request, **kwargs)
return response
- def update_load_balancer_listener_policy(
+ def update_vpc_routing_table_route(
self,
- load_balancer_id: str,
- listener_id: str,
+ vpc_id: str,
+ routing_table_id: str,
id: str,
- load_balancer_listener_policy_patch: 'LoadBalancerListenerPolicyPatch',
+ route_patch: 'RoutePatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a load balancer listener policy.
+ Update a VPC routing table route.
- This request updates a load balancer listener policy with the information in a
- provided policy patch. The policy patch object is structured in the same way as a
- retrieved policy and contains only the information to be updated.
+ This request updates a VPC route with the information provided in a route patch
+ object. The patch object is structured in the same way as a retrieved VPC route
+ and needs to contain only the information to be updated. Only VPC routes with an
+ `origin` of `user` are allowed 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 vpc_id: The VPC identifier.
+ :param str routing_table_id: The routing table identifier.
+ :param str id: The VPC routing table route identifier.
+ :param RoutePatch route_patch: The VPC 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 `Route` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
+ if not vpc_id:
+ raise ValueError('vpc_id must be provided')
+ if not routing_table_id:
+ raise ValueError('routing_table_id must be provided')
if not id:
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 route_patch is None:
+ raise ValueError('route_patch must be provided')
+ if isinstance(route_patch, RoutePatch):
+ route_patch = convert_model(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_vpc_routing_table_route',
)
headers.update(sdk_headers)
@@ -25329,7 +26070,7 @@ def update_load_balancer_listener_policy(
'generation': self.generation,
}
- data = json.dumps(load_balancer_listener_policy_patch)
+ data = json.dumps(route_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -25337,10 +26078,10 @@ def update_load_balancer_listener_policy(
del kwargs['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 = ['vpc_id', 'routing_table_id', 'id']
+ path_param_values = self.encode_path_vars(vpc_id, routing_table_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 = '/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -25352,43 +26093,43 @@ def update_load_balancer_listener_policy(
response = self.send(request, **kwargs)
return response
- def list_load_balancer_listener_policy_rules(
+ #########################
+ # VPN gateways
+ #########################
+
+ def list_ike_policies(
self,
- load_balancer_id: str,
- listener_id: str,
- policy_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List rules of a load balancer listener policy.
+ List IKE policies.
- This request lists rules of a load balancer listener policy.
+ This request lists IKE policies 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 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 `IKEPolicyCollection` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
- if not policy_id:
- 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_ike_policies',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -25396,10 +26137,7 @@ def list_load_balancer_listener_policy_rules(
del kwargs['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 = '/ike_policies'
request = self.prepare_request(
method='GET',
url=url,
@@ -25410,71 +26148,55 @@ def list_load_balancer_listener_policy_rules(
response = self.send(request, **kwargs)
return response
- def create_load_balancer_listener_policy_rule(
+ def create_ike_policy(
self,
- load_balancer_id: str,
- listener_id: str,
- policy_id: str,
- condition: str,
- type: str,
- value: str,
+ authentication_algorithm: str,
+ dh_group: int,
+ encryption_algorithm: str,
+ ike_version: int,
*,
- field: Optional[str] = None,
+ key_lifetime: Optional[int] = None,
+ name: Optional[str] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a rule for a load balancer listener policy.
+ Create an IKE policy.
- Creates a new rule for the load balancer listener policy.
+ This request creates a new IKE policy.
- :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 for the rule.
- :param str type: The content the rule applies to:
- - `body`: The UTF-8 form-encoded HTTP request body
- - `header`: The HTTP header
- - `hostname`: The fully-qualified domain name of the server specified in
- the Host
- HTTP request header
- - `path`: The path of the HTTP request
- - `query`: The query of the HTTP request URL
- - `sni_hostname`: The fully-qualified domain name of the server provided in
- the
- "server name indicator" extension during TLS negotiation
- - For listeners with `protocol` `http` or `https`, any type may be
- specified.
- - For listeners with `protocol` `tcp`, only type `sni_hostname` may be
- specified.
- :param str value: The value to be matched for the 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 to match for this rule.
- - If the `type` is `header`, this property must be specified.
- - If the `type` is `body` or `query`, this property may be specified.
- - For all other types, this property must not be specified.
+ :param str authentication_algorithm: The authentication algorithm.
+ :param int dh_group: The Diffie-Hellman group.
+ :param str encryption_algorithm: The encryption algorithm.
+ :param int ike_version: The IKE protocol version.
+ :param int key_lifetime: (optional) The key lifetime in seconds.
+ :param str name: (optional) The name for this IKE policy. The name must not
+ be used by another IKE policies in the region. 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) will be
+ 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 `LoadBalancerListenerPolicyRule` object
+ :rtype: DetailedResponse with `dict` result representing a `IKEPolicy` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
- if not policy_id:
- 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 authentication_algorithm is None:
+ raise ValueError('authentication_algorithm must be provided')
+ if dh_group is None:
+ raise ValueError('dh_group must be provided')
+ if encryption_algorithm is None:
+ raise ValueError('encryption_algorithm must be provided')
+ if ike_version is None:
+ raise ValueError('ike_version must be provided')
+ 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_load_balancer_listener_policy_rule',
+ operation_id='create_ike_policy',
)
headers.update(sdk_headers)
@@ -25484,10 +26206,13 @@ def create_load_balancer_listener_policy_rule(
}
data = {
- 'condition': condition,
- 'type': type,
- 'value': value,
- 'field': field,
+ 'authentication_algorithm': authentication_algorithm,
+ 'dh_group': dh_group,
+ 'encryption_algorithm': encryption_algorithm,
+ 'ike_version': ike_version,
+ 'key_lifetime': key_lifetime,
+ 'name': name,
+ 'resource_group': resource_group,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -25498,10 +26223,7 @@ def create_load_balancer_listener_policy_rule(
del kwargs['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 = '/ike_policies'
request = self.prepare_request(
method='POST',
url=url,
@@ -25513,42 +26235,31 @@ def create_load_balancer_listener_policy_rule(
response = self.send(request, **kwargs)
return response
- def delete_load_balancer_listener_policy_rule(
+ def delete_ike_policy(
self,
- load_balancer_id: str,
- listener_id: str,
- policy_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a load balancer listener policy rule.
+ Delete an IKE policy.
- Deletes a rule from the load balancer listener policy. This operation cannot be
- reversed.
+ This request deletes an IKE policy. This operation cannot be reversed. For this
+ request to succeed, there must not be any VPN gateway connections using this
+ policy.
- :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 id: The IKE policy identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
- if not policy_id:
- raise ValueError('policy_id must be provided')
if not id:
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='delete_ike_policy',
)
headers.update(sdk_headers)
@@ -25561,10 +26272,10 @@ def delete_load_balancer_listener_policy_rule(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- 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 = '/ike_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -25575,41 +26286,29 @@ def delete_load_balancer_listener_policy_rule(
response = self.send(request, **kwargs)
return response
- def get_load_balancer_listener_policy_rule(
+ def get_ike_policy(
self,
- load_balancer_id: str,
- listener_id: str,
- policy_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer listener policy rule.
+ Retrieve an IKE policy.
- Retrieves a single rule specified by the identifier in the URL path.
+ This request retrieves a single IKE policy 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 policy_id: The policy identifier.
- :param str id: The rule identifier.
+ :param str id: The IKE 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 `LoadBalancerListenerPolicyRule` object
+ :rtype: DetailedResponse with `dict` result representing a `IKEPolicy` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
- if not policy_id:
- raise ValueError('policy_id must be provided')
if not id:
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_rule',
+ operation_id='get_ike_policy',
)
headers.update(sdk_headers)
@@ -25623,10 +26322,10 @@ def get_load_balancer_listener_policy_rule(
del kwargs['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 = '/ike_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -25637,48 +26336,35 @@ def get_load_balancer_listener_policy_rule(
response = self.send(request, **kwargs)
return response
- def update_load_balancer_listener_policy_rule(
+ def update_ike_policy(
self,
- load_balancer_id: str,
- listener_id: str,
- policy_id: str,
id: str,
- load_balancer_listener_policy_rule_patch: 'LoadBalancerListenerPolicyRulePatch',
+ ike_policy_patch: 'IKEPolicyPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a load balancer listener policy rule.
+ Update an IKE policy.
- Updates a rule of the load balancer listener policy.
+ This request updates the properties of an existing IKE policy.
- :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 IKE policy identifier.
+ :param IKEPolicyPatch ike_policy_patch: The IKE 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 `LoadBalancerListenerPolicyRule` object
+ :rtype: DetailedResponse with `dict` result representing a `IKEPolicy` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not listener_id:
- raise ValueError('listener_id must be provided')
- if not policy_id:
- raise ValueError('policy_id must be provided')
if not id:
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)
+ if ike_policy_patch is None:
+ raise ValueError('ike_policy_patch must be provided')
+ if isinstance(ike_policy_patch, IKEPolicyPatch):
+ ike_policy_patch = convert_model(ike_policy_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='update_ike_policy',
)
headers.update(sdk_headers)
@@ -25687,7 +26373,7 @@ def update_load_balancer_listener_policy_rule(
'generation': self.generation,
}
- data = json.dumps(load_balancer_listener_policy_rule_patch)
+ data = json.dumps(ike_policy_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -25695,10 +26381,10 @@ def update_load_balancer_listener_policy_rule(
del kwargs['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 = '/ike_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -25710,35 +26396,43 @@ def update_load_balancer_listener_policy_rule(
response = self.send(request, **kwargs)
return response
- def list_load_balancer_pools(
+ def list_ike_policy_connections(
self,
- load_balancer_id: str,
+ id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List pools of a load balancer.
+ List VPN gateway connections that use a specified IKE policy.
- This request lists pools of a load balancer.
+ This request lists VPN gateway connections that use an IKE policy.
- :param str load_balancer_id: The load balancer identifier.
+ :param str id: The IKE 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 `LoadBalancerPoolCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `IKEPolicyConnectionCollection` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_load_balancer_pools',
+ operation_id='list_ike_policy_connections',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -25746,10 +26440,10 @@ def list_load_balancer_pools(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['load_balancer_id']
- path_param_values = self.encode_path_vars(load_balancer_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}/pools'.format(**path_param_dict)
+ url = '/ike_policies/{id}/connections'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -25760,100 +26454,110 @@ def list_load_balancer_pools(
response = self.send(request, **kwargs)
return response
- def create_load_balancer_pool(
+ def list_ipsec_policies(
self,
- load_balancer_id: str,
- algorithm: str,
- health_monitor: 'LoadBalancerPoolHealthMonitorPrototype',
- protocol: str,
*,
- failsafe_policy: Optional['LoadBalancerPoolFailsafePolicyPrototype'] = None,
- members: Optional[List['LoadBalancerPoolMemberPrototype']] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ List IPsec policies.
+
+ This request lists IPsec policies in the region.
+
+ :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 `IPsecPolicyCollection` object
+ """
+
+ headers = {}
+ sdk_headers = get_sdk_headers(
+ service_name=self.DEFAULT_SERVICE_NAME,
+ service_version='V1',
+ operation_id='list_ipsec_policies',
+ )
+ headers.update(sdk_headers)
+
+ params = {
+ 'version': self.version,
+ 'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ }
+
+ if 'headers' in kwargs:
+ headers.update(kwargs.get('headers'))
+ del kwargs['headers']
+ headers['Accept'] = 'application/json'
+
+ url = '/ipsec_policies'
+ request = self.prepare_request(
+ method='GET',
+ url=url,
+ headers=headers,
+ params=params,
+ )
+
+ response = self.send(request, **kwargs)
+ return response
+
+ def create_ipsec_policy(
+ self,
+ authentication_algorithm: str,
+ encryption_algorithm: str,
+ pfs: str,
+ *,
+ key_lifetime: Optional[int] = None,
name: Optional[str] = None,
- proxy_protocol: Optional[str] = None,
- session_persistence: Optional['LoadBalancerPoolSessionPersistencePrototype'] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a load balancer pool.
+ Create an IPsec policy.
- This request creates a new pool from a pool prototype object.
+ This request creates a new IPsec policy.
- :param str load_balancer_id: The load balancer identifier.
- :param str algorithm: The load balancing algorithm. The `least_connections`
- algorithm is only supported for load balancers that have `availability`
- with value `subnet` in the profile.
- :param LoadBalancerPoolHealthMonitorPrototype health_monitor: The health
- monitor of this pool.
- If this pool has a member targeting a load balancer then:
- - If the targeted load balancer has multiple subnets, this health monitor
- will be
- used to direct traffic to the available subnets.
- - The health checks spawned by this health monitor will be handled as any
- other
- traffic (that is, subject to the configuration of listeners and pools on
- the target
- load balancer).
- - This health monitor does not affect how pool member health is determined
- within the
- target load balancer.
- For more information, see [Private Path network load balancer frequently
- asked
- questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs).
- :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 LoadBalancerPoolFailsafePolicyPrototype failsafe_policy: (optional)
- The failsafe policy to use for this pool.
- If unspecified, the default failsafe policy action from the profile will be
- used.
- :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 name for this load balancer pool. The name
- must not be used by another pool for the load balancer. If unspecified, the
+ :param str authentication_algorithm: The authentication algorithm
+ Must be `disabled` if and only if the `encryption_algorithm` is
+ `aes128gcm16`,
+ `aes192gcm16`, or `aes256gcm16`
+ The `md5` and `sha1` algorithms have been deprecated.
+ :param str encryption_algorithm: The encryption algorithm
+ The `authentication_algorithm` must be `disabled` if and only if
+ `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`
+ The `triple_des` algorithm has been deprecated.
+ :param str pfs: The Perfect Forward Secrecy group.
+ Groups `group_2` and `group_5` have been deprecated.
+ :param int key_lifetime: (optional) The key lifetime in seconds.
+ :param str name: (optional) The name for this IPsec policy. The name must
+ not be used by another IPsec policies in the region. 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
- For load balancers in the `network` family, this property must be
- `disabled`.
- :param LoadBalancerPoolSessionPersistencePrototype session_persistence:
- (optional) The session persistence of this pool. If specified, the load
- balancer must have
- `source_ip_session_persistence_supported` set to `true` in its profile.
- If unspecified, session persistence will be disabled, and traffic will be
- distributed
- across members of the pool.
+ :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) will be
+ 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 `LoadBalancerPool` object
+ :rtype: DetailedResponse with `dict` result representing a `IPsecPolicy` object
"""
- if not load_balancer_id:
- 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 failsafe_policy is not None:
- failsafe_policy = convert_model(failsafe_policy)
- 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 authentication_algorithm is None:
+ raise ValueError('authentication_algorithm must be provided')
+ if encryption_algorithm is None:
+ raise ValueError('encryption_algorithm must be provided')
+ if pfs is None:
+ raise ValueError('pfs must be provided')
+ 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_load_balancer_pool',
+ operation_id='create_ipsec_policy',
)
headers.update(sdk_headers)
@@ -25863,14 +26567,12 @@ def create_load_balancer_pool(
}
data = {
- 'algorithm': algorithm,
- 'health_monitor': health_monitor,
- 'protocol': protocol,
- 'failsafe_policy': failsafe_policy,
- 'members': members,
+ 'authentication_algorithm': authentication_algorithm,
+ 'encryption_algorithm': encryption_algorithm,
+ 'pfs': pfs,
+ 'key_lifetime': key_lifetime,
'name': name,
- 'proxy_protocol': proxy_protocol,
- 'session_persistence': session_persistence,
+ 'resource_group': resource_group,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -25881,10 +26583,7 @@ def create_load_balancer_pool(
del kwargs['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)
+ url = '/ipsec_policies'
request = self.prepare_request(
method='POST',
url=url,
@@ -25896,35 +26595,31 @@ def create_load_balancer_pool(
response = self.send(request, **kwargs)
return response
- def delete_load_balancer_pool(
+ def delete_ipsec_policy(
self,
- load_balancer_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a load balancer pool.
+ Delete an IPsec policy.
- 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,
- nor be the target pool in the failsafe policy for any other pool.
+ This request deletes an IPsec policy. This operation cannot be reversed. For this
+ request to succeed, there must not be any VPN gateway connections using this
+ policy.
- :param str load_balancer_id: The load balancer identifier.
- :param str id: The pool identifier.
+ :param str id: The IPsec policy identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
if not id:
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',
+ operation_id='delete_ipsec_policy',
)
headers.update(sdk_headers)
@@ -25937,10 +26632,10 @@ def delete_load_balancer_pool(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['load_balancer_id', 'id']
- path_param_values = self.encode_path_vars(load_balancer_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}/pools/{id}'.format(**path_param_dict)
+ url = '/ipsec_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -25951,33 +26646,30 @@ def delete_load_balancer_pool(
response = self.send(request, **kwargs)
return response
- def get_load_balancer_pool(
+ def get_ipsec_policy(
self,
- load_balancer_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer pool.
+ Retrieve an IPsec policy.
- This request retrieves a single pool specified by the identifier in the URL path.
+ This request retrieves a single IPsec policy specified by the identifier in the
+ URL.
- :param str load_balancer_id: The load balancer identifier.
- :param str id: The pool identifier.
+ :param str id: The IPsec 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 `LoadBalancerPool` object
+ :rtype: DetailedResponse with `dict` result representing a `IPsecPolicy` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
if not id:
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',
+ operation_id='get_ipsec_policy',
)
headers.update(sdk_headers)
@@ -25991,10 +26683,10 @@ def get_load_balancer_pool(
del kwargs['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 = ['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}/pools/{id}'.format(**path_param_dict)
+ url = '/ipsec_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -26005,40 +26697,35 @@ def get_load_balancer_pool(
response = self.send(request, **kwargs)
return response
- def update_load_balancer_pool(
+ def update_ipsec_policy(
self,
- load_balancer_id: str,
id: str,
- load_balancer_pool_patch: 'LoadBalancerPoolPatch',
+ i_psec_policy_patch: 'IPsecPolicyPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a load balancer pool.
+ Update an IPsec policy.
- This request updates a load balancer pool from a pool patch.
+ This request updates the properties of an existing IPsec policy.
- :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 IPsec policy identifier.
+ :param IPsecPolicyPatch i_psec_policy_patch: The IPsec 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 `LoadBalancerPool` object
+ :rtype: DetailedResponse with `dict` result representing a `IPsecPolicy` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
if not id:
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 i_psec_policy_patch is None:
+ raise ValueError('i_psec_policy_patch must be provided')
+ if isinstance(i_psec_policy_patch, IPsecPolicyPatch):
+ i_psec_policy_patch = convert_model(i_psec_policy_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_ipsec_policy',
)
headers.update(sdk_headers)
@@ -26047,7 +26734,7 @@ def update_load_balancer_pool(
'generation': self.generation,
}
- data = json.dumps(load_balancer_pool_patch)
+ data = json.dumps(i_psec_policy_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -26055,10 +26742,10 @@ def update_load_balancer_pool(
del kwargs['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 = ['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}/pools/{id}'.format(**path_param_dict)
+ url = '/ipsec_policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -26070,39 +26757,43 @@ def update_load_balancer_pool(
response = self.send(request, **kwargs)
return response
- def list_load_balancer_pool_members(
+ def list_ipsec_policy_connections(
self,
- load_balancer_id: str,
- pool_id: str,
+ id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
- List members of a load balancer pool.
+ List VPN gateway connections that use a specified IPsec policy.
- This request lists members of a load balancer pool.
+ This request lists VPN gateway connections that use an IPsec policy.
- :param str load_balancer_id: The load balancer identifier.
- :param str pool_id: The pool identifier.
+ :param str id: The IPsec 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 `LoadBalancerPoolMemberCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `IPsecPolicyConnectionCollection` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not pool_id:
- raise ValueError('pool_id must be provided')
+ if not id:
+ raise ValueError('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_ipsec_policy_connections',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
}
if 'headers' in kwargs:
@@ -26110,10 +26801,10 @@ def list_load_balancer_pool_members(
del kwargs['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 = ['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}/pools/{pool_id}/members'.format(**path_param_dict)
+ url = '/ipsec_policies/{id}/connections'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -26124,139 +26815,99 @@ def list_load_balancer_pool_members(
response = self.send(request, **kwargs)
return response
- def create_load_balancer_pool_member(
+ def list_vpn_gateways(
self,
- load_balancer_id: str,
- pool_id: str,
- port: int,
- target: 'LoadBalancerPoolMemberTargetPrototype',
*,
- weight: Optional[int] = None,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ sort: Optional[str] = None,
+ mode: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a member in a load balancer pool.
+ List VPN gateways.
- This request creates a new member and adds the member to the pool.
- The pool must not already have a member targeting a load balancer.
+ This request lists VPN gateways in the region.
- :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.
- 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 LoadBalancerPoolMemberTargetPrototype target: The pool member
- target.
- If the load balancer has `route_mode` set to `true`, the member must be in
- a zone the load
- balancer has a subnet in.
- 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 int weight: (optional) The weight of the member.
- If specified, the pool algorithm must be `weighted_round_robin` and the
- load balancer must be in the `application` family.
- If unspecified, the weight will be `50` for load balancers in the
- `application` family.
+ :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 with a `resource_group.id` property matching 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 str mode: (optional) Filters the collection to VPN gateways with a
+ `mode` property matching the specified 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 `LoadBalancerPoolMember` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNGatewayCollection` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not pool_id:
- 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)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_load_balancer_pool_member',
+ operation_id='list_vpn_gateways',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'resource_group.id': resource_group_id,
+ 'sort': sort,
+ 'mode': mode,
}
- data = {
- 'port': port,
- 'target': target,
- 'weight': weight,
- }
- 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'))
del kwargs['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)
+ url = '/vpn_gateways'
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def replace_load_balancer_pool_members(
+ def create_vpn_gateway(
self,
- load_balancer_id: str,
- pool_id: str,
- members: List['LoadBalancerPoolMemberPrototype'],
+ vpn_gateway_prototype: 'VPNGatewayPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Replace load balancer pool members.
+ Create a VPN gateway.
- This request replaces the existing members of the load balancer pool with new
- members created from the collection of member prototype objects.
+ This request creates a new VPN gateway.
- :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 VPNGatewayPrototype vpn_gateway_prototype: The VPN gateway prototype
+ object.
: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 `VPNGateway` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not pool_id:
- 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 vpn_gateway_prototype is None:
+ raise ValueError('vpn_gateway_prototype must be provided')
+ if isinstance(vpn_gateway_prototype, VPNGatewayPrototype):
+ vpn_gateway_prototype = convert_model(vpn_gateway_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='replace_load_balancer_pool_members',
+ operation_id='create_vpn_gateway',
)
headers.update(sdk_headers)
@@ -26265,11 +26916,7 @@ def replace_load_balancer_pool_members(
'generation': self.generation,
}
- data = {
- 'members': members,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
+ data = json.dumps(vpn_gateway_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -26277,12 +26924,9 @@ def replace_load_balancer_pool_members(
del kwargs['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)
+ url = '/vpn_gateways'
request = self.prepare_request(
- method='PUT',
+ method='POST',
url=url,
headers=headers,
params=params,
@@ -26292,37 +26936,32 @@ def replace_load_balancer_pool_members(
response = self.send(request, **kwargs)
return response
- def delete_load_balancer_pool_member(
+ def delete_vpn_gateway(
self,
- load_balancer_id: str,
- pool_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a load balancer pool member.
+ Delete a VPN gateway.
- This request deletes a member from the pool. This operation cannot be reversed.
+ This request deletes a VPN gateway. This operation cannot be reversed. For this
+ request to succeed, the VPN gateway must not have a `status` of `pending`, and
+ there must not be any VPC routes using the VPN gateway's connections as a next
+ hop.
- :param str load_balancer_id: The load balancer identifier.
- :param str pool_id: The pool identifier.
- :param str id: The member identifier.
+ :param str id: The VPN 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 not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not pool_id:
- raise ValueError('pool_id must be provided')
if not id:
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_vpn_gateway',
)
headers.update(sdk_headers)
@@ -26335,10 +26974,10 @@ def delete_load_balancer_pool_member(
headers.update(kwargs.get('headers'))
del kwargs['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 = ['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}/pools/{pool_id}/members/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -26349,38 +26988,30 @@ def delete_load_balancer_pool_member(
response = self.send(request, **kwargs)
return response
- def get_load_balancer_pool_member(
+ def get_vpn_gateway(
self,
- load_balancer_id: str,
- pool_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a load balancer pool member.
+ Retrieve a VPN gateway.
- This request retrieves a single member specified by the identifier in the URL
- path.
+ This request retrieves a single VPN gateway specified by the identifier in the
+ URL.
- :param str load_balancer_id: The load balancer identifier.
- :param str pool_id: The pool identifier.
- :param str id: The member identifier.
+ :param str id: The VPN 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 `LoadBalancerPoolMember` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNGateway` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not pool_id:
- raise ValueError('pool_id must be provided')
if not id:
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_vpn_gateway',
)
headers.update(sdk_headers)
@@ -26394,10 +27025,10 @@ def get_load_balancer_pool_member(
del kwargs['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 = ['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}/pools/{pool_id}/members/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -26408,44 +27039,35 @@ def get_load_balancer_pool_member(
response = self.send(request, **kwargs)
return response
- def update_load_balancer_pool_member(
+ def update_vpn_gateway(
self,
- load_balancer_id: str,
- pool_id: str,
id: str,
- load_balancer_pool_member_patch: 'LoadBalancerPoolMemberPatch',
+ vpn_gateway_patch: 'VPNGatewayPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update a load balancer pool member.
+ Update a VPN gateway.
- This request updates an existing member from a member patch.
+ This request updates the properties of an existing VPN gateway.
- :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 id: The VPN gateway identifier.
+ :param VPNGatewayPatch vpn_gateway_patch: The VPN 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 `LoadBalancerPoolMember` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNGateway` object
"""
- if not load_balancer_id:
- raise ValueError('load_balancer_id must be provided')
- if not pool_id:
- raise ValueError('pool_id must be provided')
if not id:
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 vpn_gateway_patch is None:
+ raise ValueError('vpn_gateway_patch must be provided')
+ if isinstance(vpn_gateway_patch, VPNGatewayPatch):
+ vpn_gateway_patch = convert_model(vpn_gateway_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_vpn_gateway',
)
headers.update(sdk_headers)
@@ -26454,7 +27076,7 @@ def update_load_balancer_pool_member(
'generation': self.generation,
}
- data = json.dumps(load_balancer_pool_member_patch)
+ data = json.dumps(vpn_gateway_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -26462,10 +27084,10 @@ def update_load_balancer_pool_member(
del kwargs['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 = ['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}/pools/{pool_id}/members/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -26477,75 +27099,47 @@ def update_load_balancer_pool_member(
response = self.send(request, **kwargs)
return response
- #########################
- # Endpoint gateways
- #########################
-
- def list_endpoint_gateways(
+ def list_vpn_gateway_connections(
self,
+ vpn_gateway_id: str,
*,
- name: Optional[str] = None,
start: Optional[str] = None,
limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- lifecycle_state: Optional[List[str]] = None,
- vpc_id: Optional[str] = None,
- vpc_crn: Optional[str] = None,
- vpc_name: Optional[str] = None,
- allow_dns_resolution_binding: Optional[bool] = None,
+ status: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List endpoint gateways.
+ List connections of a VPN gateway.
- This request lists 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 connections of a VPN gateway.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ :param str vpn_gateway_id: The VPN 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 resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param List[str] lifecycle_state: (optional) Filters the collection to
- resources with a `lifecycle_state` property matching one of the specified
- comma-separated values.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
- :param bool allow_dns_resolution_binding: (optional) Filters the collection
- to endpoint gateways with an `allow_dns_resolution_binding` property
- matching the specified value.
+ :param str status: (optional) Filters the collection to VPN gateway
+ connections with a `status` property matching the specified 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 `EndpointGatewayCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNGatewayConnectionCollection` object
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_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_vpn_gateway_connections',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'name': name,
'start': start,
'limit': limit,
- 'resource_group.id': resource_group_id,
- 'lifecycle_state': convert_list(lifecycle_state),
- 'vpc.id': vpc_id,
- 'vpc.crn': vpc_crn,
- 'vpc.name': vpc_name,
- 'allow_dns_resolution_binding': allow_dns_resolution_binding,
+ 'status': status,
}
if 'headers' in kwargs:
@@ -26553,7 +27147,10 @@ def list_endpoint_gateways(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/endpoint_gateways'
+ path_param_keys = ['vpn_gateway_id']
+ path_param_values = self.encode_path_vars(vpn_gateway_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/vpn_gateways/{vpn_gateway_id}/connections'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -26564,87 +27161,36 @@ def list_endpoint_gateways(
response = self.send(request, **kwargs)
return response
- def create_endpoint_gateway(
+ def create_vpn_gateway_connection(
self,
- target: 'EndpointGatewayTargetPrototype',
- vpc: 'VPCIdentity',
- *,
- allow_dns_resolution_binding: Optional[bool] = None,
- ips: Optional[List['EndpointGatewayReservedIP']] = None,
- name: Optional[str] = None,
- resource_group: Optional['ResourceGroupIdentity'] = None,
- security_groups: Optional[List['SecurityGroupIdentity']] = None,
+ vpn_gateway_id: str,
+ vpn_gateway_connection_prototype: 'VPNGatewayConnectionPrototype',
**kwargs,
) -> DetailedResponse:
"""
- Create an endpoint gateway.
+ Create a connection for a VPN 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.
+ This request creates a new VPN gateway connection.
- :param EndpointGatewayTargetPrototype target: The target to use for this
- endpoint gateway. The target:
- - Must not already be the target of another endpoint gateway in the VPC
- - Must not have a service endpoint that overlaps with any
- `service_endpoints` of another
- endpoint gateway in the VPC.
- If `allow_dns_resolution_binding` is `true`, then there must not be another
- endpoint gateway
- with `allow_dns_resolution_binding` set to `true` in the [DNS
- sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that:
- - Has the same `target` as this endpoint gateway
- - Has `service_endpoints` that overlap with the `service_endpoints` for
- this endpoint
- gateway.
- :param VPCIdentity vpc: The VPC this endpoint gateway will reside in.
- :param bool allow_dns_resolution_binding: (optional) Indicates whether to
- allow DNS resolution for this endpoint gateway when the VPC this endpoint
- gateway resides in has a DNS resolution binding to a VPC with
- `dns.enable_hub` set to `true`.
- If `true`, then there must not be another endpoint gateway with
- `allow_dns_resolution_binding` set to `true` in the [DNS
- sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that:
- - Has the same `target` as this endpoint gateway
- - Has `service_endpoints` that overlap with the `service_endpoints` for
- this endpoint
- gateway.
- Must be `true` if the VPC this endpoint gateway resides in has
- `dns.enable_hub` set to
- `true`.
- :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 name for this endpoint gateway. The name
- must not be used by another endpoint gateway in the VPC. 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) will be
- 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 vpn_gateway_id: The VPN gateway identifier.
+ :param VPNGatewayConnectionPrototype vpn_gateway_connection_prototype: The
+ VPN gateway connection prototype object.
: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 `VPNGatewayConnection` 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 not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
+ if vpn_gateway_connection_prototype is None:
+ raise ValueError('vpn_gateway_connection_prototype must be provided')
+ if isinstance(vpn_gateway_connection_prototype, VPNGatewayConnectionPrototype):
+ vpn_gateway_connection_prototype = convert_model(vpn_gateway_connection_prototype)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='create_endpoint_gateway',
+ operation_id='create_vpn_gateway_connection',
)
headers.update(sdk_headers)
@@ -26653,17 +27199,7 @@ def create_endpoint_gateway(
'generation': self.generation,
}
- data = {
- 'target': target,
- 'vpc': vpc,
- 'allow_dns_resolution_binding': allow_dns_resolution_binding,
- '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)
+ data = json.dumps(vpn_gateway_connection_prototype)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
@@ -26671,7 +27207,10 @@ def create_endpoint_gateway(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/endpoint_gateways'
+ path_param_keys = ['vpn_gateway_id']
+ path_param_values = self.encode_path_vars(vpn_gateway_id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/vpn_gateways/{vpn_gateway_id}/connections'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
@@ -26683,63 +27222,53 @@ def create_endpoint_gateway(
response = self.send(request, **kwargs)
return response
- def list_endpoint_gateway_ips(
+ def delete_vpn_gateway_connection(
self,
- endpoint_gateway_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- sort: Optional[str] = None,
+ vpn_gateway_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List reserved IPs bound to an endpoint gateway.
+ Delete a VPN gateway connection.
- This request lists reserved IPs bound to an endpoint gateway.
+ This request deletes a VPN gateway connection. This operation cannot be reversed.
+ For this request to succeed, there must not be VPC routes using this VPN
+ connection as a next hop.
- :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 str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection 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 `ReservedIPCollectionEndpointGatewayContext` object
+ :rtype: DetailedResponse
"""
- if not endpoint_gateway_id:
- raise ValueError('endpoint_gateway_id must be provided')
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
+ if not id:
+ raise ValueError('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',
+ operation_id='delete_vpn_gateway_connection',
)
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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['endpoint_gateway_id']
- path_param_values = self.encode_path_vars(endpoint_gateway_id)
+ path_param_keys = ['vpn_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/endpoint_gateways/{endpoint_gateway_id}/ips'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='DELETE',
url=url,
headers=headers,
params=params,
@@ -26748,35 +27277,34 @@ def list_endpoint_gateway_ips(
response = self.send(request, **kwargs)
return response
- def remove_endpoint_gateway_ip(
+ def get_vpn_gateway_connection(
self,
- endpoint_gateway_id: str,
+ vpn_gateway_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Unbind a reserved IP from an endpoint gateway.
+ Retrieve a VPN gateway connection.
- 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.
+ This request retrieves a single VPN gateway connection specified by the identifier
+ in the URL.
- :param str endpoint_gateway_id: The endpoint gateway identifier.
- :param str id: The reserved IP identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection 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 `VPNGatewayConnection` object
"""
- if not endpoint_gateway_id:
- raise ValueError('endpoint_gateway_id must be provided')
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
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='get_vpn_gateway_connection',
)
headers.update(sdk_headers)
@@ -26788,13 +27316,14 @@ def remove_endpoint_gateway_ip(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = ['vpn_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(vpn_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)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='DELETE',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -26803,34 +27332,40 @@ def remove_endpoint_gateway_ip(
response = self.send(request, **kwargs)
return response
- def get_endpoint_gateway_ip(
+ def update_vpn_gateway_connection(
self,
- endpoint_gateway_id: str,
+ vpn_gateway_id: str,
id: str,
+ vpn_gateway_connection_patch: 'VPNGatewayConnectionPatch',
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a reserved IP bound to an endpoint gateway.
+ Update a VPN gateway connection.
- This request retrieves the specified reserved IP address if it is bound to the
- endpoint gateway specified in the URL.
+ This request updates the properties of an existing VPN gateway connection.
- :param str endpoint_gateway_id: The endpoint gateway identifier.
- :param str id: The reserved IP identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param VPNGatewayConnectionPatch vpn_gateway_connection_patch: The VPN
+ gateway connection 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 `VPNGatewayConnection` object
"""
- if not endpoint_gateway_id:
- raise ValueError('endpoint_gateway_id must be provided')
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if vpn_gateway_connection_patch is None:
+ raise ValueError('vpn_gateway_connection_patch must be provided')
+ if isinstance(vpn_gateway_connection_patch, VPNGatewayConnectionPatch):
+ vpn_gateway_connection_patch = convert_model(vpn_gateway_connection_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_endpoint_gateway_ip',
+ operation_id='update_vpn_gateway_connection',
)
headers.update(sdk_headers)
@@ -26839,56 +27374,57 @@ def get_endpoint_gateway_ip(
'generation': self.generation,
}
+ data = json.dumps(vpn_gateway_connection_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['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 = ['vpn_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(vpn_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)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def add_endpoint_gateway_ip(
+ def list_vpn_gateway_connections_local_cidrs(
self,
- endpoint_gateway_id: str,
+ vpn_gateway_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Bind a reserved IP to an endpoint gateway.
+ List local CIDRs for a VPN gateway connection.
- This request binds the specified reserved IP to the specified endpoint gateway.
- The reserved IP:
- - must currently be unbound, or not required by its target
- - must not be in the same zone as any other reserved IP bound to the endpoint
- gateway.
+ This request lists local CIDRs for a VPN gateway connection.
+ This request is only supported for policy mode VPN gateways.
- :param str endpoint_gateway_id: The endpoint gateway identifier.
- :param str id: The reserved IP identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection 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 `VPNGatewayConnectionCIDRs` object
"""
- if not endpoint_gateway_id:
- raise ValueError('endpoint_gateway_id must be provided')
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
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',
+ operation_id='list_vpn_gateway_connections_local_cidrs',
)
headers.update(sdk_headers)
@@ -26902,12 +27438,12 @@ def add_endpoint_gateway_ip(
del kwargs['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 = ['vpn_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(vpn_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)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs'.format(**path_param_dict)
request = self.prepare_request(
- method='PUT',
+ method='GET',
url=url,
headers=headers,
params=params,
@@ -26916,31 +27452,38 @@ def add_endpoint_gateway_ip(
response = self.send(request, **kwargs)
return response
- def delete_endpoint_gateway(
+ def remove_vpn_gateway_connections_local_cidr(
self,
+ vpn_gateway_id: str,
id: str,
+ cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an endpoint gateway.
+ Remove a local CIDR from a VPN gateway connection.
- 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 removes a CIDR from a VPN gateway connection.
+ This request is only supported for policy mode VPN gateways.
- :param str id: The endpoint gateway identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param str cidr: The IP address range in CIDR block notation.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if not cidr:
+ raise ValueError('cidr 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='remove_vpn_gateway_connections_local_cidr',
)
headers.update(sdk_headers)
@@ -26953,10 +27496,10 @@ def delete_endpoint_gateway(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/endpoint_gateways/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -26967,30 +27510,39 @@ def delete_endpoint_gateway(
response = self.send(request, **kwargs)
return response
- def get_endpoint_gateway(
+ def check_vpn_gateway_connections_local_cidr(
self,
+ vpn_gateway_id: str,
id: str,
+ cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an endpoint gateway.
+ Check if the specified local CIDR exists on a VPN gateway connection.
- This request retrieves a single endpoint gateway specified by the identifier in
- the URL.
+ 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 id: The endpoint gateway identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param str cidr: The IP address range in CIDR block notation.
: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
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if not cidr:
+ raise ValueError('cidr 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='check_vpn_gateway_connections_local_cidr',
)
headers.update(sdk_headers)
@@ -27002,12 +27554,11 @@ def get_endpoint_gateway(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/endpoint_gateways/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -27018,36 +27569,40 @@ def get_endpoint_gateway(
response = self.send(request, **kwargs)
return response
- def update_endpoint_gateway(
+ def add_vpn_gateway_connections_local_cidr(
self,
+ vpn_gateway_id: str,
id: str,
- endpoint_gateway_patch: 'EndpointGatewayPatch',
+ cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Update an endpoint gateway.
+ Set a local CIDR on a VPN gateway connection.
- This request updates an endpoint gateway's name.
+ 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 id: The endpoint gateway identifier.
- :param EndpointGatewayPatch endpoint_gateway_patch: The endpoint gateway
- patch.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param str cidr: The IP address range in CIDR block notation.
: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
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
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 not cidr:
+ raise ValueError('cidr must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_endpoint_gateway',
+ operation_id='add_vpn_gateway_connections_local_cidr',
)
headers.update(sdk_headers)
@@ -27056,101 +27611,58 @@ def update_endpoint_gateway(
'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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/endpoint_gateways/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- #########################
- # Flow log collectors
- #########################
-
- def list_flow_log_collectors(
+ def list_vpn_gateway_connections_peer_cidrs(
self,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- name: Optional[str] = None,
- vpc_id: Optional[str] = None,
- vpc_crn: Optional[str] = None,
- vpc_name: Optional[str] = None,
- target_id: Optional[str] = None,
- target_resource_type: Optional[str] = None,
+ vpn_gateway_id: str,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List flow log collectors.
+ List peer CIDRs for a VPN gateway connection.
- This request lists flow log collectors in the region. A [flow log
- collector](https://cloud.ibm.com/docs/vpc?topic=vpc-flow-logs) summarizes TCP and
- UDP data sent over the instance network interfaces and instance network
- attachments contained within its target. The collected flow logs are written to a
- cloud object storage bucket, where they can be
- [viewed](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze).
+ This request lists peer CIDRs for a VPN gateway connection.
+ This request is only supported for policy mode VPN gateways.
- :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 with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
- :param str target_id: (optional) Filters the collection to resources with a
- `target.id` property matching the specified identifier.
- :param str target_resource_type: (optional) Filters the collection to
- resources with a `target.resource_type` property matching the specified
- value.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection 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 `VPNGatewayConnectionCIDRs` object
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
+ if not id:
+ raise ValueError('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_vpn_gateway_connections_peer_cidrs',
)
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:
@@ -27158,7 +27670,10 @@ def list_flow_log_collectors(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/flow_log_collectors'
+ path_param_keys = ['vpn_gateway_id', 'id']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id)
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -27169,130 +27684,38 @@ def list_flow_log_collectors(
response = self.send(request, **kwargs)
return response
- def create_flow_log_collector(
- self,
- storage_bucket: 'LegacyCloudObjectStorageBucketIdentity',
- target: 'FlowLogCollectorTargetPrototype',
- *,
- active: Optional[bool] = None,
- name: Optional[str] = None,
- resource_group: Optional['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. For more information, see [Creating a flow log
- collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector).
- :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
- instance network attachments, virtual network interfaces or instance
- network interfaces
- within the target that are themselves the target of a more specific flow
- log collector.
- The target must not be a virtual network interface that is attached to a
- bare metal server
- network attachment or to a file share mount target.
- :param bool active: (optional) Indicates whether this collector will be
- active upon creation.
- :param str name: (optional) The name for this flow log collector. The name
- must not be used by another flow log collector in the VPC. 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) will be
- 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'))
- del kwargs['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(
+ def remove_vpn_gateway_connections_peer_cidr(
self,
+ vpn_gateway_id: str,
id: str,
+ cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete a flow log collector.
+ Remove a peer CIDR from a VPN gateway connection.
- 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 removes a CIDR from a VPN gateway connection.
+ This request is only supported for policy mode VPN gateways.
- :param str id: The flow log collector identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param str cidr: The IP address range in CIDR block notation.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if not cidr:
+ raise ValueError('cidr 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='remove_vpn_gateway_connections_peer_cidr',
)
headers.update(sdk_headers)
@@ -27305,10 +27728,10 @@ def delete_flow_log_collector(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/flow_log_collectors/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -27319,30 +27742,39 @@ def delete_flow_log_collector(
response = self.send(request, **kwargs)
return response
- def get_flow_log_collector(
+ def check_vpn_gateway_connections_peer_cidr(
self,
+ vpn_gateway_id: str,
id: str,
+ cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a flow log collector.
+ Check if the specified peer CIDR exists on a VPN gateway connection.
- This request retrieves a single flow log collector specified by the identifier in
- the URL.
+ 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 id: The flow log collector identifier.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param str cidr: The IP address range in CIDR block notation.
: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
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
raise ValueError('id must be provided')
+ if not cidr:
+ raise ValueError('cidr 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='check_vpn_gateway_connections_peer_cidr',
)
headers.update(sdk_headers)
@@ -27354,12 +27786,11 @@ def get_flow_log_collector(
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/flow_log_collectors/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -27370,39 +27801,40 @@ def get_flow_log_collector(
response = self.send(request, **kwargs)
return response
- def update_flow_log_collector(
+ def add_vpn_gateway_connections_peer_cidr(
self,
+ vpn_gateway_id: str,
id: str,
- flow_log_collector_patch: 'FlowLogCollectorPatch',
+ cidr: str,
**kwargs,
) -> DetailedResponse:
"""
- Update a flow log collector.
+ Set a peer CIDR on a VPN gateway connection.
- 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 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 id: The flow log collector identifier.
- :param FlowLogCollectorPatch flow_log_collector_patch: The flow log
- collector patch.
+ :param str vpn_gateway_id: The VPN gateway identifier.
+ :param str id: The VPN gateway connection identifier.
+ :param str cidr: The IP address range in CIDR block notation.
: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
"""
+ if not vpn_gateway_id:
+ raise ValueError('vpn_gateway_id must be provided')
if not id:
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 not cidr:
+ raise ValueError('cidr must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_flow_log_collector',
+ operation_id='add_vpn_gateway_connections_peer_cidr',
)
headers.update(sdk_headers)
@@ -27411,80 +27843,77 @@ def update_flow_log_collector(
'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'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['id']
- path_param_values = self.encode_path_vars(id)
+ path_param_keys = ['vpn_gateway_id', 'id', 'cidr']
+ path_param_values = self.encode_path_vars(vpn_gateway_id, id, cidr)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/flow_log_collectors/{id}'.format(**path_param_dict)
+ url = '/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='PUT',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
#########################
- # Private path service gateways
+ # VPN servers
#########################
- def list_private_path_service_gateways(
+ def list_vpn_servers(
self,
*,
+ name: Optional[str] = None,
start: Optional[str] = None,
- limit: Optional[int] = None,
- resource_group_id: Optional[str] = None,
- **kwargs,
- ) -> DetailedResponse:
- """
- List private path service gateways.
-
- This request lists private path service gateways in the region. Private path
- service gateways allow
- [service
- providers](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components)
- to make their services available using
- [private path
- connectivity](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components).
- Private path service gateways are used to facilitate and manage the private path
- connectivity between private path network load balancers and their associated
- endpoint gateways.
+ limit: Optional[int] = None,
+ resource_group_id: Optional[str] = None,
+ sort: Optional[str] = None,
+ **kwargs,
+ ) -> DetailedResponse:
+ """
+ List VPN servers.
+
+ This request lists VPN servers.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching 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 with a `resource_group.id` property matching 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 `PrivatePathServiceGatewayCollection` 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_private_path_service_gateways',
+ operation_id='list_vpn_servers',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'name': name,
'start': start,
'limit': limit,
'resource_group.id': resource_group_id,
+ 'sort': sort,
}
if 'headers' in kwargs:
@@ -27492,7 +27921,7 @@ def list_private_path_service_gateways(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/private_path_service_gateways'
+ url = '/vpn_servers'
request = self.prepare_request(
method='GET',
url=url,
@@ -27503,69 +27932,94 @@ def list_private_path_service_gateways(
response = self.send(request, **kwargs)
return response
- def create_private_path_service_gateway(
+ def create_vpn_server(
self,
- load_balancer: 'LoadBalancerIdentity',
- service_endpoints: List[str],
+ certificate: 'CertificateInstanceIdentity',
+ client_authentication: List['VPNServerAuthenticationPrototype'],
+ client_ip_pool: str,
+ subnets: List['SubnetIdentity'],
*,
- default_access_policy: Optional[str] = None,
+ client_dns_server_ips: Optional[List['IP']] = None,
+ client_idle_timeout: Optional[int] = None,
+ enable_split_tunneling: Optional[bool] = None,
name: Optional[str] = None,
+ port: Optional[int] = None,
+ protocol: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
- zonal_affinity: Optional[bool] = None,
+ security_groups: Optional[List['SecurityGroupIdentity']] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create a private path service gateway.
+ Create a VPN server.
- This request creates a private path service gateway from a private path service
- gateway prototype object. The prototype object is structured in the same way as a
- retrieved private path service gateway, and contains the information necessary to
- create the new private path service gateway.
+ This request creates a new VPN server.
- :param LoadBalancerIdentity load_balancer: The load balancer for this
- private path service gateway. The load balancer must
- have `is_private_path` set to `true`.
- The private path service gateway will reside in the same VPC as the
- specified load
- balancer.
- :param List[str] service_endpoints: The fully qualified domain names for
- this private path service gateway. Any uppercase letters will be converted
- to lowercase.
- :param str default_access_policy: (optional) The policy to use for bindings
- from accounts without an explicit account policy.
- :param str name: (optional) The name for this private path service gateway.
- The name must not be used by another private path service gateway in the
- VPC. If unspecified, the name will be a hyphenated list of
- randomly-selected words.
+ :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 name for this VPN server. The name must not
+ be used by another VPN server in the VPC. If unspecified, the name will be
+ a hyphenated list of randomly-selected words.
+ :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) will be
used.
- :param bool zonal_affinity: (optional) Indicates whether this private path
- service gateway has zonal affinity.
- - `true`: Traffic to the service from a zone the service resides in will
- remain in
- that zone.
- - `false`: Traffic to the service from a zone will be load balanced across
- all zones
- in the region the service resides in.
+ :param List[SecurityGroupIdentity] security_groups: (optional) The security
+ groups to use for this VPN server. 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 `PrivatePathServiceGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServer` object
"""
- if load_balancer is None:
- raise ValueError('load_balancer must be provided')
- if service_endpoints is None:
- raise ValueError('service_endpoints must be provided')
- load_balancer = convert_model(load_balancer)
+ 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 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:
+ 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_private_path_service_gateway',
+ operation_id='create_vpn_server',
)
headers.update(sdk_headers)
@@ -27575,12 +28029,18 @@ def create_private_path_service_gateway(
}
data = {
- 'load_balancer': load_balancer,
- 'service_endpoints': service_endpoints,
- 'default_access_policy': default_access_policy,
+ 'certificate': certificate,
+ 'client_authentication': client_authentication,
+ 'client_ip_pool': client_ip_pool,
+ 'subnets': 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,
- 'zonal_affinity': zonal_affinity,
+ 'security_groups': security_groups,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
@@ -27591,7 +28051,7 @@ def create_private_path_service_gateway(
del kwargs['headers']
headers['Accept'] = 'application/json'
- url = '/private_path_service_gateways'
+ url = '/vpn_servers'
request = self.prepare_request(
method='POST',
url=url,
@@ -27603,19 +28063,21 @@ def create_private_path_service_gateway(
response = self.send(request, **kwargs)
return response
- def delete_private_path_service_gateway(
+ def delete_vpn_server(
self,
id: str,
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Delete a private path service gateway.
+ Delete a VPN server.
- This request deletes a private path service gateway. For this request to succeed,
- the value of `endpoint_gateway_count` must be `0`. This operation cannot be
- reversed.
+ This request deletes a VPN server. This operation cannot be reversed.
- :param str id: The private path service gateway 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
@@ -27623,11 +28085,13 @@ def delete_private_path_service_gateway(
if not id:
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_private_path_service_gateway',
+ operation_id='delete_vpn_server',
)
headers.update(sdk_headers)
@@ -27643,7 +28107,7 @@ def delete_private_path_service_gateway(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/private_path_service_gateways/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -27654,21 +28118,20 @@ def delete_private_path_service_gateway(
response = self.send(request, **kwargs)
return response
- def get_private_path_service_gateway(
+ def get_vpn_server(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve a private path service gateway.
+ Retrieve a VPN server.
- This request retrieves the private path service gateway specified by the
- identifier in the URL.
+ This request retrieves a single VPN server specified by the identifier in the URL.
- :param str id: The private path service gateway 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 `PrivatePathServiceGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServer` object
"""
if not id:
@@ -27677,7 +28140,7 @@ def get_private_path_service_gateway(
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_private_path_service_gateway',
+ operation_id='get_vpn_server',
)
headers.update(sdk_headers)
@@ -27694,7 +28157,7 @@ def get_private_path_service_gateway(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/private_path_service_gateways/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -27705,39 +28168,43 @@ def get_private_path_service_gateway(
response = self.send(request, **kwargs)
return response
- def update_private_path_service_gateway(
+ def update_vpn_server(
self,
id: str,
- private_path_service_gateway_patch: 'PrivatePathServiceGatewayPatch',
+ vpn_server_patch: 'VPNServerPatch',
+ *,
+ if_match: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Update a private path service gateway.
+ Update a VPN server.
- This request updates a private path service gateway with the information provided
- in a private path service gateway patch object. The private path service gateway
- patch object is structured in the same way as a retrieved private path service
- gateway and contains only the information to be updated.
+ This request updates the properties of an existing VPN server. Any updates other
+ than to `name` will cause all connected VPN clients to be disconnected.
- :param str id: The private path service gateway identifier.
- :param PrivatePathServiceGatewayPatch private_path_service_gateway_patch:
- The private path service gateway 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 `PrivatePathServiceGateway` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServer` object
"""
if not id:
raise ValueError('id must be provided')
- if private_path_service_gateway_patch is None:
- raise ValueError('private_path_service_gateway_patch must be provided')
- if isinstance(private_path_service_gateway_patch, PrivatePathServiceGatewayPatch):
- private_path_service_gateway_patch = convert_model(private_path_service_gateway_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_private_path_service_gateway',
+ operation_id='update_vpn_server',
)
headers.update(sdk_headers)
@@ -27746,7 +28213,7 @@ def update_private_path_service_gateway(
'generation': self.generation,
}
- data = json.dumps(private_path_service_gateway_patch)
+ data = json.dumps(vpn_server_patch)
headers['content-type'] = 'application/merge-patch+json'
if 'headers' in kwargs:
@@ -27757,7 +28224,7 @@ def update_private_path_service_gateway(
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/private_path_service_gateways/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
@@ -27769,64 +28236,48 @@ def update_private_path_service_gateway(
response = self.send(request, **kwargs)
return response
- def list_private_path_service_gateway_account_policies(
+ def get_vpn_server_client_configuration(
self,
- private_path_service_gateway_id: str,
- *,
- start: Optional[str] = None,
- limit: Optional[int] = None,
- account_id: Optional[str] = None,
+ id: str,
**kwargs,
) -> DetailedResponse:
"""
- List account policies for a private path service gateway.
+ Retrieve client configuration.
- This request lists account policies for a private path service gateway. Each
- policy defines how requests to use the private path service gateway from that
- account will be handled.
- The account policies will be sorted by their `created_at` property values, with
- newest account policies first. Account policies with identical `created_at`
- property values will in turn be sorted by ascending `id` property values.
+ 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 private_path_service_gateway_id: The private path service
- 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 account_id: (optional) Filters the collection to resources with
- an `account.id` property matching the specified 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 `PrivatePathServiceGatewayAccountPolicyCollection` object
+ :rtype: DetailedResponse with `str` result
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='list_private_path_service_gateway_account_policies',
+ operation_id='get_vpn_server_client_configuration',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
- 'start': start,
- 'limit': limit,
- 'account.id': account_id,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
+ headers['Accept'] = 'text/plain'
- path_param_keys = ['private_path_service_gateway_id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies'.format(**path_param_dict)
+ url = '/vpn_servers/{id}/client_configuration'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -27837,121 +28288,100 @@ def list_private_path_service_gateway_account_policies(
response = self.send(request, **kwargs)
return response
- def create_private_path_service_gateway_account_policy(
+ def list_vpn_server_clients(
self,
- private_path_service_gateway_id: str,
- access_policy: str,
- account: 'AccountIdentity',
+ vpn_server_id: str,
+ *,
+ start: Optional[str] = None,
+ limit: Optional[int] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Create an account policy for a private path service gateway.
+ List VPN clients for a VPN server.
- This request creates an account policy from an account policy prototype object.
- The prototype object is structured in the same way as a retrieved account policy,
- and contains the information necessary to create the new account policy.
+ This request retrieves connected VPN clients, and any disconnected VPN clients
+ that the VPN server has not yet deleted based on its auto-deletion policy.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str access_policy: The access policy for the account. Updating the
- access policy only affects pending and future endpoint gateway bindings.
- - permit: access will be permitted
- - deny: access will be denied
- - review: access will be manually reviewed
- - Updating to `review` sets the status of future endpoint gateway bindings
- from
- this account to `pending`.
- - Updating to `permit` updates both the status of any `pending` and future
- endpoint
- gateway bindings from this account to `permitted`.
- - Updating to `deny` updates both the status of any `pending` and future
- endpoint
- gateway bindings from this account to `denied`.
- :param AccountIdentity account: The account for this access policy. The
- account must be unique across all account
- policies for this private path service gateway.
+ :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 `PrivatePathServiceGatewayAccountPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServerClientCollection` object
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
- if access_policy is None:
- raise ValueError('access_policy must be provided')
- if account is None:
- raise ValueError('account must be provided')
- account = convert_model(account)
+ if not vpn_server_id:
+ 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='create_private_path_service_gateway_account_policy',
+ operation_id='list_vpn_server_clients',
)
headers.update(sdk_headers)
params = {
'version': self.version,
'generation': self.generation,
+ 'start': start,
+ 'limit': limit,
+ 'sort': sort,
}
- data = {
- 'access_policy': access_policy,
- 'account': account,
- }
- 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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/clients'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def delete_private_path_service_gateway_account_policy(
+ def delete_vpn_server_client(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Delete an account policy for a private path service gateway.
+ Delete a VPN client.
- This request deletes an account policy. This operation cannot be reversed and it
- does not affect the `status` of any existing endpoint gateway bindings.
+ 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 private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str id: The account policy 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
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ raise ValueError('vpn_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='delete_private_path_service_gateway_account_policy',
+ operation_id='delete_vpn_server_client',
)
headers.update(sdk_headers)
@@ -27964,10 +28394,10 @@ def delete_private_path_service_gateway_account_policy(
headers.update(kwargs.get('headers'))
del kwargs['headers']
- path_param_keys = ['private_path_service_gateway_id', 'id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/clients/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
@@ -27978,35 +28408,33 @@ def delete_private_path_service_gateway_account_policy(
response = self.send(request, **kwargs)
return response
- def get_private_path_service_gateway_account_policy(
+ def get_vpn_server_client(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
id: str,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an account policy for a private path service gateway.
+ Retrieve a VPN client.
- This request retrieves a single account policy specified by the identifier in the
- URL.
+ This request retrieves a single VPN client specified by the identifier in the URL.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str id: The account policy 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 `PrivatePathServiceGatewayAccountPolicy` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServerClient` object
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ raise ValueError('vpn_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='get_private_path_service_gateway_account_policy',
+ operation_id='get_vpn_server_client',
)
headers.update(sdk_headers)
@@ -28020,10 +28448,10 @@ def get_private_path_service_gateway_account_policy(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id', 'id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/clients/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -28034,44 +28462,36 @@ def get_private_path_service_gateway_account_policy(
response = self.send(request, **kwargs)
return response
- def update_private_path_service_gateway_account_policy(
+ def disconnect_vpn_client(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
id: str,
- private_path_service_gateway_account_policy_patch: 'PrivatePathServiceGatewayAccountPolicyPatch',
**kwargs,
) -> DetailedResponse:
"""
- Update an account policy for a private path service gateway.
+ Disconnect a VPN client.
- This request updates an account policy with the information in a provided account
- policy patch. The account policy patch object is structured in the same way as a
- retrieved account policy and contains only the information to be updated.
+ 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 private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str id: The account policy identifier.
- :param PrivatePathServiceGatewayAccountPolicyPatch
- private_path_service_gateway_account_policy_patch: The account policy
- patch.
+ :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 `PrivatePathServiceGatewayAccountPolicy` object
+ :rtype: DetailedResponse
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ raise ValueError('vpn_server_id must be provided')
if not id:
raise ValueError('id must be provided')
- if private_path_service_gateway_account_policy_patch is None:
- raise ValueError('private_path_service_gateway_account_policy_patch must be provided')
- if isinstance(private_path_service_gateway_account_policy_patch, PrivatePathServiceGatewayAccountPolicyPatch):
- private_path_service_gateway_account_policy_patch = convert_model(private_path_service_gateway_account_policy_patch)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='update_private_path_service_gateway_account_policy',
+ operation_id='disconnect_vpn_client',
)
headers.update(sdk_headers)
@@ -28080,74 +28500,62 @@ def update_private_path_service_gateway_account_policy(
'generation': self.generation,
}
- data = json.dumps(private_path_service_gateway_account_policy_patch)
- headers['content-type'] = 'application/merge-patch+json'
-
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
- headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id', 'id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/clients/{id}/disconnect'.format(**path_param_dict)
request = self.prepare_request(
- method='PATCH',
+ method='POST',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def list_private_path_service_gateway_endpoint_gateway_bindings(
+ def list_vpn_server_routes(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
*,
start: Optional[str] = None,
limit: Optional[int] = None,
- status: Optional[str] = None,
- account_id: Optional[str] = None,
+ sort: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- List endpoint gateway bindings for a private path service gateway.
+ List VPN routes for a VPN server.
- This request lists endpoint gateway bindings for a private path service gateway.
- Each endpoint gateway binding is implicitly created when an endpoint gateway is
- created targeting the private path service gateway. The associated account policy
- is applied to all new endpoint gateway bindings. If an associated account policy
- doesn't exist, the private path service gateway's `default_access_policy` is used.
- The endpoint gateway bindings will be sorted by their `created_at` property
- values, with newest endpoint gateway bindings first. Endpoint gateway bindings
- with identical
- `created_at` property values will in turn be sorted by ascending `name` property
- values.
+ This request lists 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 private_path_service_gateway_id: The private path service
- gateway 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 status: (optional) Filters the collection to endpoint gateway
- bindings with a `status` property matching the specified value.
- :param str account_id: (optional) Filters the collection to resources with
- an `account.id` property matching 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 `PrivatePathServiceGatewayEndpointGatewayBindingCollection` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServerRouteCollection` object
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ 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_private_path_service_gateway_endpoint_gateway_bindings',
+ operation_id='list_vpn_server_routes',
)
headers.update(sdk_headers)
@@ -28156,8 +28564,7 @@ def list_private_path_service_gateway_endpoint_gateway_bindings(
'generation': self.generation,
'start': start,
'limit': limit,
- 'status': status,
- 'account.id': account_id,
+ 'sort': sort,
}
if 'headers' in kwargs:
@@ -28165,10 +28572,10 @@ def list_private_path_service_gateway_endpoint_gateway_bindings(
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/routes'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
@@ -28179,35 +28586,52 @@ def list_private_path_service_gateway_endpoint_gateway_bindings(
response = self.send(request, **kwargs)
return response
- def get_private_path_service_gateway_endpoint_gateway_binding(
+ def create_vpn_server_route(
self,
- private_path_service_gateway_id: str,
- id: str,
+ vpn_server_id: str,
+ destination: str,
+ *,
+ action: Optional[str] = None,
+ name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
- Retrieve an endpoint gateway binding for a private path service gateway.
+ Create a VPN route for a VPN server.
- This request retrieves a single endpoint gateway binding specified by the
- identifier in the URL.
+ 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.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str id: The endpoint gateway binding identifier.
+ :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.
+ :param str name: (optional) The name for this VPN server route. The name
+ must not be used by another route for the VPN server. 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 `PrivatePathServiceGatewayEndpointGatewayBinding` object
+ :rtype: DetailedResponse with `dict` result representing a `VPNServerRoute` object
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
- if not id:
- raise ValueError('id must be provided')
+ if not vpn_server_id:
+ 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='get_private_path_service_gateway_endpoint_gateway_binding',
+ operation_id='create_vpn_server_route',
)
headers.update(sdk_headers)
@@ -28216,68 +28640,62 @@ def get_private_path_service_gateway_endpoint_gateway_binding(
'generation': self.generation,
}
+ data = {
+ 'destination': destination,
+ 'action': action,
+ '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'))
del kwargs['headers']
headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id', 'id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_id, 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 = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/routes'.format(**path_param_dict)
request = self.prepare_request(
- method='GET',
+ method='POST',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def deny_private_path_service_gateway_endpoint_gateway_binding(
+ def delete_vpn_server_route(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
id: str,
- *,
- set_account_policy: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Deny an endpoint gateway binding for a private path service gateway.
+ Delete a VPN route.
- This request denies a `pending` endpoint gateway request, and optionally sets the
- policy to deny future requests from the same account.
+ This request deletes a VPN route. This operation cannot be reversed.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str id: The endpoint gateway binding identifier.
- :param bool set_account_policy: (optional) Indicates whether this will
- become the access policy for any `pending` and future endpoint gateway
- bindings from the same account.
- If set to `true`:
- - If the account has an existing access policy, that policy will be updated
- to `deny`.
- Otherwise, a new `deny` access policy will be created for the account.
- - All `pending` endpoint gateway bindings for the account will be denied.
- If set to `false`:
- - No access policies will be created or updated
- - All `pending` endpoint gateway bindings for the account will remain
- `pending`.
+ :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 not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ raise ValueError('vpn_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='deny_private_path_service_gateway_endpoint_gateway_binding',
+ operation_id='delete_vpn_server_route',
)
headers.update(sdk_headers)
@@ -28286,77 +28704,51 @@ def deny_private_path_service_gateway_endpoint_gateway_binding(
'generation': self.generation,
}
- data = {
- 'set_account_policy': set_account_policy,
- }
- 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'))
del kwargs['headers']
- path_param_keys = ['private_path_service_gateway_id', 'id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/deny'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='DELETE',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def permit_private_path_service_gateway_endpoint_gateway_binding(
+ def get_vpn_server_route(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
id: str,
- *,
- set_account_policy: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
- Permit an endpoint gateway binding for a private path service gateway.
+ Retrieve a VPN route.
- This request permits a `pending` endpoint gateway request, and optionally sets the
- policy to permit future requests from the same account.
+ This request retrieves a single VPN route specified by the identifier in the URL.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param str id: The endpoint gateway binding identifier.
- :param bool set_account_policy: (optional) Indicates whether this will
- become the access policy for any `pending` and future endpoint gateway
- bindings from the same account.
- If set to `true`:
- - If the account has an existing access policy, that policy will be updated
- to
- `permit`. Otherwise, a new `permit` access policy will be created for the
- account.
- - All `pending` endpoint gateway bindings for the account will be
- permitted.
- If set to `false`:
- - No access policies will be created or updated
- - All `pending` endpoint gateway bindings for the account will remain
- `pending`.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `VPNServerRoute` object
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ raise ValueError('vpn_server_id must be provided')
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
- operation_id='permit_private_path_service_gateway_endpoint_gateway_binding',
+ operation_id='get_vpn_server_route',
)
headers.update(sdk_headers)
@@ -28365,57 +28757,60 @@ def permit_private_path_service_gateway_endpoint_gateway_binding(
'generation': self.generation,
}
- data = {
- 'set_account_policy': set_account_policy,
- }
- 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'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id', 'id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/permit'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='GET',
url=url,
headers=headers,
params=params,
- data=data,
)
response = self.send(request, **kwargs)
return response
- def publish_private_path_service_gateway(
+ def update_vpn_server_route(
self,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
+ id: str,
+ vpn_server_route_patch: 'VPNServerRoutePatch',
**kwargs,
) -> DetailedResponse:
"""
- Publish a private path service gateway.
+ Update a VPN route.
- This request publishes a private path service gateway, allowing any account to
- request access to it.
+ 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 private_path_service_gateway_id: The private path service
- gateway identifier.
+ :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
+ :rtype: DetailedResponse with `dict` result representing a `VPNServerRoute` object
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
+ if not vpn_server_id:
+ raise ValueError('vpn_server_id must be provided')
+ if not id:
+ raise ValueError('id must be provided')
+ 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='publish_private_path_service_gateway',
+ operation_id='update_vpn_server_route',
)
headers.update(sdk_headers)
@@ -28424,149 +28819,153 @@ def publish_private_path_service_gateway(
'generation': self.generation,
}
+ data = json.dumps(vpn_server_route_patch)
+ headers['content-type'] = 'application/merge-patch+json'
+
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
+ headers['Accept'] = 'application/json'
- path_param_keys = ['private_path_service_gateway_id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_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 = '/private_path_service_gateways/{private_path_service_gateway_id}/publish'.format(**path_param_dict)
+ url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict)
request = self.prepare_request(
- method='POST',
+ method='PATCH',
url=url,
headers=headers,
params=params,
+ data=data,
)
response = self.send(request, **kwargs)
return response
- def revoke_account_for_private_path_service_gateway(
- self,
- private_path_service_gateway_id: str,
- account: 'AccountIdentity',
- **kwargs,
- ) -> DetailedResponse:
+
+class ListBackupPolicyJobsEnums:
+ """
+ Enums for list_backup_policy_jobs parameters.
+ """
+
+ class Status(str, Enum):
+ """
+ Filters the collection to backup policy jobs with a `status` property matching the
+ specified value.
"""
- Revoke access to a private path service gateway for an account.
- This request revokes a consumer account. This operation cannot be reversed. The
- `status` of all endpoint gateway bindings associated with the specified private
- path service gateway become `denied`. If the specified account has an existing
- access policy, that policy will be updated to `denied`. Otherwise, a new `deny`
- access policy will be created for the account.
+ FAILED = 'failed'
+ RUNNING = 'running'
+ SUCCEEDED = 'succeeded'
+ 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.
+ """
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param AccountIdentity account: The account that will be revoked access to
- the private path service gateway.
- :param dict headers: A `dict` containing the request headers
- :return: A `DetailedResponse` containing the result, headers and HTTP status code.
- :rtype: DetailedResponse
+ CREATED_AT = 'created_at'
+ NAME = 'name'
+
+
+class ListClusterNetworksEnums:
+ """
+ Enums for list_cluster_networks 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.
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
- if account is None:
- raise ValueError('account must be provided')
- account = convert_model(account)
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='revoke_account_for_private_path_service_gateway',
- )
- headers.update(sdk_headers)
+ CREATED_AT = 'created_at'
+ NAME = 'name'
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
- data = {
- 'account': account,
- }
- data = {k: v for (k, v) in data.items() if v is not None}
- data = json.dumps(data)
- headers['content-type'] = 'application/json'
+class ListClusterNetworkInterfacesEnums:
+ """
+ Enums for list_cluster_network_interfaces parameters.
+ """
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
+ 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.
+ """
- path_param_keys = ['private_path_service_gateway_id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/private_path_service_gateways/{private_path_service_gateway_id}/revoke_account'.format(**path_param_dict)
- request = self.prepare_request(
- method='POST',
- url=url,
- headers=headers,
- params=params,
- data=data,
- )
+ CREATED_AT = 'created_at'
+ NAME = 'name'
- response = self.send(request, **kwargs)
- return response
- def unpublish_private_path_service_gateway(
- self,
- private_path_service_gateway_id: str,
- **kwargs,
- ) -> DetailedResponse:
+class ListClusterNetworkSubnetsEnums:
+ """
+ Enums for list_cluster_network_subnets 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.
"""
- Unpublish a private path service gateway.
- This request unpublishes a private path service gateway. For this request to
- succeed, any existing access from other accounts must first be revoked. Once
- unpublished, access will again be restricted to the account that created this
- private path service gateway.
+ CREATED_AT = 'created_at'
+ NAME = 'name'
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
- :param dict headers: A `dict` containing the request headers
- :return: A `DetailedResponse` containing the result, headers and HTTP status code.
- :rtype: DetailedResponse
+
+class ListClusterNetworkSubnetReservedIpsEnums:
+ """
+ Enums for list_cluster_network_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.
"""
- if not private_path_service_gateway_id:
- raise ValueError('private_path_service_gateway_id must be provided')
- headers = {}
- sdk_headers = get_sdk_headers(
- service_name=self.DEFAULT_SERVICE_NAME,
- service_version='V1',
- operation_id='unpublish_private_path_service_gateway',
- )
- headers.update(sdk_headers)
+ ADDRESS = 'address'
+ CREATED_AT = 'created_at'
+ NAME = 'name'
- params = {
- 'version': self.version,
- 'generation': self.generation,
- }
- if 'headers' in kwargs:
- headers.update(kwargs.get('headers'))
- del kwargs['headers']
+class ListEndpointGatewaysEnums:
+ """
+ Enums for list_endpoint_gateways parameters.
+ """
- path_param_keys = ['private_path_service_gateway_id']
- path_param_values = self.encode_path_vars(private_path_service_gateway_id)
- path_param_dict = dict(zip(path_param_keys, path_param_values))
- url = '/private_path_service_gateways/{private_path_service_gateway_id}/unpublish'.format(**path_param_dict)
- request = self.prepare_request(
- method='POST',
- url=url,
- headers=headers,
- params=params,
- )
+ class LifecycleState(str, Enum):
+ """
+ Filters the collection to resources with a `lifecycle_state` property matching one
+ of the specified comma-separated values.
+ """
- response = self.send(request, **kwargs)
- return response
+ DELETING = 'deleting'
+ FAILED = 'failed'
+ PENDING = 'pending'
+ STABLE = 'stable'
+ SUSPENDED = 'suspended'
+ UPDATING = 'updating'
+ WAITING = 'waiting'
-class ListVpcDnsResolutionBindingsEnums:
+class ListEndpointGatewayIpsEnums:
"""
- Enums for list_vpc_dns_resolution_bindings parameters.
+ Enums for list_endpoint_gateway_ips parameters.
"""
class Sort(str, Enum):
@@ -28578,13 +28977,14 @@ class Sort(str, Enum):
ascending order.
"""
+ ADDRESS = 'address'
CREATED_AT = 'created_at'
NAME = 'name'
-class ListSubnetReservedIpsEnums:
+class ListFloatingIpsEnums:
"""
- Enums for list_subnet_reserved_ips parameters.
+ Enums for list_floating_ips parameters.
"""
class Sort(str, Enum):
@@ -28596,7 +28996,6 @@ class Sort(str, Enum):
ascending order.
"""
- ADDRESS = 'address'
CREATED_AT = 'created_at'
NAME = 'name'
@@ -28654,6 +29053,39 @@ class ReservationAffinityPolicy(str, Enum):
MANUAL = 'manual'
+class ListNetworkAclRulesEnums:
+ """
+ Enums for list_network_acl_rules parameters.
+ """
+
+ class Direction(str, Enum):
+ """
+ Filters the collection to rules with a `direction` property matching the specified
+ value.
+ """
+
+ INBOUND = 'inbound'
+ OUTBOUND = 'outbound'
+
+
+class ListPrivatePathServiceGatewayEndpointGatewayBindingsEnums:
+ """
+ Enums for list_private_path_service_gateway_endpoint_gateway_bindings parameters.
+ """
+
+ class Status(str, Enum):
+ """
+ Filters the collection to endpoint gateway bindings with a `status` property
+ matching the specified value.
+ """
+
+ ABANDONED = 'abandoned'
+ DENIED = 'denied'
+ EXPIRED = 'expired'
+ PENDING = 'pending'
+ PERMITTED = 'permitted'
+
+
class ListReservationsEnums:
"""
Enums for list_reservations parameters.
@@ -28669,28 +29101,67 @@ class AffinityPolicy(str, Enum):
RESTRICTED = 'restricted'
-class ListVolumesEnums:
+class ListShareProfilesEnums:
"""
- Enums for list_volumes parameters.
+ Enums for list_share_profiles parameters.
"""
- class AttachmentState(str, Enum):
+ class Sort(str, Enum):
"""
- Filters the collection to volumes with an `attachment_state` property matching the
- specified value.
+ 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.
"""
- ATTACHED = 'attached'
- UNATTACHED = 'unattached'
- UNUSABLE = 'unusable'
- class Encryption(str, Enum):
+ CREATED_AT = 'created_at'
+ NAME = 'name'
+
+
+class ListSharesEnums:
+ """
+ Enums for list_shares parameters.
+ """
+
+ class Sort(str, Enum):
"""
- Filters the collection to resources with an `encryption` property matching the
- specified value.
+ 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.
"""
- PROVIDER_MANAGED = 'provider_managed'
- USER_MANAGED = 'user_managed'
+ CREATED_AT = 'created_at'
+ NAME = 'name'
+ class ReplicationRole(str, Enum):
+ """
+ Filters the collection to file shares with a `replication_role` property matching
+ the specified value.
+ """
+
+ NONE = 'none'
+ REPLICA = 'replica'
+ SOURCE = 'source'
+
+
+class ListShareSnapshotsEnums:
+ """
+ Enums for list_share_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 ListSnapshotConsistencyGroupsEnums:
@@ -28729,54 +29200,9 @@ class Sort(str, Enum):
NAME = 'name'
-class ListShareProfilesEnums:
- """
- Enums for list_share_profiles 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 ListSharesEnums:
- """
- Enums for list_shares 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 ReplicationRole(str, Enum):
- """
- Filters the collection to file shares with a `replication_role` property matching
- the specified value.
- """
-
- NONE = 'none'
- REPLICA = 'replica'
- SOURCE = 'source'
-
-
-class ListShareSnapshotsEnums:
+class ListSubnetReservedIpsEnums:
"""
- Enums for list_share_snapshots parameters.
+ Enums for list_subnet_reserved_ips parameters.
"""
class Sort(str, Enum):
@@ -28788,33 +29214,7 @@ class Sort(str, Enum):
ascending order.
"""
- CREATED_AT = 'created_at'
- NAME = 'name'
-
-
-class ListBackupPolicyJobsEnums:
- """
- Enums for list_backup_policy_jobs parameters.
- """
-
- class Status(str, Enum):
- """
- Filters the collection to backup policy jobs with a `status` property matching the
- specified value.
- """
-
- FAILED = 'failed'
- RUNNING = 'running'
- SUCCEEDED = 'succeeded'
- 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'
@@ -28855,82 +29255,33 @@ class Sort(str, Enum):
NAME = 'name'
-class ListClusterNetworksEnums:
- """
- Enums for list_cluster_networks 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 ListClusterNetworkInterfacesEnums:
- """
- Enums for list_cluster_network_interfaces 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 ListClusterNetworkSubnetsEnums:
+class ListVolumesEnums:
"""
- Enums for list_cluster_network_subnets parameters.
+ Enums for list_volumes parameters.
"""
- class Sort(str, Enum):
+ class AttachmentState(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.
+ Filters the collection to volumes with an `attachment_state` property matching the
+ specified value.
"""
- CREATED_AT = 'created_at'
- NAME = 'name'
-
-
-class ListClusterNetworkSubnetReservedIpsEnums:
- """
- Enums for list_cluster_network_subnet_reserved_ips parameters.
- """
-
- class Sort(str, Enum):
+ ATTACHED = 'attached'
+ UNATTACHED = 'unattached'
+ UNUSABLE = 'unusable'
+ class Encryption(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.
+ Filters the collection to resources with an `encryption` property matching the
+ specified value.
"""
- ADDRESS = 'address'
- CREATED_AT = 'created_at'
- NAME = 'name'
+ PROVIDER_MANAGED = 'provider_managed'
+ USER_MANAGED = 'user_managed'
-class ListFloatingIpsEnums:
+class ListVpcDnsResolutionBindingsEnums:
"""
- Enums for list_floating_ips parameters.
+ Enums for list_vpc_dns_resolution_bindings parameters.
"""
class Sort(str, Enum):
@@ -28946,21 +29297,6 @@ class Sort(str, Enum):
NAME = 'name'
-class ListNetworkAclRulesEnums:
- """
- Enums for list_network_acl_rules parameters.
- """
-
- class Direction(str, Enum):
- """
- Filters the collection to rules with a `direction` property matching the specified
- value.
- """
-
- INBOUND = 'inbound'
- OUTBOUND = 'outbound'
-
-
class ListVpnGatewaysEnums:
"""
Enums for list_vpn_gateways parameters.
@@ -29054,63 +29390,6 @@ class Sort(str, Enum):
NAME = 'name'
-class ListEndpointGatewaysEnums:
- """
- Enums for list_endpoint_gateways parameters.
- """
-
- class LifecycleState(str, Enum):
- """
- Filters the collection to resources with a `lifecycle_state` property matching one
- of the specified comma-separated values.
- """
-
- DELETING = 'deleting'
- FAILED = 'failed'
- PENDING = 'pending'
- STABLE = 'stable'
- SUSPENDED = 'suspended'
- UPDATING = 'updating'
- WAITING = 'waiting'
-
-
-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 ListPrivatePathServiceGatewayEndpointGatewayBindingsEnums:
- """
- Enums for list_private_path_service_gateway_endpoint_gateway_bindings parameters.
- """
-
- class Status(str, Enum):
- """
- Filters the collection to endpoint gateway bindings with a `status` property
- matching the specified value.
- """
-
- ABANDONED = 'abandoned'
- DENIED = 'denied'
- EXPIRED = 'expired'
- PENDING = 'pending'
- PERMITTED = 'permitted'
-
-
##############################################################################
# Models
##############################################################################
@@ -32252,6 +32531,8 @@ class BareMetalServer:
the current `lifecycle_state` (if any).
:param str lifecycle_state: The lifecycle state of the bare metal server.
:param int memory: The amount of memory, truncated to whole gibibytes.
+ :param BareMetalServerMetadataService metadata_service: The metadata service
+ configuration for the bare metal server.
:param str name: The name for this bare metal server. The name is unique across
all bare metal servers in the region.
:param List[BareMetalServerNetworkAttachmentReference] network_attachments:
@@ -32322,6 +32603,7 @@ def __init__(
lifecycle_reasons: List['BareMetalServerLifecycleReason'],
lifecycle_state: str,
memory: int,
+ metadata_service: 'BareMetalServerMetadataService',
name: str,
network_interfaces: List['NetworkInterfaceBareMetalServerContextReference'],
primary_network_interface: 'NetworkInterfaceBareMetalServerContextReference',
@@ -32395,6 +32677,8 @@ def __init__(
for the current `lifecycle_state` (if any).
:param str lifecycle_state: The lifecycle state of the bare metal server.
:param int memory: The amount of memory, truncated to whole gibibytes.
+ :param BareMetalServerMetadataService metadata_service: The metadata
+ service configuration for the bare metal server.
:param str name: The name for this bare metal server. The name is unique
across all bare metal servers in the region.
:param List[NetworkInterfaceBareMetalServerContextReference]
@@ -32465,6 +32749,7 @@ def __init__(
self.lifecycle_reasons = lifecycle_reasons
self.lifecycle_state = lifecycle_state
self.memory = memory
+ self.metadata_service = metadata_service
self.name = name
self.network_attachments = network_attachments
self.network_interfaces = network_interfaces
@@ -32545,6 +32830,10 @@ def from_dict(cls, _dict: Dict) -> 'BareMetalServer':
args['memory'] = memory
else:
raise ValueError('Required property \'memory\' not present in BareMetalServer JSON')
+ if (metadata_service := _dict.get('metadata_service')) is not None:
+ args['metadata_service'] = BareMetalServerMetadataService.from_dict(metadata_service)
+ else:
+ raise ValueError('Required property \'metadata_service\' not present in BareMetalServer JSON')
if (name := _dict.get('name')) is not None:
args['name'] = name
else:
@@ -32666,6 +32955,11 @@ def to_dict(self) -> Dict:
_dict['lifecycle_state'] = self.lifecycle_state
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:
+ if isinstance(self.metadata_service, dict):
+ _dict['metadata_service'] = self.metadata_service
+ else:
+ _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_attachments') and self.network_attachments is not None:
@@ -33207,6 +33501,13 @@ class BareMetalServerDisk:
"""
BareMetalServerDisk.
+ :param BareMetalServerDiskAllowedUse allowed_use: (optional) The usage
+ constraints to be matched against the requested bare metal server
+ properties to determine compatibility.
+ Only present for disks which are referenced in a bare metal server's
+ `boot_target`
+ property. The value of this property will be inherited from the source image at
+ creation.
: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.
@@ -33232,6 +33533,8 @@ def __init__(
name: str,
resource_type: str,
size: int,
+ *,
+ allowed_use: Optional['BareMetalServerDiskAllowedUse'] = None,
) -> None:
"""
Initialize a BareMetalServerDisk object.
@@ -33250,7 +33553,15 @@ def __init__(
unique across all disks on the bare metal server.
:param str resource_type: The resource type.
:param int size: The size of the disk in GB (gigabytes).
- """
+ :param BareMetalServerDiskAllowedUse allowed_use: (optional) The usage
+ constraints to be matched against the requested bare metal server
+ properties to determine compatibility.
+ Only present for disks which are referenced in a bare metal server's
+ `boot_target`
+ property. The value of this property will be inherited from the source
+ image at creation.
+ """
+ self.allowed_use = allowed_use
self.created_at = created_at
self.href = href
self.id = id
@@ -33263,6 +33574,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'BareMetalServerDisk':
"""Initialize a BareMetalServerDisk object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = BareMetalServerDiskAllowedUse.from_dict(allowed_use)
if (created_at := _dict.get('created_at')) is not None:
args['created_at'] = string_to_datetime(created_at)
else:
@@ -33301,6 +33614,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.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, 'href') and self.href is not None:
@@ -33360,6 +33678,94 @@ class ResourceTypeEnum(str, Enum):
+class BareMetalServerDiskAllowedUse:
+ """
+ BareMetalServerDiskAllowedUse.
+
+ :param str api_version: The API version with which to evaluate the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using the image data in this disk.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ """
+
+ def __init__(
+ self,
+ api_version: str,
+ bare_metal_server: str,
+ ) -> None:
+ """
+ Initialize a BareMetalServerDiskAllowedUse object.
+
+ :param str api_version: The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC). If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using the image data in this
+ disk.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskAllowedUse':
+ """Initialize a BareMetalServerDiskAllowedUse object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ else:
+ raise ValueError('Required property \'api_version\' not present in BareMetalServerDiskAllowedUse JSON')
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ else:
+ raise ValueError('Required property \'bare_metal_server\' not present in BareMetalServerDiskAllowedUse JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a BareMetalServerDiskAllowedUse object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ 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 BareMetalServerDiskAllowedUse object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'BareMetalServerDiskAllowedUse') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'BareMetalServerDiskAllowedUse') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class BareMetalServerDiskCollection:
"""
BareMetalServerDiskCollection.
@@ -33659,6 +34065,10 @@ class BareMetalServerInitialization:
"""
BareMetalServerInitialization.
+ :param BareMetalServerInitializationDefaultTrustedProfile
+ default_trusted_profile: (optional) The default trusted profile configuration
+ specified at bare metal server
+ initialization. If absent, no default trusted profile was specified.
:param ImageReference image: The image the bare metal server was provisioned
from.
:param List[KeyReference] keys: The public SSH keys used at initialization.
@@ -33672,6 +34082,8 @@ def __init__(
image: 'ImageReference',
keys: List['KeyReference'],
user_accounts: List['BareMetalServerInitializationUserAccount'],
+ *,
+ default_trusted_profile: Optional['BareMetalServerInitializationDefaultTrustedProfile'] = None,
) -> None:
"""
Initialize a BareMetalServerInitialization object.
@@ -33682,7 +34094,12 @@ def __init__(
: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 BareMetalServerInitializationDefaultTrustedProfile
+ default_trusted_profile: (optional) The default trusted profile
+ configuration specified at bare metal server
+ initialization. If absent, no default trusted profile was specified.
"""
+ self.default_trusted_profile = default_trusted_profile
self.image = image
self.keys = keys
self.user_accounts = user_accounts
@@ -33691,6 +34108,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitialization':
"""Initialize a BareMetalServerInitialization object from a json dictionary."""
args = {}
+ if (default_trusted_profile := _dict.get('default_trusted_profile')) is not None:
+ args['default_trusted_profile'] = BareMetalServerInitializationDefaultTrustedProfile.from_dict(default_trusted_profile)
if (image := _dict.get('image')) is not None:
args['image'] = ImageReference.from_dict(image)
else:
@@ -33713,6 +34132,11 @@ def _from_dict(cls, _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:
+ if isinstance(self.default_trusted_profile, dict):
+ _dict['default_trusted_profile'] = self.default_trusted_profile
+ else:
+ _dict['default_trusted_profile'] = self.default_trusted_profile.to_dict()
if hasattr(self, 'image') and self.image is not None:
if isinstance(self.image, dict):
_dict['image'] = self.image
@@ -33755,10 +34179,175 @@ def __ne__(self, other: 'BareMetalServerInitialization') -> bool:
return not self == other
+class BareMetalServerInitializationDefaultTrustedProfile:
+ """
+ BareMetalServerInitializationDefaultTrustedProfile.
+
+ :param bool auto_link: If set to `true`, the system created a link to the
+ specified `target` trusted profile during server initialization. Regardless of
+ whether a link was created by the system or manually using the IAM Identity
+ service, the link will be automatically deleted when the server is deleted.
+ :param TrustedProfileReference target: The default IAM trusted profile to use
+ for this bare metal server.
+ """
+
+ def __init__(
+ self,
+ auto_link: bool,
+ target: 'TrustedProfileReference',
+ ) -> None:
+ """
+ Initialize a BareMetalServerInitializationDefaultTrustedProfile object.
+
+ :param bool auto_link: If set to `true`, the system created a link to the
+ specified `target` trusted profile during server initialization. Regardless
+ of whether a link was created by the system or manually using the IAM
+ Identity service, the link will be automatically deleted when the server is
+ deleted.
+ :param TrustedProfileReference target: The default IAM trusted profile to
+ use for this bare metal server.
+ """
+ self.auto_link = auto_link
+ self.target = target
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitializationDefaultTrustedProfile':
+ """Initialize a BareMetalServerInitializationDefaultTrustedProfile object from a json dictionary."""
+ args = {}
+ if (auto_link := _dict.get('auto_link')) is not None:
+ args['auto_link'] = auto_link
+ else:
+ raise ValueError('Required property \'auto_link\' not present in BareMetalServerInitializationDefaultTrustedProfile JSON')
+ if (target := _dict.get('target')) is not None:
+ args['target'] = TrustedProfileReference.from_dict(target)
+ else:
+ raise ValueError('Required property \'target\' not present in BareMetalServerInitializationDefaultTrustedProfile JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a BareMetalServerInitializationDefaultTrustedProfile object from 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 BareMetalServerInitializationDefaultTrustedProfile object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'BareMetalServerInitializationDefaultTrustedProfile') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'BareMetalServerInitializationDefaultTrustedProfile') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class BareMetalServerInitializationDefaultTrustedProfilePrototype:
+ """
+ BareMetalServerInitializationDefaultTrustedProfilePrototype.
+
+ :param bool auto_link: (optional) If set to `true`, the system will create a
+ link to the specified `target` trusted profile during server 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 server is deleted.
+ :param TrustedProfileIdentity target: The default IAM trusted profile to use for
+ this bare metal server.
+ """
+
+ def __init__(
+ self,
+ target: 'TrustedProfileIdentity',
+ *,
+ auto_link: Optional[bool] = None,
+ ) -> None:
+ """
+ Initialize a BareMetalServerInitializationDefaultTrustedProfilePrototype object.
+
+ :param TrustedProfileIdentity target: The default IAM trusted profile to
+ use for this bare metal server.
+ :param bool auto_link: (optional) If set to `true`, the system will create
+ a link to the specified `target` trusted profile during server 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 server is
+ deleted.
+ """
+ self.auto_link = auto_link
+ self.target = target
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitializationDefaultTrustedProfilePrototype':
+ """Initialize a BareMetalServerInitializationDefaultTrustedProfilePrototype object from a json dictionary."""
+ args = {}
+ if (auto_link := _dict.get('auto_link')) is not None:
+ args['auto_link'] = auto_link
+ if (target := _dict.get('target')) is not None:
+ args['target'] = target
+ else:
+ raise ValueError('Required property \'target\' not present in BareMetalServerInitializationDefaultTrustedProfilePrototype JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a BareMetalServerInitializationDefaultTrustedProfilePrototype object from 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 BareMetalServerInitializationDefaultTrustedProfilePrototype object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'BareMetalServerInitializationDefaultTrustedProfilePrototype') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'BareMetalServerInitializationDefaultTrustedProfilePrototype') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class BareMetalServerInitializationPrototype:
"""
BareMetalServerInitializationPrototype.
+ :param BareMetalServerInitializationDefaultTrustedProfilePrototype
+ default_trusted_profile: (optional) The default trusted profile to be used when
+ initializing the bare metal server.
+ If unspecified, no default trusted profile will be made available.
: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
@@ -33779,6 +34368,7 @@ def __init__(
image: 'ImageIdentity',
keys: List['KeyIdentity'],
*,
+ default_trusted_profile: Optional['BareMetalServerInitializationDefaultTrustedProfilePrototype'] = None,
user_data: Optional[str] = None,
) -> None:
"""
@@ -33795,9 +34385,14 @@ def __init__(
selected to encrypt the administrator password. Keys are optional for other
images, but if no keys are specified, the bare metal server will be
inaccessible unless the specified image provides another means of access.
+ :param BareMetalServerInitializationDefaultTrustedProfilePrototype
+ default_trusted_profile: (optional) The default trusted profile to be used
+ when initializing the bare metal server.
+ If unspecified, no default trusted profile will be made available.
:param str user_data: (optional) The user data to be made available when
initializing the bare metal server.
"""
+ self.default_trusted_profile = default_trusted_profile
self.image = image
self.keys = keys
self.user_data = user_data
@@ -33806,6 +34401,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitializationPrototype':
"""Initialize a BareMetalServerInitializationPrototype object from a json dictionary."""
args = {}
+ if (default_trusted_profile := _dict.get('default_trusted_profile')) is not None:
+ args['default_trusted_profile'] = BareMetalServerInitializationDefaultTrustedProfilePrototype.from_dict(default_trusted_profile)
if (image := _dict.get('image')) is not None:
args['image'] = image
else:
@@ -33826,6 +34423,11 @@ def _from_dict(cls, _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:
+ if isinstance(self.default_trusted_profile, dict):
+ _dict['default_trusted_profile'] = self.default_trusted_profile
+ else:
+ _dict['default_trusted_profile'] = self.default_trusted_profile.to_dict()
if hasattr(self, 'image') and self.image is not None:
if isinstance(self.image, dict):
_dict['image'] = self.image
@@ -33989,6 +34591,269 @@ class CodeEnum(str, Enum):
+class BareMetalServerMetadataService:
+ """
+ The metadata service configuration for the bare metal server.
+
+ :param bool enabled: Indicates whether the metadata service endpoint is
+ available to the bare metal server.
+ :param str protocol: The communication protocol to use for the metadata service
+ endpoint. Applies only when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+
+ def __init__(
+ self,
+ enabled: bool,
+ protocol: str,
+ ) -> None:
+ """
+ Initialize a BareMetalServerMetadataService object.
+
+ :param bool enabled: Indicates whether the metadata service endpoint is
+ available to the bare metal server.
+ :param str protocol: The communication protocol to use for the metadata
+ service endpoint. Applies only when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+ self.enabled = enabled
+ self.protocol = protocol
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'BareMetalServerMetadataService':
+ """Initialize a BareMetalServerMetadataService object from a json dictionary."""
+ args = {}
+ if (enabled := _dict.get('enabled')) is not None:
+ args['enabled'] = enabled
+ else:
+ raise ValueError('Required property \'enabled\' not present in BareMetalServerMetadataService JSON')
+ if (protocol := _dict.get('protocol')) is not None:
+ args['protocol'] = protocol
+ else:
+ raise ValueError('Required property \'protocol\' not present in BareMetalServerMetadataService JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a BareMetalServerMetadataService object from 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, 'protocol') and self.protocol is not None:
+ _dict['protocol'] = self.protocol
+ 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 BareMetalServerMetadataService object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'BareMetalServerMetadataService') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'BareMetalServerMetadataService') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+ class ProtocolEnum(str, Enum):
+ """
+ The communication protocol to use for the metadata service endpoint. Applies only
+ when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+
+ HTTP = 'http'
+ HTTPS = 'https'
+
+
+
+class BareMetalServerMetadataServicePatch:
+ """
+ The metadata service configuration for the bare metal server.
+
+ :param bool enabled: (optional) Indicates whether the metadata service endpoint
+ will be available to the bare metal server.
+ :param str protocol: (optional) The communication protocol to use for the
+ metadata service endpoint. Applies only when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+
+ def __init__(
+ self,
+ *,
+ enabled: Optional[bool] = None,
+ protocol: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a BareMetalServerMetadataServicePatch object.
+
+ :param bool enabled: (optional) Indicates whether the metadata service
+ endpoint will be available to the bare metal server.
+ :param str protocol: (optional) The communication protocol to use for the
+ metadata service endpoint. Applies only when the metadata service is
+ enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+ self.enabled = enabled
+ self.protocol = protocol
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'BareMetalServerMetadataServicePatch':
+ """Initialize a BareMetalServerMetadataServicePatch object from a json dictionary."""
+ args = {}
+ if (enabled := _dict.get('enabled')) is not None:
+ args['enabled'] = enabled
+ if (protocol := _dict.get('protocol')) is not None:
+ args['protocol'] = protocol
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a BareMetalServerMetadataServicePatch object from 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, 'protocol') and self.protocol is not None:
+ _dict['protocol'] = self.protocol
+ 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 BareMetalServerMetadataServicePatch object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'BareMetalServerMetadataServicePatch') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'BareMetalServerMetadataServicePatch') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+ class ProtocolEnum(str, Enum):
+ """
+ The communication protocol to use for the metadata service endpoint. Applies only
+ when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+
+ HTTP = 'http'
+ HTTPS = 'https'
+
+
+
+class BareMetalServerMetadataServicePrototype:
+ """
+ The metadata service configuration for the bare metal server.
+
+ :param bool enabled: (optional) Indicates whether the metadata service endpoint
+ will be available to the bare metal server.
+ :param str protocol: (optional) The communication protocol to use for the
+ metadata service endpoint. Applies only when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+
+ def __init__(
+ self,
+ *,
+ enabled: Optional[bool] = None,
+ protocol: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a BareMetalServerMetadataServicePrototype object.
+
+ :param bool enabled: (optional) Indicates whether the metadata service
+ endpoint will be available to the bare metal server.
+ :param str protocol: (optional) The communication protocol to use for the
+ metadata service endpoint. Applies only when the metadata service is
+ enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+ self.enabled = enabled
+ self.protocol = protocol
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'BareMetalServerMetadataServicePrototype':
+ """Initialize a BareMetalServerMetadataServicePrototype object from a json dictionary."""
+ args = {}
+ if (enabled := _dict.get('enabled')) is not None:
+ args['enabled'] = enabled
+ if (protocol := _dict.get('protocol')) is not None:
+ args['protocol'] = protocol
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a BareMetalServerMetadataServicePrototype object from 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, 'protocol') and self.protocol is not None:
+ _dict['protocol'] = self.protocol
+ 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 BareMetalServerMetadataServicePrototype object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'BareMetalServerMetadataServicePrototype') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'BareMetalServerMetadataServicePrototype') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+ class ProtocolEnum(str, Enum):
+ """
+ The communication protocol to use for the metadata service endpoint. Applies only
+ when the metadata service is enabled.
+ - `http`: HTTP protocol (unencrypted)
+ - `https`: HTTP Secure protocol.
+ """
+
+ HTTP = 'http'
+ HTTPS = 'https'
+
+
+
class BareMetalServerNetworkAttachment:
"""
BareMetalServerNetworkAttachment.
@@ -35512,6 +36377,8 @@ class BareMetalServerPatch:
will fail to boot.
For `enable_secure_boot` to be changed, the bare metal server `status` must be
`stopped`.
+ :param BareMetalServerMetadataServicePatch metadata_service: (optional) The
+ metadata service configuration for the bare metal server.
:param str name: (optional) The name for this bare metal server. The name must
not be used by another bare metal server in the region. Changing the name will
not affect the system hostname.
@@ -35525,6 +36392,7 @@ def __init__(
*,
bandwidth: Optional[int] = None,
enable_secure_boot: Optional[bool] = None,
+ metadata_service: Optional['BareMetalServerMetadataServicePatch'] = None,
name: Optional[str] = None,
reservation_affinity: Optional['BareMetalServerReservationAffinityPatch'] = None,
trusted_platform_module: Optional['BareMetalServerTrustedPlatformModulePatch'] = None,
@@ -35542,6 +36410,8 @@ def __init__(
For `enable_secure_boot` to be changed, the bare metal server `status` must
be
`stopped`.
+ :param BareMetalServerMetadataServicePatch metadata_service: (optional) The
+ metadata service configuration for the bare metal server.
:param str name: (optional) The name for this bare metal server. The name
must not be used by another bare metal server in the region. Changing the
name will not affect the system hostname.
@@ -35552,6 +36422,7 @@ def __init__(
"""
self.bandwidth = bandwidth
self.enable_secure_boot = enable_secure_boot
+ self.metadata_service = metadata_service
self.name = name
self.reservation_affinity = reservation_affinity
self.trusted_platform_module = trusted_platform_module
@@ -35564,6 +36435,8 @@ def from_dict(cls, _dict: Dict) -> 'BareMetalServerPatch':
args['bandwidth'] = bandwidth
if (enable_secure_boot := _dict.get('enable_secure_boot')) is not None:
args['enable_secure_boot'] = enable_secure_boot
+ if (metadata_service := _dict.get('metadata_service')) is not None:
+ args['metadata_service'] = BareMetalServerMetadataServicePatch.from_dict(metadata_service)
if (name := _dict.get('name')) is not None:
args['name'] = name
if (reservation_affinity := _dict.get('reservation_affinity')) is not None:
@@ -35584,6 +36457,11 @@ def to_dict(self) -> Dict:
_dict['bandwidth'] = self.bandwidth
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, 'metadata_service') and self.metadata_service is not None:
+ if isinstance(self.metadata_service, dict):
+ _dict['metadata_service'] = self.metadata_service
+ else:
+ _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, 'reservation_affinity') and self.reservation_affinity is not None:
@@ -37377,6 +38255,8 @@ class BareMetalServerPrototype:
enabled. If enabled, the image must support secure boot or the server will fail
to boot.
:param BareMetalServerInitializationPrototype initialization:
+ :param BareMetalServerMetadataServicePrototype metadata_service: (optional) The
+ metadata service configuration for the bare metal server.
:param str name: (optional) The name for this bare metal server. The name must
not be used by another bare metal server in the region. If unspecified, the name
will be a hyphenated list of randomly-selected words.
@@ -37408,6 +38288,7 @@ def __init__(
*,
bandwidth: Optional[int] = None,
enable_secure_boot: Optional[bool] = None,
+ metadata_service: Optional['BareMetalServerMetadataServicePrototype'] = None,
name: Optional[str] = None,
reservation_affinity: Optional['BareMetalServerReservationAffinityPrototype'] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
@@ -37430,6 +38311,8 @@ def __init__(
:param bool enable_secure_boot: (optional) Indicates whether secure boot is
enabled. If enabled, the image must support secure boot or the server will
fail to boot.
+ :param BareMetalServerMetadataServicePrototype metadata_service: (optional)
+ The metadata service configuration for the bare metal server.
:param str name: (optional) The name for this bare metal server. The name
must not be used by another bare metal server in the region. If
unspecified, the name will be a hyphenated list of randomly-selected words.
@@ -47131,8 +48014,7 @@ class EndpointGatewayTargetPrototype:
The target to use for this endpoint gateway. The target:
- Must not already be the target of another endpoint gateway in the VPC
- Must not have a service endpoint that overlaps with any `service_endpoints` of
- another
- endpoint gateway in the VPC.
+ another endpoint gateway in the VPC.
If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint
gateway with `allow_dns_resolution_binding` set to `true` in the [DNS
sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that:
@@ -50120,6 +51002,9 @@ class Image:
"""
Image.
+ :param ImageAllowedUse allowed_use: The usage constraints to match against the
+ requested instance or bare metal server
+ properties to determine compatibility.
:param ImageCatalogOffering catalog_offering:
:param datetime created_at: The date and time that the image was created.
:param str crn: The CRN for this image.
@@ -50190,6 +51075,7 @@ class Image:
def __init__(
self,
+ allowed_use: 'ImageAllowedUse',
catalog_offering: 'ImageCatalogOffering',
created_at: datetime,
crn: str,
@@ -50216,6 +51102,9 @@ def __init__(
"""
Initialize a Image object.
+ :param ImageAllowedUse allowed_use: The usage constraints to match against
+ the requested instance or bare metal server
+ properties to determine compatibility.
:param ImageCatalogOffering catalog_offering:
:param datetime created_at: The date and time that the image was created.
:param str crn: The CRN for this image.
@@ -50287,6 +51176,7 @@ def __init__(
[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
If absent, this image was not created from a volume.
"""
+ self.allowed_use = allowed_use
self.catalog_offering = catalog_offering
self.created_at = created_at
self.crn = crn
@@ -50313,6 +51203,10 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'Image':
"""Initialize a Image object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = ImageAllowedUse.from_dict(allowed_use)
+ else:
+ raise ValueError('Required property \'allowed_use\' not present in Image JSON')
if (catalog_offering := _dict.get('catalog_offering')) is not None:
args['catalog_offering'] = ImageCatalogOffering.from_dict(catalog_offering)
else:
@@ -50395,6 +51289,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'catalog_offering') and self.catalog_offering is not None:
if isinstance(self.catalog_offering, dict):
_dict['catalog_offering'] = self.catalog_offering
@@ -50559,6 +51458,471 @@ class VisibilityEnum(str, Enum):
+class ImageAllowedUse:
+ """
+ ImageAllowedUse.
+
+ :param str api_version: The API version with which to evaluate the expressions.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `BareMetalServer` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: The expression that must be satisfied by the properties of
+ a virtual server instance provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ api_version: str,
+ bare_metal_server: str,
+ instance: str,
+ ) -> None:
+ """
+ Initialize a ImageAllowedUse object.
+
+ :param str api_version: The API version with which to evaluate the
+ expressions.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `BareMetalServer`
+ properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ImageAllowedUse':
+ """Initialize a ImageAllowedUse object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ else:
+ raise ValueError('Required property \'api_version\' not present in ImageAllowedUse JSON')
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ else:
+ raise ValueError('Required property \'bare_metal_server\' not present in ImageAllowedUse JSON')
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ else:
+ raise ValueError('Required property \'instance\' not present in ImageAllowedUse JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ImageAllowedUse object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 ImageAllowedUse object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ImageAllowedUse') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ImageAllowedUse') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class ImageAllowedUsePatch:
+ """
+ ImageAllowedUsePatch.
+
+ :param str api_version: (optional) The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ :param str bare_metal_server: (optional) The expression that must be satisfied
+ by the properties of a bare metal server provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ *,
+ api_version: Optional[str] = None,
+ bare_metal_server: Optional[str] = None,
+ instance: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a ImageAllowedUsePatch object.
+
+ :param str api_version: (optional) The API version with which to evaluate
+ the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC).
+ :param str bare_metal_server: (optional) The expression that must be
+ satisfied by the properties of a bare metal server provisioned using this
+ image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by
+ the properties of a virtual server instance provisioned using this image.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ImageAllowedUsePatch':
+ """Initialize a ImageAllowedUsePatch object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ImageAllowedUsePatch object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 ImageAllowedUsePatch object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ImageAllowedUsePatch') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ImageAllowedUsePatch') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class ImageAllowedUsePrototype:
+ """
+ ImageAllowedUsePrototype.
+
+ :param str api_version: (optional) The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: (optional) The expression that must be satisfied
+ by the properties of a bare metal server provisioned using this image.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this image.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ *,
+ api_version: Optional[str] = None,
+ bare_metal_server: Optional[str] = None,
+ instance: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a ImageAllowedUsePrototype object.
+
+ :param str api_version: (optional) The API version with which to evaluate
+ the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC). If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: (optional) The expression that must be
+ satisfied by the properties of a bare metal server provisioned using this
+ image.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by
+ the properties of a virtual server instance provisioned using this image.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ImageAllowedUsePrototype':
+ """Initialize a ImageAllowedUsePrototype object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ImageAllowedUsePrototype object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 ImageAllowedUsePrototype object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ImageAllowedUsePrototype') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ImageAllowedUsePrototype') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class ImageBareMetalServerProfileCollection:
+ """
+ ImageBareMetalServerProfileCollection.
+
+ :param List[BareMetalServerProfileReference] bare_metal_server_profiles: A page
+ of bare metal server profiles compatible with the image.
+ :param PageLink 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 PageLink next: (optional) A link to the next page of resources. This
+ property is present for all pages
+ except the last page.
+ :param int total_count: The total number of resources across all pages.
+ """
+
+ def __init__(
+ self,
+ bare_metal_server_profiles: List['BareMetalServerProfileReference'],
+ first: 'PageLink',
+ limit: int,
+ total_count: int,
+ *,
+ next: Optional['PageLink'] = None,
+ ) -> None:
+ """
+ Initialize a ImageBareMetalServerProfileCollection object.
+
+ :param List[BareMetalServerProfileReference] bare_metal_server_profiles: A
+ page of bare metal server profiles compatible with the image.
+ :param PageLink 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 PageLink next: (optional) A link to the next page of resources. This
+ property is present for all pages
+ except the last page.
+ """
+ self.bare_metal_server_profiles = bare_metal_server_profiles
+ self.first = first
+ self.limit = limit
+ self.next = next
+ self.total_count = total_count
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ImageBareMetalServerProfileCollection':
+ """Initialize a ImageBareMetalServerProfileCollection object from a json dictionary."""
+ args = {}
+ if (bare_metal_server_profiles := _dict.get('bare_metal_server_profiles')) is not None:
+ args['bare_metal_server_profiles'] = [BareMetalServerProfileReference.from_dict(v) for v in bare_metal_server_profiles]
+ else:
+ raise ValueError('Required property \'bare_metal_server_profiles\' not present in ImageBareMetalServerProfileCollection JSON')
+ if (first := _dict.get('first')) is not None:
+ args['first'] = PageLink.from_dict(first)
+ else:
+ raise ValueError('Required property \'first\' not present in ImageBareMetalServerProfileCollection JSON')
+ if (limit := _dict.get('limit')) is not None:
+ args['limit'] = limit
+ else:
+ raise ValueError('Required property \'limit\' not present in ImageBareMetalServerProfileCollection JSON')
+ if (next := _dict.get('next')) is not None:
+ args['next'] = PageLink.from_dict(next)
+ if (total_count := _dict.get('total_count')) is not None:
+ args['total_count'] = total_count
+ else:
+ raise ValueError('Required property \'total_count\' not present in ImageBareMetalServerProfileCollection JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ImageBareMetalServerProfileCollection object from 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_server_profiles') and self.bare_metal_server_profiles is not None:
+ bare_metal_server_profiles_list = []
+ for v in self.bare_metal_server_profiles:
+ if isinstance(v, dict):
+ bare_metal_server_profiles_list.append(v)
+ else:
+ bare_metal_server_profiles_list.append(v.to_dict())
+ _dict['bare_metal_server_profiles'] = bare_metal_server_profiles_list
+ if hasattr(self, 'first') and self.first is not None:
+ if isinstance(self.first, dict):
+ _dict['first'] = self.first
+ else:
+ _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:
+ if isinstance(self.next, dict):
+ _dict['next'] = self.next
+ else:
+ _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 ImageBareMetalServerProfileCollection object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ImageBareMetalServerProfileCollection') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ImageBareMetalServerProfileCollection') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class ImageCatalogOffering:
"""
ImageCatalogOffering.
@@ -51516,10 +52880,131 @@ def __init__(
raise Exception(msg)
+class ImageInstanceProfileCollection:
+ """
+ ImageInstanceProfileCollection.
+
+ :param PageLink first: A link to the first page of resources.
+ :param List[InstanceProfileReference] instance_profiles: A page of instance
+ profiles compatible with the image.
+ :param int limit: The maximum number of resources that can be returned by the
+ request.
+ :param PageLink next: (optional) A link to the next page of resources. This
+ property is present for all pages
+ except the last page.
+ :param int total_count: The total number of resources across all pages.
+ """
+
+ def __init__(
+ self,
+ first: 'PageLink',
+ instance_profiles: List['InstanceProfileReference'],
+ limit: int,
+ total_count: int,
+ *,
+ next: Optional['PageLink'] = None,
+ ) -> None:
+ """
+ Initialize a ImageInstanceProfileCollection object.
+
+ :param PageLink first: A link to the first page of resources.
+ :param List[InstanceProfileReference] instance_profiles: A page of instance
+ profiles compatible with the image.
+ :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 PageLink 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.instance_profiles = instance_profiles
+ self.limit = limit
+ self.next = next
+ self.total_count = total_count
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ImageInstanceProfileCollection':
+ """Initialize a ImageInstanceProfileCollection object from a json dictionary."""
+ args = {}
+ if (first := _dict.get('first')) is not None:
+ args['first'] = PageLink.from_dict(first)
+ else:
+ raise ValueError('Required property \'first\' not present in ImageInstanceProfileCollection JSON')
+ if (instance_profiles := _dict.get('instance_profiles')) is not None:
+ args['instance_profiles'] = [InstanceProfileReference.from_dict(v) for v in instance_profiles]
+ else:
+ raise ValueError('Required property \'instance_profiles\' not present in ImageInstanceProfileCollection JSON')
+ if (limit := _dict.get('limit')) is not None:
+ args['limit'] = limit
+ else:
+ raise ValueError('Required property \'limit\' not present in ImageInstanceProfileCollection JSON')
+ if (next := _dict.get('next')) is not None:
+ args['next'] = PageLink.from_dict(next)
+ if (total_count := _dict.get('total_count')) is not None:
+ args['total_count'] = total_count
+ else:
+ raise ValueError('Required property \'total_count\' not present in ImageInstanceProfileCollection JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ImageInstanceProfileCollection object from 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:
+ if isinstance(self.first, dict):
+ _dict['first'] = self.first
+ else:
+ _dict['first'] = self.first.to_dict()
+ if hasattr(self, 'instance_profiles') and self.instance_profiles is not None:
+ instance_profiles_list = []
+ for v in self.instance_profiles:
+ if isinstance(v, dict):
+ instance_profiles_list.append(v)
+ else:
+ instance_profiles_list.append(v.to_dict())
+ _dict['instance_profiles'] = instance_profiles_list
+ if hasattr(self, 'limit') and self.limit is not None:
+ _dict['limit'] = self.limit
+ if hasattr(self, 'next') and self.next is not None:
+ if isinstance(self.next, dict):
+ _dict['next'] = self.next
+ else:
+ _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 ImageInstanceProfileCollection object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ImageInstanceProfileCollection') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ImageInstanceProfileCollection') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class ImagePatch:
"""
ImagePatch.
+ :param ImageAllowedUsePatch allowed_use: (optional) The usage constraints to be
+ matched against the requested instance or bare metal server
+ properties to determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to set
for this image.
This cannot be set if the image has a `status` of `failed` or `deleting`, or if
@@ -51556,6 +53041,7 @@ class ImagePatch:
def __init__(
self,
*,
+ allowed_use: Optional['ImageAllowedUsePatch'] = None,
deprecation_at: Optional[datetime] = None,
name: Optional[str] = None,
obsolescence_at: Optional[datetime] = None,
@@ -51563,6 +53049,9 @@ def __init__(
"""
Initialize a ImagePatch object.
+ :param ImageAllowedUsePatch allowed_use: (optional) The usage constraints
+ to be matched against the requested instance or bare metal server
+ properties to determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to
set for this image.
This cannot be set if the image has a `status` of `failed` or `deleting`,
@@ -51598,6 +53087,7 @@ def __init__(
of `pending`, the image's status will transition to `obsolete` upon its
successful creation.
"""
+ self.allowed_use = allowed_use
self.deprecation_at = deprecation_at
self.name = name
self.obsolescence_at = obsolescence_at
@@ -51606,6 +53096,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'ImagePatch':
"""Initialize a ImagePatch object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = ImageAllowedUsePatch.from_dict(allowed_use)
if (deprecation_at := _dict.get('deprecation_at')) is not None:
args['deprecation_at'] = string_to_datetime(deprecation_at)
if (name := _dict.get('name')) is not None:
@@ -51622,6 +53114,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'deprecation_at') and self.deprecation_at is not None:
_dict['deprecation_at'] = datetime_to_string(self.deprecation_at)
if hasattr(self, 'name') and self.name is not None:
@@ -51653,6 +53150,9 @@ class ImagePrototype:
"""
ImagePrototype.
+ :param ImageAllowedUsePrototype allowed_use: (optional) The usage constraints to
+ match against the requested instance or bare metal server
+ properties to determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to set
for this image.
The date and time must not be in the past, and must be earlier than
@@ -51685,6 +53185,7 @@ class ImagePrototype:
def __init__(
self,
*,
+ allowed_use: Optional['ImageAllowedUsePrototype'] = None,
deprecation_at: Optional[datetime] = None,
name: Optional[str] = None,
obsolescence_at: Optional[datetime] = None,
@@ -51693,6 +53194,9 @@ def __init__(
"""
Initialize a ImagePrototype object.
+ :param ImageAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to match against the requested instance or bare metal server
+ properties to determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to
set for this image.
The date and time must not be in the past, and must be earlier than
@@ -53094,13 +54598,15 @@ class TypeEnum(str, Enum):
class InstanceAvailabilityPolicy:
"""
- InstanceAvailabilityPolicy.
+ The availability policy for this virtual server instance.
: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
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped
+ See [handling host
+ failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies)
+ for details.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
@@ -53115,9 +54621,11 @@ def __init__(
: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
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped
+ See [handling host
+ failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies)
+ for details.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
@@ -53167,8 +54675,11 @@ def __ne__(self, other: 'InstanceAvailabilityPolicy') -> bool:
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
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped
+ See [handling host
+ failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies)
+ for details.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
@@ -53184,10 +54695,9 @@ class InstanceAvailabilityPolicyPatch:
InstanceAvailabilityPolicyPatch.
: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.
+ experiences a failure:
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped.
"""
def __init__(
@@ -53199,10 +54709,9 @@ def __init__(
Initialize a InstanceAvailabilityPolicyPatch 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.
+ host experiences a failure:
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped.
"""
self.host_failure = host_failure
@@ -53246,9 +54755,9 @@ def __ne__(self, other: 'InstanceAvailabilityPolicyPatch') -> bool:
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 action to perform if the compute host experiences a failure:
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped.
"""
RESTART = 'restart'
@@ -53258,13 +54767,15 @@ class HostFailureEnum(str, Enum):
class InstanceAvailabilityPolicyPrototype:
"""
- InstanceAvailabilityPolicyPrototype.
+ The availability policy to use for this virtual server instance.
: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.
+ experiences a failure:
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped
+ See [handling host
+ failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies)
+ for details.
"""
def __init__(
@@ -53276,10 +54787,12 @@ def __init__(
Initialize a InstanceAvailabilityPolicyPrototype 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.
+ host experiences a failure:
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped
+ See [handling host
+ failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies)
+ for details.
"""
self.host_failure = host_failure
@@ -53323,9 +54836,12 @@ def __ne__(self, other: 'InstanceAvailabilityPolicyPrototype') -> bool:
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 action to perform if the compute host experiences a failure:
+ - `restart`: Restart the virtual server instance
+ - `stop`: Leave the virtual server instance stopped
+ See [handling host
+ failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies)
+ for details.
"""
RESTART = 'restart'
@@ -59293,8 +60809,7 @@ class InstancePatch:
"""
InstancePatch.
- :param InstanceAvailabilityPolicyPatch availability_policy: (optional) The
- availability policy for this virtual server instance.
+ :param InstanceAvailabilityPolicyPatch availability_policy: (optional)
:param str confidential_compute_mode: (optional) The confidential compute mode
to use for this virtual server instance.
For this property to be changed, the virtual server instance `status` must be
@@ -59351,8 +60866,7 @@ def __init__(
"""
Initialize a InstancePatch object.
- :param InstanceAvailabilityPolicyPatch availability_policy: (optional) The
- availability policy for this virtual server instance.
+ :param InstanceAvailabilityPolicyPatch availability_policy: (optional)
:param str confidential_compute_mode: (optional) The confidential compute
mode to use for this virtual server instance.
For this property to be changed, the virtual server instance `status` must
@@ -61370,8 +62884,7 @@ class InstancePrototype:
change
in the future.
:param InstanceReservationAffinityPrototype reservation_affinity: (optional) The
- reservation affinity settings for this virtual server instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ reservation affinity settings for this virtual server instance.
: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) will be
@@ -61472,8 +62985,7 @@ def __init__(
in the future.
:param InstanceReservationAffinityPrototype reservation_affinity:
(optional) The reservation affinity settings for this virtual server
- instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ instance.
: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) will be
@@ -61843,8 +63355,7 @@ class PolicyEnum(str, Enum):
class InstanceReservationAffinityPrototype:
"""
- The reservation affinity settings for this virtual server instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ The reservation affinity settings for this virtual server instance.
:param str policy: (optional) The reservation affinity policy to use for this
virtual server instance:
@@ -62141,8 +63652,7 @@ class InstanceTemplate:
change
in the future.
:param InstanceReservationAffinityPrototype reservation_affinity: (optional) The
- reservation affinity settings for this virtual server instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ reservation affinity settings for this virtual server instance.
:param ResourceGroupReference resource_group: The resource group for this
instance template.
:param int total_volume_bandwidth: (optional) The amount of bandwidth (in
@@ -62250,8 +63760,7 @@ def __init__(
in the future.
:param InstanceReservationAffinityPrototype reservation_affinity:
(optional) The reservation affinity settings for this virtual server
- instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ instance.
: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
@@ -62535,8 +64044,7 @@ class InstanceTemplatePrototype:
change
in the future.
:param InstanceReservationAffinityPrototype reservation_affinity: (optional) The
- reservation affinity settings for this virtual server instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ reservation affinity settings for this virtual server instance.
: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) will be
@@ -62636,8 +64144,7 @@ def __init__(
in the future.
:param InstanceReservationAffinityPrototype reservation_affinity:
(optional) The reservation affinity settings for this virtual server
- instance. If specified,
- `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
+ instance.
: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) will be
@@ -69473,7 +70980,7 @@ def __init__(
"""
msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
- ", ".join(['LoadBalancerPoolMemberTargetInstanceReference', 'LoadBalancerPoolMemberTargetIP', 'LoadBalancerPoolMemberTargetLoadBalancerReference'])
+ ", ".join(['LoadBalancerPoolMemberTargetInstanceReference', 'LoadBalancerPoolMemberTargetByReservedIp', 'LoadBalancerPoolMemberTargetIPNotReservedIP', 'LoadBalancerPoolMemberTargetLoadBalancerReference'])
)
raise Exception(msg)
@@ -69496,7 +71003,7 @@ def __init__(
"""
msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
- ", ".join(['LoadBalancerPoolMemberTargetPrototypeInstanceIdentity', 'LoadBalancerPoolMemberTargetPrototypeIP', 'LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity'])
+ ", ".join(['LoadBalancerPoolMemberTargetPrototypeInstanceIdentity', 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentity', 'LoadBalancerPoolMemberTargetPrototypeIP', 'LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity'])
)
raise Exception(msg)
@@ -70343,6 +71850,7 @@ class LoadBalancerProfile:
source_ip_session_persistence_supported:
:param List[LoadBalancerProfileReference] targetable_load_balancer_profiles: The
load balancer profiles that load balancers with this profile can target.
+ :param LoadBalancerProfileTargetableResourceTypes targetable_resource_types:
:param LoadBalancerProfileUDPSupported udp_supported:
"""
@@ -70360,6 +71868,7 @@ def __init__(
security_groups_supported: 'LoadBalancerProfileSecurityGroupsSupported',
source_ip_session_persistence_supported: 'LoadBalancerProfileSourceIPSessionPersistenceSupported',
targetable_load_balancer_profiles: List['LoadBalancerProfileReference'],
+ targetable_resource_types: 'LoadBalancerProfileTargetableResourceTypes',
udp_supported: 'LoadBalancerProfileUDPSupported',
) -> None:
"""
@@ -70387,6 +71896,8 @@ def __init__(
:param List[LoadBalancerProfileReference]
targetable_load_balancer_profiles: The load balancer profiles that load
balancers with this profile can target.
+ :param LoadBalancerProfileTargetableResourceTypes
+ targetable_resource_types:
:param LoadBalancerProfileUDPSupported udp_supported:
"""
self.access_modes = access_modes
@@ -70401,6 +71912,7 @@ def __init__(
self.security_groups_supported = security_groups_supported
self.source_ip_session_persistence_supported = source_ip_session_persistence_supported
self.targetable_load_balancer_profiles = targetable_load_balancer_profiles
+ self.targetable_resource_types = targetable_resource_types
self.udp_supported = udp_supported
@classmethod
@@ -70455,6 +71967,10 @@ def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfile':
args['targetable_load_balancer_profiles'] = [LoadBalancerProfileReference.from_dict(v) for v in targetable_load_balancer_profiles]
else:
raise ValueError('Required property \'targetable_load_balancer_profiles\' not present in LoadBalancerProfile JSON')
+ if (targetable_resource_types := _dict.get('targetable_resource_types')) is not None:
+ args['targetable_resource_types'] = LoadBalancerProfileTargetableResourceTypes.from_dict(targetable_resource_types)
+ else:
+ raise ValueError('Required property \'targetable_resource_types\' not present in LoadBalancerProfile JSON')
if (udp_supported := _dict.get('udp_supported')) is not None:
args['udp_supported'] = udp_supported
else:
@@ -70523,6 +72039,11 @@ def to_dict(self) -> Dict:
else:
targetable_load_balancer_profiles_list.append(v.to_dict())
_dict['targetable_load_balancer_profiles'] = targetable_load_balancer_profiles_list
+ if hasattr(self, 'targetable_resource_types') and self.targetable_resource_types is not None:
+ if isinstance(self.targetable_resource_types, dict):
+ _dict['targetable_resource_types'] = self.targetable_resource_types
+ else:
+ _dict['targetable_resource_types'] = self.targetable_resource_types.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
@@ -71083,6 +72604,103 @@ def __init__(
raise Exception(msg)
+class LoadBalancerProfileTargetableResourceTypes:
+ """
+ LoadBalancerProfileTargetableResourceTypes.
+
+ :param str type: The type for this profile field.
+ :param List[str] values: The resource types that pool members of load balancers
+ with this profile can target.
+ """
+
+ def __init__(
+ self,
+ type: str,
+ values: List[str],
+ ) -> None:
+ """
+ Initialize a LoadBalancerProfileTargetableResourceTypes object.
+
+ :param str type: The type for this profile field.
+ :param List[str] values: The resource types that pool members of load
+ balancers with this profile can target.
+ """
+ self.type = type
+ self.values = values
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileTargetableResourceTypes':
+ """Initialize a LoadBalancerProfileTargetableResourceTypes object from a json dictionary."""
+ args = {}
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in LoadBalancerProfileTargetableResourceTypes JSON')
+ if (values := _dict.get('values')) is not None:
+ args['values'] = values
+ else:
+ raise ValueError('Required property \'values\' not present in LoadBalancerProfileTargetableResourceTypes JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a LoadBalancerProfileTargetableResourceTypes object from 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
+ 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 LoadBalancerProfileTargetableResourceTypes object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'LoadBalancerProfileTargetableResourceTypes') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'LoadBalancerProfileTargetableResourceTypes') -> 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 [resource
+ types](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vs-elb&interface=ui#lb-comparison-chart)
+ that can be targeted by the load balancer pool member:
+ - 'instance': Traffic is forwarded to the primary IP address for the instance's
+ 'primary_network_interface' or 'primary_network_attachment'.
+ - 'subnet_reserved_ip': Traffic is forwarded to the reserved IP address.
+ - `load_balancer`: Traffic is forwarded to the load balancer.
+ - `ip`: Traffic is forwarded to the IP address.
+ """
+
+ INSTANCE = 'instance'
+ IP = 'ip'
+ LOAD_BALANCER = 'load_balancer'
+ SUBNET_RESERVED_IP = 'subnet_reserved_ip'
+
+
+
class LoadBalancerProfileUDPSupported:
"""
LoadBalancerProfileUDPSupported.
@@ -83515,13 +85133,37 @@ class Share:
bindings for this file share. Each accessor binding identifies a resource
(possibly in another account) with access to this file share's data and its
snapshots.
+ :param List[str] allowed_access_protocols: The access protocols to allow for
+ this share:
+ - `nfs4`: NFSv4 is used to access this share via its associated share mount
+ target.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
:param List[str] allowed_transit_encryption_modes: The transit encryption modes
allowed for this share:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via the installed stunnel
+ client.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
+ :param str availability_mode: The data availability mode of the share:
+ - `zonal`: The share's data will be available provided the `zone` of the share
+ is
+ available. Additionally, disasters affecting the zone may lead to data
+ loss.
+ - `regional`: The share's data will be available provided at least one zone
+ in the
+ region is available. Additionally, disasters affecting the entire region
+ may lead
+ to data loss.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ :param int bandwidth: The maximum bandwidth (in megabits per second) for the
+ share.
:param datetime created_at: The date and time that the file share is created.
:param str crn: The CRN for this file share.
:param str encryption: The type of encryption used for this file share.
@@ -83533,9 +85175,9 @@ class Share:
:param ShareInitialOwner initial_owner: The owner assigned to the file share at
creation.
:param int iops: The maximum input/output operations per second (IOPS) for the
- file share. In addition, each client accessing the share will be restricted to
- 48,000 IOPS.
- The maximum IOPS for a share may increase in the future.
+ file share.
+ The maximum IOPS for a share as defined by the share's profile may increase in
+ the future.
:param ShareJob latest_job: (optional) The latest job associated with this file
share.
This property will be absent if no jobs have been created for this file share.
@@ -83601,8 +85243,17 @@ class Share:
The resources supported by this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
+ :param int storage_generation: The [storage
+ generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles):
+ - `1`: The first storage generation
+ - `2`: The second storage generation
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
:param List[str] user_tags: The tags for this resource.
- :param ZoneReference zone: The zone this file share resides in.
+ :param ZoneReference zone: (optional) The zone this file share resides in.
+ This property will be absent for shares with an `availability_mode` of
+ `regional`.
"""
def __init__(
@@ -83610,7 +85261,10 @@ def __init__(
access_control_mode: str,
accessor_binding_role: str,
accessor_bindings: List['ShareAccessorBindingReference'],
+ allowed_access_protocols: List[str],
allowed_transit_encryption_modes: List[str],
+ availability_mode: str,
+ bandwidth: int,
created_at: datetime,
crn: str,
encryption: str,
@@ -83631,8 +85285,8 @@ def __init__(
size: int,
snapshot_count: int,
snapshot_size: int,
+ storage_generation: int,
user_tags: List[str],
- zone: 'ZoneReference',
*,
encryption_key: Optional['EncryptionKeyReference'] = None,
latest_job: Optional['ShareJob'] = None,
@@ -83642,6 +85296,7 @@ def __init__(
replication_cron_spec: Optional[str] = None,
source_share: Optional['ShareReference'] = None,
source_snapshot: Optional['ShareSourceSnapshot'] = None,
+ zone: Optional['ZoneReference'] = None,
) -> None:
"""
Initialize a Share object.
@@ -83667,14 +85322,38 @@ def __init__(
bindings for this file share. Each accessor binding identifies a resource
(possibly in another account) with access to this file share's data and its
snapshots.
+ :param List[str] allowed_access_protocols: The access protocols to allow
+ for this share:
+ - `nfs4`: NFSv4 is used to access this share via its associated share mount
+ target.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
:param List[str] allowed_transit_encryption_modes: The transit encryption
modes allowed for this share:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity
- certificate.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via the installed
+ stunnel
+ client.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
+ :param str availability_mode: The data availability mode of the share:
+ - `zonal`: The share's data will be available provided the `zone` of the
+ share is
+ available. Additionally, disasters affecting the zone may lead to data
+ loss.
+ - `regional`: The share's data will be available provided at least one
+ zone in the
+ region is available. Additionally, disasters affecting the entire
+ region may lead
+ to data loss.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ :param int bandwidth: The maximum bandwidth (in megabits per second) for
+ the share.
:param datetime created_at: The date and time that the file share is
created.
:param str crn: The CRN for this file share.
@@ -83684,9 +85363,9 @@ def __init__(
:param ShareInitialOwner initial_owner: The owner assigned to the file
share at creation.
:param int iops: The maximum input/output operations per second (IOPS) for
- the file share. In addition, each client accessing the share will be
- restricted to 48,000 IOPS.
- The maximum IOPS for a share may increase in the future.
+ the file share.
+ The maximum IOPS for a share as defined by the share's profile may increase
+ in the future.
:param List[ShareLifecycleReason] lifecycle_reasons: The reasons for the
current `lifecycle_state` (if any).
:param str lifecycle_state: The lifecycle state of the file share.
@@ -83727,8 +85406,14 @@ def __init__(
:param int snapshot_count: The total number of snapshots for this share.
:param int snapshot_size: The total size (in gigabytes) of snapshots used
for this file share.
+ :param int storage_generation: The [storage
+ generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles):
+ - `1`: The first storage generation
+ - `2`: The second storage generation
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
:param List[str] user_tags: The tags for this resource.
- :param ZoneReference zone: The zone this file share resides in.
:param EncryptionKeyReference encryption_key: (optional) The key used to
encrypt this file share.
This property will be present if `encryption` is `user_managed`.
@@ -83760,11 +85445,17 @@ def __init__(
The resources supported by this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
+ :param ZoneReference zone: (optional) The zone this file share resides in.
+ This property will be absent for shares with an `availability_mode` of
+ `regional`.
"""
self.access_control_mode = access_control_mode
self.accessor_binding_role = accessor_binding_role
self.accessor_bindings = accessor_bindings
+ self.allowed_access_protocols = allowed_access_protocols
self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
+ self.availability_mode = availability_mode
+ self.bandwidth = bandwidth
self.created_at = created_at
self.crn = crn
self.encryption = encryption
@@ -83793,6 +85484,7 @@ def __init__(
self.snapshot_size = snapshot_size
self.source_share = source_share
self.source_snapshot = source_snapshot
+ self.storage_generation = storage_generation
self.user_tags = user_tags
self.zone = zone
@@ -83812,10 +85504,22 @@ def from_dict(cls, _dict: Dict) -> 'Share':
args['accessor_bindings'] = [ShareAccessorBindingReference.from_dict(v) for v in accessor_bindings]
else:
raise ValueError('Required property \'accessor_bindings\' not present in Share JSON')
+ if (allowed_access_protocols := _dict.get('allowed_access_protocols')) is not None:
+ args['allowed_access_protocols'] = allowed_access_protocols
+ else:
+ raise ValueError('Required property \'allowed_access_protocols\' not present in Share JSON')
if (allowed_transit_encryption_modes := _dict.get('allowed_transit_encryption_modes')) is not None:
args['allowed_transit_encryption_modes'] = allowed_transit_encryption_modes
else:
raise ValueError('Required property \'allowed_transit_encryption_modes\' not present in Share JSON')
+ if (availability_mode := _dict.get('availability_mode')) is not None:
+ args['availability_mode'] = availability_mode
+ else:
+ raise ValueError('Required property \'availability_mode\' not present in Share JSON')
+ if (bandwidth := _dict.get('bandwidth')) is not None:
+ args['bandwidth'] = bandwidth
+ else:
+ raise ValueError('Required property \'bandwidth\' not present in Share JSON')
if (created_at := _dict.get('created_at')) is not None:
args['created_at'] = string_to_datetime(created_at)
else:
@@ -83912,14 +85616,16 @@ def from_dict(cls, _dict: Dict) -> 'Share':
args['source_share'] = ShareReference.from_dict(source_share)
if (source_snapshot := _dict.get('source_snapshot')) is not None:
args['source_snapshot'] = source_snapshot
+ if (storage_generation := _dict.get('storage_generation')) is not None:
+ args['storage_generation'] = storage_generation
+ else:
+ raise ValueError('Required property \'storage_generation\' not present in Share JSON')
if (user_tags := _dict.get('user_tags')) is not None:
args['user_tags'] = user_tags
else:
raise ValueError('Required property \'user_tags\' not present in Share JSON')
if (zone := _dict.get('zone')) is not None:
args['zone'] = ZoneReference.from_dict(zone)
- else:
- raise ValueError('Required property \'zone\' not present in Share JSON')
return cls(**args)
@classmethod
@@ -83942,8 +85648,14 @@ def to_dict(self) -> Dict:
else:
accessor_bindings_list.append(v.to_dict())
_dict['accessor_bindings'] = accessor_bindings_list
+ if hasattr(self, 'allowed_access_protocols') and self.allowed_access_protocols is not None:
+ _dict['allowed_access_protocols'] = self.allowed_access_protocols
if hasattr(self, 'allowed_transit_encryption_modes') and self.allowed_transit_encryption_modes is not None:
_dict['allowed_transit_encryption_modes'] = self.allowed_transit_encryption_modes
+ if hasattr(self, 'availability_mode') and self.availability_mode is not None:
+ _dict['availability_mode'] = self.availability_mode
+ if hasattr(self, 'bandwidth') and self.bandwidth is not None:
+ _dict['bandwidth'] = self.bandwidth
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:
@@ -84048,6 +85760,8 @@ def to_dict(self) -> Dict:
_dict['source_snapshot'] = self.source_snapshot
else:
_dict['source_snapshot'] = self.source_snapshot.to_dict()
+ if hasattr(self, 'storage_generation') and self.storage_generation is not None:
+ _dict['storage_generation'] = self.storage_generation
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:
@@ -84107,13 +85821,42 @@ class AccessorBindingRoleEnum(str, Enum):
ORIGIN = 'origin'
+ class AllowedAccessProtocolsEnum(str, Enum):
+ """
+ allowed_access_protocols.
+ """
+
+ NFS4 = 'nfs4'
+
+
class AllowedTransitEncryptionModesEnum(str, Enum):
"""
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
+
+
+ class AvailabilityModeEnum(str, Enum):
+ """
+ The data availability mode of the share:
+ - `zonal`: The share's data will be available provided the `zone` of the share
+ is
+ available. Additionally, disasters affecting the zone may lead to data loss.
+ - `regional`: The share's data will be available provided at least one zone in
+ the
+ region is available. Additionally, disasters affecting the entire region may
+ lead
+ to data loss.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+
+ REGIONAL = 'regional'
+ ZONAL = 'zonal'
class EncryptionEnum(str, Enum):
@@ -85232,6 +86975,12 @@ class ShareMountTarget:
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
+ :param str access_protocol: The protocol used to access the share for this share
+ mount target:
+ - `nfs4`: NFSv4 will be used.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
:param datetime created_at: The date and time that the share mount target was
created.
:param str href: The URL for this share mount target.
@@ -85259,8 +87008,10 @@ class ShareMountTarget:
Absent if `access_control_mode` is `vpc`.
:param str transit_encryption: The transit encryption mode for this share mount
target:
- - `none`: Not encrypted in transit
- - `user_managed`: Encrypted in transit using an instance identity certificate
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via the installed stunnel
+ client.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
@@ -85280,6 +87031,7 @@ class ShareMountTarget:
def __init__(
self,
access_control_mode: str,
+ access_protocol: str,
created_at: datetime,
href: str,
id: str,
@@ -85306,6 +87058,12 @@ def __init__(
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
+ :param str access_protocol: The protocol used to access the share for this
+ share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
:param datetime created_at: The date and time that the share mount target
was created.
:param str href: The URL for this share mount target.
@@ -85316,9 +87074,11 @@ def __init__(
:param str resource_type: The resource type.
:param str transit_encryption: The transit encryption mode for this share
mount target:
- - `none`: Not encrypted in transit
- - `user_managed`: Encrypted in transit using an instance identity
- certificate
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via the installed
+ stunnel
+ client.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
@@ -85354,6 +87114,7 @@ def __init__(
`security_group`.
"""
self.access_control_mode = access_control_mode
+ self.access_protocol = access_protocol
self.created_at = created_at
self.href = href
self.id = id
@@ -85375,6 +87136,10 @@ def from_dict(cls, _dict: Dict) -> 'ShareMountTarget':
args['access_control_mode'] = access_control_mode
else:
raise ValueError('Required property \'access_control_mode\' not present in ShareMountTarget JSON')
+ if (access_protocol := _dict.get('access_protocol')) is not None:
+ args['access_protocol'] = access_protocol
+ else:
+ raise ValueError('Required property \'access_protocol\' not present in ShareMountTarget JSON')
if (created_at := _dict.get('created_at')) is not None:
args['created_at'] = string_to_datetime(created_at)
else:
@@ -85427,6 +87192,8 @@ def to_dict(self) -> Dict:
_dict = {}
if hasattr(self, 'access_control_mode') and self.access_control_mode is not None:
_dict['access_control_mode'] = self.access_control_mode
+ if hasattr(self, 'access_protocol') and self.access_protocol is not None:
+ _dict['access_protocol'] = self.access_protocol
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:
@@ -85500,6 +87267,18 @@ class AccessControlModeEnum(str, Enum):
VPC = 'vpc'
+ class AccessProtocolEnum(str, Enum):
+ """
+ The protocol used to access the share for this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+
+ NFS4 = 'nfs4'
+
+
class LifecycleStateEnum(str, Enum):
"""
The lifecycle state of the mount target.
@@ -85525,15 +87304,18 @@ class ResourceTypeEnum(str, Enum):
class TransitEncryptionEnum(str, Enum):
"""
The transit encryption mode for this share mount target:
- - `none`: Not encrypted in transit
- - `user_managed`: Encrypted in transit using an instance identity certificate
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via the installed stunnel
+ client.
The enumerated values for this property may
[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
future.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -85719,59 +87501,82 @@ class ShareMountTargetPrototype:
"""
ShareMountTargetPrototype.
+ :param str access_protocol: The protocol to use to access the share for this
+ share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's `allowed_access_protocols`.
:param str name: (optional) The name for this share mount target. The name must
not be used by another mount target for the file share. If unspecified, the name
will be a hyphenated list of randomly-selected words.
- :param str transit_encryption: (optional) The transit encryption mode to use for
- this share mount target:
+ :param str transit_encryption: The transit encryption mode to use for this share
+ mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
- The
- `access_control_mode` for the share must be `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
"""
def __init__(
self,
+ access_protocol: str,
+ transit_encryption: str,
*,
name: Optional[str] = None,
- transit_encryption: Optional[str] = None,
) -> None:
"""
Initialize a ShareMountTargetPrototype object.
- :param str name: (optional) The name for this share mount target. The name
- must not be used by another mount target for the file share. If
- unspecified, the name will be a hyphenated list of randomly-selected words.
- :param str transit_encryption: (optional) The transit encryption mode to
- use for this share mount target:
+ :param str access_protocol: The protocol to use to access the share for
+ this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's
+ `allowed_access_protocols`.
+ :param str transit_encryption: The transit encryption mode to use for this
+ share mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity
- certificate. The
- `access_control_mode` for the share must be
- `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
+ :param str name: (optional) The name for this share mount target. The name
+ must not be used by another mount target for the file share. 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(['ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup', 'ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC'])
)
raise Exception(msg)
+ class AccessProtocolEnum(str, Enum):
+ """
+ The protocol to use to access the share for this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's `allowed_access_protocols`.
+ """
+
+ NFS4 = 'nfs4'
+
+
class TransitEncryptionEnum(str, Enum):
"""
The transit encryption mode to use for this share mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
- The
- `access_control_mode` for the share must be `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -85922,12 +87727,23 @@ class SharePatch:
For this property to be changed, the share must have no mount targets,
`replication_role` must be `none` and `accessor_binding_role` must not be
`accessor`.
+ :param List[str] allowed_access_protocols: (optional) The access protocols to
+ allow for this share (replacing any existing access protocols).
+ If the share has existing mount targets, the set of allowed access protocols
+ must contain all `access_protocol` modes specified by existing mount targets.
+ For this property to be updated, the `accessor_binding_role` must be `none`.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share
(replacing the existing allowed transit encryption modes). The specified transit
encryption modes must contain all transit_encryption modes specified by existing
mount targets.
For this property to be updated, the `accessor_binding_role` must be `none`.
+ :param int bandwidth: (optional) The maximum bandwidth (in megabits per second)
+ for the share.
+ For this property to be changed, the share `accessor_binding_role` must not be
+ `accessor`, the share profile must not have a `bandwidth.type` of `dependent` or
+ `fixed`, and the specified value must be within the `bandwidth` range of the
+ share's profile.
:param int iops: (optional) The maximum input/output operations per second
(IOPS) for the file share.
The maximum IOPS for a share may increase in the future. For this property to be
@@ -85958,7 +87774,9 @@ def __init__(
self,
*,
access_control_mode: Optional[str] = None,
+ allowed_access_protocols: Optional[List[str]] = None,
allowed_transit_encryption_modes: Optional[List[str]] = None,
+ bandwidth: Optional[int] = None,
iops: Optional[int] = None,
name: Optional[str] = None,
profile: Optional['ShareProfileIdentity'] = None,
@@ -85979,6 +87797,13 @@ def __init__(
For this property to be changed, the share must have no mount targets,
`replication_role` must be `none` and `accessor_binding_role` must not be
`accessor`.
+ :param List[str] allowed_access_protocols: (optional) The access protocols
+ to allow for this share (replacing any existing access protocols).
+ If the share has existing mount targets, the set of allowed access
+ protocols must contain all `access_protocol` modes specified by existing
+ mount targets.
+ For this property to be updated, the `accessor_binding_role` must be
+ `none`.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share
(replacing the existing allowed transit encryption modes). The specified
@@ -85986,6 +87811,14 @@ def __init__(
specified by existing mount targets.
For this property to be updated, the `accessor_binding_role` must be
`none`.
+ :param int bandwidth: (optional) The maximum bandwidth (in megabits per
+ second) for the share.
+ For this property to be changed, the share `accessor_binding_role` must not
+ be
+ `accessor`, the share profile must not have a `bandwidth.type` of
+ `dependent` or
+ `fixed`, and the specified value must be within the `bandwidth` range of
+ the share's profile.
:param int iops: (optional) The maximum input/output operations per second
(IOPS) for the file share.
The maximum IOPS for a share may increase in the future. For this property
@@ -86015,7 +87848,9 @@ def __init__(
:param List[str] user_tags: (optional) The tags for this resource.
"""
self.access_control_mode = access_control_mode
+ self.allowed_access_protocols = allowed_access_protocols
self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
+ self.bandwidth = bandwidth
self.iops = iops
self.name = name
self.profile = profile
@@ -86029,8 +87864,12 @@ def from_dict(cls, _dict: Dict) -> 'SharePatch':
args = {}
if (access_control_mode := _dict.get('access_control_mode')) is not None:
args['access_control_mode'] = access_control_mode
+ if (allowed_access_protocols := _dict.get('allowed_access_protocols')) is not None:
+ args['allowed_access_protocols'] = allowed_access_protocols
if (allowed_transit_encryption_modes := _dict.get('allowed_transit_encryption_modes')) is not None:
args['allowed_transit_encryption_modes'] = allowed_transit_encryption_modes
+ if (bandwidth := _dict.get('bandwidth')) is not None:
+ args['bandwidth'] = bandwidth
if (iops := _dict.get('iops')) is not None:
args['iops'] = iops
if (name := _dict.get('name')) is not None:
@@ -86055,8 +87894,12 @@ def to_dict(self) -> Dict:
_dict = {}
if hasattr(self, 'access_control_mode') and self.access_control_mode is not None:
_dict['access_control_mode'] = self.access_control_mode
+ if hasattr(self, 'allowed_access_protocols') and self.allowed_access_protocols is not None:
+ _dict['allowed_access_protocols'] = self.allowed_access_protocols
if hasattr(self, 'allowed_transit_encryption_modes') and self.allowed_transit_encryption_modes is not None:
_dict['allowed_transit_encryption_modes'] = self.allowed_transit_encryption_modes
+ if hasattr(self, 'bandwidth') and self.bandwidth is not None:
+ _dict['bandwidth'] = self.bandwidth
if hasattr(self, 'iops') and self.iops is not None:
_dict['iops'] = self.iops
if hasattr(self, 'name') and self.name is not None:
@@ -86108,13 +87951,22 @@ class AccessControlModeEnum(str, Enum):
VPC = 'vpc'
+ class AllowedAccessProtocolsEnum(str, Enum):
+ """
+ allowed_access_protocols.
+ """
+
+ NFS4 = 'nfs4'
+
+
class AllowedTransitEncryptionModesEnum(str, Enum):
"""
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -86122,6 +87974,15 @@ class ShareProfile:
"""
ShareProfile.
+ :param ShareProfileAllowedAccessProtocols allowed_access_protocols: The possible
+ allowed access protocols for a share with this profile.
+ :param ShareProfileAllowedTransitEncryptionModes
+ allowed_transit_encryption_modes: The possible allowed transit encryption modes
+ for a share with this profile.
+ :param ShareProfileAvailabilityModes availability_modes: The data availability
+ mode of a share with this profile.
+ :param ShareProfileBandwidth bandwidth: The permitted bandwidth (in megabits per
+ second) for a share with this profile.
:param ShareProfileCapacity capacity: The permitted capacity range (in
gigabytes) for a share with this profile.
:param str family: The product family this share profile belongs to.
@@ -86133,20 +87994,36 @@ class ShareProfile:
profile.
:param str name: The globally unique name for this share profile.
:param str resource_type: The resource type.
+ :param ShareProfileStorageGeneration storage_generation: The storage generation
+ for a share with this profile.
"""
def __init__(
self,
+ allowed_access_protocols: 'ShareProfileAllowedAccessProtocols',
+ allowed_transit_encryption_modes: 'ShareProfileAllowedTransitEncryptionModes',
+ availability_modes: 'ShareProfileAvailabilityModes',
+ bandwidth: 'ShareProfileBandwidth',
capacity: 'ShareProfileCapacity',
family: str,
href: str,
iops: 'ShareProfileIOPS',
name: str,
resource_type: str,
+ storage_generation: 'ShareProfileStorageGeneration',
) -> None:
"""
Initialize a ShareProfile object.
+ :param ShareProfileAllowedAccessProtocols allowed_access_protocols: The
+ possible allowed access protocols for a share with this profile.
+ :param ShareProfileAllowedTransitEncryptionModes
+ allowed_transit_encryption_modes: The possible allowed transit encryption
+ modes for a share with this profile.
+ :param ShareProfileAvailabilityModes availability_modes: The data
+ availability mode of a share with this profile.
+ :param ShareProfileBandwidth bandwidth: The permitted bandwidth (in
+ megabits per second) for a share with this profile.
:param ShareProfileCapacity capacity: The permitted capacity range (in
gigabytes) for a share with this profile.
:param str family: The product family this share profile belongs to.
@@ -86158,18 +88035,41 @@ def __init__(
this profile.
:param str name: The globally unique name for this share profile.
:param str resource_type: The resource type.
+ :param ShareProfileStorageGeneration storage_generation: The storage
+ generation for a share with this profile.
"""
+ self.allowed_access_protocols = allowed_access_protocols
+ self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
+ self.availability_modes = availability_modes
+ self.bandwidth = bandwidth
self.capacity = capacity
self.family = family
self.href = href
self.iops = iops
self.name = name
self.resource_type = resource_type
+ self.storage_generation = storage_generation
@classmethod
def from_dict(cls, _dict: Dict) -> 'ShareProfile':
"""Initialize a ShareProfile object from a json dictionary."""
args = {}
+ if (allowed_access_protocols := _dict.get('allowed_access_protocols')) is not None:
+ args['allowed_access_protocols'] = allowed_access_protocols
+ else:
+ raise ValueError('Required property \'allowed_access_protocols\' not present in ShareProfile JSON')
+ if (allowed_transit_encryption_modes := _dict.get('allowed_transit_encryption_modes')) is not None:
+ args['allowed_transit_encryption_modes'] = allowed_transit_encryption_modes
+ else:
+ raise ValueError('Required property \'allowed_transit_encryption_modes\' not present in ShareProfile JSON')
+ if (availability_modes := _dict.get('availability_modes')) is not None:
+ args['availability_modes'] = availability_modes
+ else:
+ raise ValueError('Required property \'availability_modes\' not present in ShareProfile JSON')
+ if (bandwidth := _dict.get('bandwidth')) is not None:
+ args['bandwidth'] = bandwidth
+ else:
+ raise ValueError('Required property \'bandwidth\' not present in ShareProfile JSON')
if (capacity := _dict.get('capacity')) is not None:
args['capacity'] = capacity
else:
@@ -86194,6 +88094,10 @@ def from_dict(cls, _dict: Dict) -> 'ShareProfile':
args['resource_type'] = resource_type
else:
raise ValueError('Required property \'resource_type\' not present in ShareProfile JSON')
+ if (storage_generation := _dict.get('storage_generation')) is not None:
+ args['storage_generation'] = storage_generation
+ else:
+ raise ValueError('Required property \'storage_generation\' not present in ShareProfile JSON')
return cls(**args)
@classmethod
@@ -86204,6 +88108,26 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_access_protocols') and self.allowed_access_protocols is not None:
+ if isinstance(self.allowed_access_protocols, dict):
+ _dict['allowed_access_protocols'] = self.allowed_access_protocols
+ else:
+ _dict['allowed_access_protocols'] = self.allowed_access_protocols.to_dict()
+ if hasattr(self, 'allowed_transit_encryption_modes') and self.allowed_transit_encryption_modes is not None:
+ if isinstance(self.allowed_transit_encryption_modes, dict):
+ _dict['allowed_transit_encryption_modes'] = self.allowed_transit_encryption_modes
+ else:
+ _dict['allowed_transit_encryption_modes'] = self.allowed_transit_encryption_modes.to_dict()
+ if hasattr(self, 'availability_modes') and self.availability_modes is not None:
+ if isinstance(self.availability_modes, dict):
+ _dict['availability_modes'] = self.availability_modes
+ else:
+ _dict['availability_modes'] = self.availability_modes.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, 'capacity') and self.capacity is not None:
if isinstance(self.capacity, dict):
_dict['capacity'] = self.capacity
@@ -86222,6 +88146,11 @@ def to_dict(self) -> Dict:
_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, 'storage_generation') and self.storage_generation is not None:
+ if isinstance(self.storage_generation, dict):
+ _dict['storage_generation'] = self.storage_generation
+ else:
+ _dict['storage_generation'] = self.storage_generation.to_dict()
return _dict
def _to_dict(self):
@@ -86262,6 +88191,82 @@ class ResourceTypeEnum(str, Enum):
+class ShareProfileAllowedAccessProtocols:
+ """
+ ShareProfileAllowedAccessProtocols.
+
+ """
+
+ def __init__(
+ self,
+ ) -> None:
+ """
+ Initialize a ShareProfileAllowedAccessProtocols object.
+
+ """
+ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
+ ", ".join(['ShareProfileAllowedAccessProtocolsSubset'])
+ )
+ raise Exception(msg)
+
+
+class ShareProfileAllowedTransitEncryptionModes:
+ """
+ ShareProfileAllowedTransitEncryptionModes.
+
+ """
+
+ def __init__(
+ self,
+ ) -> None:
+ """
+ Initialize a ShareProfileAllowedTransitEncryptionModes object.
+
+ """
+ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
+ ", ".join(['ShareProfileAllowedTransitEncryptionModesSubset'])
+ )
+ raise Exception(msg)
+
+
+class ShareProfileAvailabilityModes:
+ """
+ ShareProfileAvailabilityModes.
+
+ """
+
+ def __init__(
+ self,
+ ) -> None:
+ """
+ Initialize a ShareProfileAvailabilityModes object.
+
+ """
+ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
+ ", ".join(['ShareProfileAvailabilityModesEnum', 'ShareProfileAvailabilityModesFixed'])
+ )
+ raise Exception(msg)
+
+
+class ShareProfileBandwidth:
+ """
+ ShareProfileBandwidth.
+
+ """
+
+ def __init__(
+ self,
+ ) -> None:
+ """
+ Initialize a ShareProfileBandwidth object.
+
+ """
+ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
+ ", ".join(['ShareProfileBandwidthRange', 'ShareProfileBandwidthDependent', 'ShareProfileBandwidthFixed', 'ShareProfileBandwidthEnum', 'ShareProfileBandwidthDependentRange'])
+ )
+ raise Exception(msg)
+
+
class ShareProfileCapacity:
"""
ShareProfileCapacity.
@@ -86522,17 +88527,36 @@ class ResourceTypeEnum(str, Enum):
+class ShareProfileStorageGeneration:
+ """
+ ShareProfileStorageGeneration.
+
+ """
+
+ def __init__(
+ self,
+ ) -> None:
+ """
+ Initialize a ShareProfileStorageGeneration object.
+
+ """
+ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
+ ", ".join(['ShareProfileStorageGenerationFixed'])
+ )
+ raise Exception(msg)
+
+
class SharePrototype:
"""
SharePrototype.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile will
+ be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be used
@@ -86543,6 +88567,9 @@ class SharePrototype:
unspecified, a replica may be subsequently added by creating a new file share
with a
`source_share` referencing this file share.
+ Replica file shares can only be created for shares with an `availability_mode`
+ of
+ `zonal`.
:param List[str] user_tags: (optional) The tags for this resource.
"""
@@ -86560,11 +88587,11 @@ def __init__(
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile
+ will be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be
@@ -86575,6 +88602,9 @@ def __init__(
unspecified, a replica may be subsequently added by creating a new file
share with a
`source_share` referencing this file share.
+ Replica file shares can only be created for shares with an
+ `availability_mode` of
+ `zonal`.
:param List[str] user_tags: (optional) The tags for this resource.
"""
msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
@@ -86587,8 +88617,9 @@ class AllowedTransitEncryptionModesEnum(str, Enum):
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -86598,14 +88629,16 @@ class SharePrototypeShareContext:
If unspecified, a replica may be subsequently added by creating a new file share with
a
`source_share` referencing this file share.
+ Replica file shares can only be created for shares with an `availability_mode` of
+ `zonal`.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile will
+ be
+ used.
:param int iops: (optional) The maximum input/output operations per second
(IOPS) for the file share.
If the share profile has an `iops.type` of `dependent` or `fixed`, this property
@@ -86620,8 +88653,9 @@ class SharePrototypeShareContext:
list of randomly-selected words.
:param ShareProfileIdentity profile: The
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use
- for this file share. The profile must support the share's specified IOPS and
- size.
+ for this file share. The profile must:
+ - support the share's specified IOPS and size, and
+ - have the same `storage_generation` as the share.
:param str replication_cron_spec: The cron specification for the file share
replication schedule.
Replication of a share can be scheduled to occur at most once every 15 minutes.
@@ -86629,8 +88663,8 @@ class SharePrototypeShareContext:
use. If unspecified, the resource group from
the source share will be used.
:param List[str] user_tags: (optional) The tags for this resource.
- :param ZoneIdentity zone: The zone this replica file share will reside in. For a
- replica share in the same
+ :param ZoneIdentity zone: (optional) The zone this replica file share will
+ reside in. For a replica share in the same
region as the source share, this must be a different zone from the source share.
"""
@@ -86638,7 +88672,6 @@ def __init__(
self,
profile: 'ShareProfileIdentity',
replication_cron_spec: str,
- zone: 'ZoneIdentity',
*,
allowed_transit_encryption_modes: Optional[List[str]] = None,
iops: Optional[int] = None,
@@ -86646,6 +88679,7 @@ def __init__(
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
user_tags: Optional[List[str]] = None,
+ zone: Optional['ZoneIdentity'] = None,
) -> None:
"""
Initialize a SharePrototypeShareContext object.
@@ -86653,23 +88687,20 @@ def __init__(
:param ShareProfileIdentity profile: The
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles)
to use
- for this file share. The profile must support the share's specified IOPS
- and size.
+ for this file share. The profile must:
+ - support the share's specified IOPS and size, and
+ - have the same `storage_generation` as the share.
:param str replication_cron_spec: The cron specification for the file share
replication schedule.
Replication of a share can be scheduled to occur at most once every 15
minutes.
- :param ZoneIdentity zone: The zone this replica file share will reside in.
- For a replica share in the same
- region as the source share, this must be a different zone from the source
- share.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile
+ will be
+ used.
:param int iops: (optional) The maximum input/output operations per second
(IOPS) for the file share.
If the share profile has an `iops.type` of `dependent` or `fixed`, this
@@ -86687,6 +88718,10 @@ def __init__(
to use. If unspecified, the resource group from
the source share will be used.
:param List[str] user_tags: (optional) The tags for this resource.
+ :param ZoneIdentity zone: (optional) The zone this replica file share will
+ reside in. For a replica share in the same
+ region as the source share, this must be a different zone from the source
+ share.
"""
self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
self.iops = iops
@@ -86724,8 +88759,6 @@ def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareContext':
args['user_tags'] = user_tags
if (zone := _dict.get('zone')) is not None:
args['zone'] = zone
- else:
- raise ValueError('Required property \'zone\' not present in SharePrototypeShareContext JSON')
return cls(**args)
@classmethod
@@ -86794,8 +88827,9 @@ class AllowedTransitEncryptionModesEnum(str, Enum):
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -87174,7 +89208,9 @@ class ShareSnapshot:
:param List[str] user_tags: The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this
share snapshot.
- :param ZoneReference zone: The zone this share snapshot resides in.
+ :param ZoneReference zone: (optional) The zone this share snapshot resides in.
+ For shares with `availability_mode` of
+ `regional`, this property will be absent.
"""
def __init__(
@@ -87193,10 +89229,10 @@ def __init__(
status: str,
status_reasons: List['ShareSnapshotStatusReason'],
user_tags: List[str],
- zone: 'ZoneReference',
*,
backup_policy_plan: Optional['BackupPolicyPlanReference'] = None,
captured_at: Optional[datetime] = None,
+ zone: Optional['ZoneReference'] = None,
) -> None:
"""
Initialize a ShareSnapshot object.
@@ -87250,12 +89286,14 @@ def __init__(
:param List[str] user_tags: The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this share snapshot.
- :param ZoneReference zone: The zone this share snapshot resides in.
:param BackupPolicyPlanReference backup_policy_plan: (optional) If present,
the backup policy plan which created this share snapshot.
:param datetime captured_at: (optional) The date and time the data capture
for this share snapshot was completed.
If absent, this snapshot's data has not yet been captured.
+ :param ZoneReference zone: (optional) The zone this share snapshot resides
+ in. For shares with `availability_mode` of
+ `regional`, this property will be absent.
"""
self.backup_policy_plan = backup_policy_plan
self.captured_at = captured_at
@@ -87341,8 +89379,6 @@ def from_dict(cls, _dict: Dict) -> 'ShareSnapshot':
raise ValueError('Required property \'user_tags\' not present in ShareSnapshot JSON')
if (zone := _dict.get('zone')) is not None:
args['zone'] = ZoneReference.from_dict(zone)
- else:
- raise ValueError('Required property \'zone\' not present in ShareSnapshot JSON')
return cls(**args)
@classmethod
@@ -87708,6 +89744,10 @@ class ShareSnapshotPatch:
"""
ShareSnapshotPatch.
+ :param str name: (optional) The name for this share snapshot. The name must be
+ unique among all snapshots for the file share. For this property to be changed,
+ the share's `replication_role` must not be
+ `replica`.
:param List[str] user_tags: (optional) The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this
share snapshot.
@@ -87716,21 +89756,29 @@ class ShareSnapshotPatch:
def __init__(
self,
*,
+ name: Optional[str] = None,
user_tags: Optional[List[str]] = None,
) -> None:
"""
Initialize a ShareSnapshotPatch object.
+ :param str name: (optional) The name for this share snapshot. The name must
+ be unique among all snapshots for the file share. For this property to be
+ changed, the share's `replication_role` must not be
+ `replica`.
:param List[str] user_tags: (optional) The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this share snapshot.
"""
+ self.name = name
self.user_tags = user_tags
@classmethod
def from_dict(cls, _dict: Dict) -> 'ShareSnapshotPatch':
"""Initialize a ShareSnapshotPatch object from a json dictionary."""
args = {}
+ if (name := _dict.get('name')) is not None:
+ args['name'] = name
if (user_tags := _dict.get('user_tags')) is not None:
args['user_tags'] = user_tags
return cls(**args)
@@ -87743,6 +89791,8 @@ def _from_dict(cls, _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, 'user_tags') and self.user_tags is not None:
_dict['user_tags'] = self.user_tags
return _dict
@@ -87914,6 +89964,15 @@ class Snapshot:
"""
Snapshot.
+ :param SnapshotAllowedUse allowed_use: (optional) The usage constraints to be
+ matched against the requested instance properties to
+ determine compatibility. While bare metal servers cannot be provisioned from
+ snapshots,
+ an image or volume created from this snapshot will inherit its `allowed_use`
+ value.
+ Only present on bootable snapshots. The value of this property will be inherited
+ from
+ the source volume or source snapshot at snapshot creation, but can be changed.
:param BackupPolicyPlanReference backup_policy_plan: (optional) If present, the
backup policy plan which created this snapshot.
:param bool bootable: Indicates if a boot volume attachment can be created with
@@ -88004,6 +90063,7 @@ def __init__(
storage_generation: int,
user_tags: List[str],
*,
+ allowed_use: Optional['SnapshotAllowedUse'] = None,
backup_policy_plan: Optional['BackupPolicyPlanReference'] = None,
captured_at: Optional[datetime] = None,
catalog_offering: Optional['SnapshotCatalogOffering'] = None,
@@ -88056,6 +90116,16 @@ def __init__(
:param List[str] user_tags: The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this snapshot.
+ :param SnapshotAllowedUse allowed_use: (optional) The usage constraints to
+ be matched against the requested instance properties to
+ determine compatibility. While bare metal servers cannot be provisioned
+ from snapshots,
+ an image or volume created from this snapshot will inherit its
+ `allowed_use` value.
+ Only present on bootable snapshots. The value of this property will be
+ inherited from
+ the source volume or source snapshot at snapshot creation, but can be
+ changed.
: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
@@ -88086,6 +90156,7 @@ def __init__(
:param SnapshotSourceSnapshot source_snapshot: (optional) If present, the
source snapshot this snapshot was created from.
"""
+ self.allowed_use = allowed_use
self.backup_policy_plan = backup_policy_plan
self.bootable = bootable
self.captured_at = captured_at
@@ -88119,6 +90190,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'Snapshot':
"""Initialize a Snapshot object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = SnapshotAllowedUse.from_dict(allowed_use)
if (backup_policy_plan := _dict.get('backup_policy_plan')) is not None:
args['backup_policy_plan'] = BackupPolicyPlanReference.from_dict(backup_policy_plan)
if (bootable := _dict.get('bootable')) is not None:
@@ -88225,6 +90298,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'backup_policy_plan') and self.backup_policy_plan is not None:
if isinstance(self.backup_policy_plan, dict):
_dict['backup_policy_plan'] = self.backup_policy_plan
@@ -88373,6 +90451,359 @@ class ResourceTypeEnum(str, Enum):
+class SnapshotAllowedUse:
+ """
+ SnapshotAllowedUse.
+
+ :param str api_version: The API version with which to evaluate the expressions.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using the image data in this
+ snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: The expression that must be satisfied by the properties of
+ a virtual server instance provisioned using this snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ api_version: str,
+ bare_metal_server: str,
+ instance: str,
+ ) -> None:
+ """
+ Initialize a SnapshotAllowedUse object.
+
+ :param str api_version: The API version with which to evaluate the
+ expressions.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using the image data in this
+ snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'SnapshotAllowedUse':
+ """Initialize a SnapshotAllowedUse object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ else:
+ raise ValueError('Required property \'api_version\' not present in SnapshotAllowedUse JSON')
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ else:
+ raise ValueError('Required property \'bare_metal_server\' not present in SnapshotAllowedUse JSON')
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ else:
+ raise ValueError('Required property \'instance\' not present in SnapshotAllowedUse JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a SnapshotAllowedUse object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 SnapshotAllowedUse object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'SnapshotAllowedUse') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'SnapshotAllowedUse') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class SnapshotAllowedUsePatch:
+ """
+ SnapshotAllowedUsePatch.
+
+ :param str api_version: (optional) The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ :param str bare_metal_server: (optional) The expression that must be satisfied
+ by the properties of a bare metal server provisioned using the image data in
+ this snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ *,
+ api_version: Optional[str] = None,
+ bare_metal_server: Optional[str] = None,
+ instance: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a SnapshotAllowedUsePatch object.
+
+ :param str api_version: (optional) The API version with which to evaluate
+ the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC).
+ :param str bare_metal_server: (optional) The expression that must be
+ satisfied by the properties of a bare metal server provisioned using the
+ image data in this snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by
+ the properties of a virtual server instance provisioned using this
+ snapshot.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'SnapshotAllowedUsePatch':
+ """Initialize a SnapshotAllowedUsePatch object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a SnapshotAllowedUsePatch object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 SnapshotAllowedUsePatch object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'SnapshotAllowedUsePatch') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'SnapshotAllowedUsePatch') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class SnapshotAllowedUsePrototype:
+ """
+ SnapshotAllowedUsePrototype.
+
+ :param str api_version: (optional) The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: (optional) The expression that must be satisfied
+ by the properties of a bare metal server provisioned using the image data in
+ this snapshot.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this snapshot.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ *,
+ api_version: Optional[str] = None,
+ bare_metal_server: Optional[str] = None,
+ instance: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a SnapshotAllowedUsePrototype object.
+
+ :param str api_version: (optional) The API version with which to evaluate
+ the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC). If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: (optional) The expression that must be
+ satisfied by the properties of a bare metal server provisioned using the
+ image data in this snapshot.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by
+ the properties of a virtual server instance provisioned using this
+ snapshot.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'SnapshotAllowedUsePrototype':
+ """Initialize a SnapshotAllowedUsePrototype object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a SnapshotAllowedUsePrototype object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 SnapshotAllowedUsePrototype object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'SnapshotAllowedUsePrototype') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'SnapshotAllowedUsePrototype') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class SnapshotCatalogOffering:
"""
SnapshotCatalogOffering.
@@ -89530,10 +91961,135 @@ def __init__(
raise Exception(msg)
+class SnapshotInstanceProfileCollection:
+ """
+ SnapshotInstanceProfileCollection.
+
+ :param PageLink first: A link to the first page of resources.
+ :param List[InstanceProfileReference] instance_profiles: A page of instance
+ profiles compatible with the snapshot.
+ :param int limit: The maximum number of resources that can be returned by the
+ request.
+ :param PageLink next: (optional) A link to the next page of resources. This
+ property is present for all pages
+ except the last page.
+ :param int total_count: The total number of resources across all pages.
+ """
+
+ def __init__(
+ self,
+ first: 'PageLink',
+ instance_profiles: List['InstanceProfileReference'],
+ limit: int,
+ total_count: int,
+ *,
+ next: Optional['PageLink'] = None,
+ ) -> None:
+ """
+ Initialize a SnapshotInstanceProfileCollection object.
+
+ :param PageLink first: A link to the first page of resources.
+ :param List[InstanceProfileReference] instance_profiles: A page of instance
+ profiles compatible with the snapshot.
+ :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 PageLink 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.instance_profiles = instance_profiles
+ self.limit = limit
+ self.next = next
+ self.total_count = total_count
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'SnapshotInstanceProfileCollection':
+ """Initialize a SnapshotInstanceProfileCollection object from a json dictionary."""
+ args = {}
+ if (first := _dict.get('first')) is not None:
+ args['first'] = PageLink.from_dict(first)
+ else:
+ raise ValueError('Required property \'first\' not present in SnapshotInstanceProfileCollection JSON')
+ if (instance_profiles := _dict.get('instance_profiles')) is not None:
+ args['instance_profiles'] = [InstanceProfileReference.from_dict(v) for v in instance_profiles]
+ else:
+ raise ValueError('Required property \'instance_profiles\' not present in SnapshotInstanceProfileCollection JSON')
+ if (limit := _dict.get('limit')) is not None:
+ args['limit'] = limit
+ else:
+ raise ValueError('Required property \'limit\' not present in SnapshotInstanceProfileCollection JSON')
+ if (next := _dict.get('next')) is not None:
+ args['next'] = PageLink.from_dict(next)
+ if (total_count := _dict.get('total_count')) is not None:
+ args['total_count'] = total_count
+ else:
+ raise ValueError('Required property \'total_count\' not present in SnapshotInstanceProfileCollection JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a SnapshotInstanceProfileCollection object from 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:
+ if isinstance(self.first, dict):
+ _dict['first'] = self.first
+ else:
+ _dict['first'] = self.first.to_dict()
+ if hasattr(self, 'instance_profiles') and self.instance_profiles is not None:
+ instance_profiles_list = []
+ for v in self.instance_profiles:
+ if isinstance(v, dict):
+ instance_profiles_list.append(v)
+ else:
+ instance_profiles_list.append(v.to_dict())
+ _dict['instance_profiles'] = instance_profiles_list
+ if hasattr(self, 'limit') and self.limit is not None:
+ _dict['limit'] = self.limit
+ if hasattr(self, 'next') and self.next is not None:
+ if isinstance(self.next, dict):
+ _dict['next'] = self.next
+ else:
+ _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 SnapshotInstanceProfileCollection object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'SnapshotInstanceProfileCollection') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'SnapshotInstanceProfileCollection') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class SnapshotPatch:
"""
SnapshotPatch.
+ :param SnapshotAllowedUsePatch allowed_use: (optional) The usage constraints to
+ be matched against the requested instance properties to
+ determine compatibility. While bare metal servers cannot be provisioned from
+ snapshots,
+ an image or volume created from this snapshot will inherit its `allowed_use`
+ value.
+ Can only be specified for bootable snapshots.
:param str name: (optional) The name for this snapshot. The name must not be
used by another snapshot in the region.
:param List[str] user_tags: (optional) The [user
@@ -89544,18 +92100,27 @@ class SnapshotPatch:
def __init__(
self,
*,
+ allowed_use: Optional['SnapshotAllowedUsePatch'] = None,
name: Optional[str] = None,
user_tags: Optional[List[str]] = None,
) -> None:
"""
Initialize a SnapshotPatch object.
+ :param SnapshotAllowedUsePatch allowed_use: (optional) The usage
+ constraints to be matched against the requested instance properties to
+ determine compatibility. While bare metal servers cannot be provisioned
+ from snapshots,
+ an image or volume created from this snapshot will inherit its
+ `allowed_use` value.
+ Can only be specified for bootable snapshots.
:param str name: (optional) The name for this snapshot. The name must not
be used by another snapshot in the region.
:param List[str] user_tags: (optional) The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this snapshot.
"""
+ self.allowed_use = allowed_use
self.name = name
self.user_tags = user_tags
@@ -89563,6 +92128,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'SnapshotPatch':
"""Initialize a SnapshotPatch object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = SnapshotAllowedUsePatch.from_dict(allowed_use)
if (name := _dict.get('name')) is not None:
args['name'] = name
if (user_tags := _dict.get('user_tags')) is not None:
@@ -89577,6 +92144,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_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:
@@ -89606,6 +92178,10 @@ class SnapshotPrototype:
"""
SnapshotPrototype.
+ :param SnapshotAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to match against the requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified for bootable snapshots.
:param List[SnapshotClonePrototype] clones: (optional) The clones to create for
this snapshot.
:param str name: (optional) The name for this snapshot. The name must not be
@@ -89623,6 +92199,7 @@ class SnapshotPrototype:
def __init__(
self,
*,
+ allowed_use: Optional['SnapshotAllowedUsePrototype'] = None,
clones: Optional[List['SnapshotClonePrototype']] = None,
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
@@ -89631,6 +92208,10 @@ def __init__(
"""
Initialize a SnapshotPrototype object.
+ :param SnapshotAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to match against the requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified for bootable snapshots.
:param List[SnapshotClonePrototype] clones: (optional) The clones to create
for this snapshot.
:param str name: (optional) The name for this snapshot. The name must not
@@ -91078,9 +93659,7 @@ class VPC:
: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.
+ to the account's Classic Infrastructure resources.
:param datetime created_at: The date and time that the VPC was created.
:param str crn: The CRN for this VPC.
:param List[VPCCSESourceIP] cse_source_ips: (optional) The CSE ([Cloud Service
@@ -91152,9 +93731,7 @@ def __init__(
: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.
+ connectivity to the account's Classic Infrastructure resources.
: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
@@ -99451,6 +102028,10 @@ class Volume:
adjustable capacity for this volume.
:param List[str] adjustable_iops_states: The attachment states that support
adjustable IOPS for this volume.
+ :param VolumeAllowedUse allowed_use: (optional) The usage constraints to be
+ matched against the requested instance or bare metal server
+ properties to determine compatibility.
+ Only present for boot volumes.
:param str attachment_state: The attachment state of the volume
- `unattached`: Not attached to any virtual server instances
- `attached`: Attached to a virtual server instance (even if the instance is
@@ -99568,6 +102149,7 @@ def __init__(
volume_attachments: List['VolumeAttachmentReferenceVolumeContext'],
zone: 'ZoneReference',
*,
+ allowed_use: Optional['VolumeAllowedUse'] = None,
catalog_offering: Optional['VolumeCatalogOffering'] = None,
encryption_key: Optional['EncryptionKeyReference'] = None,
operating_system: Optional['OperatingSystem'] = None,
@@ -99653,6 +102235,10 @@ def __init__(
:param List[VolumeAttachmentReferenceVolumeContext] volume_attachments: The
volume attachments for this volume.
:param ZoneReference zone: The zone this volume resides in.
+ :param VolumeAllowedUse allowed_use: (optional) The usage constraints to be
+ matched against the requested instance or bare metal server
+ properties to determine compatibility.
+ Only present for boot volumes.
:param VolumeCatalogOffering catalog_offering: (optional) The
[catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user)
offering this volume was created from. If a virtual server instance is
@@ -99678,6 +102264,7 @@ def __init__(
self.active = active
self.adjustable_capacity_states = adjustable_capacity_states
self.adjustable_iops_states = adjustable_iops_states
+ self.allowed_use = allowed_use
self.attachment_state = attachment_state
self.bandwidth = bandwidth
self.busy = busy
@@ -99722,6 +102309,8 @@ def from_dict(cls, _dict: Dict) -> 'Volume':
args['adjustable_iops_states'] = adjustable_iops_states
else:
raise ValueError('Required property \'adjustable_iops_states\' not present in Volume JSON')
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = VolumeAllowedUse.from_dict(allowed_use)
if (attachment_state := _dict.get('attachment_state')) is not None:
args['attachment_state'] = attachment_state
else:
@@ -99836,6 +102425,11 @@ def to_dict(self) -> Dict:
_dict['adjustable_capacity_states'] = self.adjustable_capacity_states
if hasattr(self, 'adjustable_iops_states') and self.adjustable_iops_states is not None:
_dict['adjustable_iops_states'] = self.adjustable_iops_states
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'attachment_state') and self.attachment_state is not None:
_dict['attachment_state'] = self.attachment_state
if hasattr(self, 'bandwidth') and self.bandwidth is not None:
@@ -100046,6 +102640,357 @@ class StatusEnum(str, Enum):
+class VolumeAllowedUse:
+ """
+ VolumeAllowedUse.
+
+ :param str api_version: The API version with which to evaluate the expressions.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using the image data in this
+ volume.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: The expression that must be satisfied by the properties of
+ a virtual server instance provisioned using this volume.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ api_version: str,
+ bare_metal_server: str,
+ instance: str,
+ ) -> None:
+ """
+ Initialize a VolumeAllowedUse object.
+
+ :param str api_version: The API version with which to evaluate the
+ expressions.
+ :param str bare_metal_server: The expression that must be satisfied by the
+ properties of a bare metal server provisioned using the image data in this
+ volume.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this volume.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'VolumeAllowedUse':
+ """Initialize a VolumeAllowedUse object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ else:
+ raise ValueError('Required property \'api_version\' not present in VolumeAllowedUse JSON')
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ else:
+ raise ValueError('Required property \'bare_metal_server\' not present in VolumeAllowedUse JSON')
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ else:
+ raise ValueError('Required property \'instance\' not present in VolumeAllowedUse JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a VolumeAllowedUse object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 VolumeAllowedUse object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'VolumeAllowedUse') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'VolumeAllowedUse') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class VolumeAllowedUsePatch:
+ """
+ VolumeAllowedUsePatch.
+
+ :param str api_version: (optional) The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ :param str bare_metal_server: (optional) The expression that must be satisfied
+ by the properties of a bare metal server provisioned using the image data in
+ this volume.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this volume
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ *,
+ api_version: Optional[str] = None,
+ bare_metal_server: Optional[str] = None,
+ instance: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a VolumeAllowedUsePatch object.
+
+ :param str api_version: (optional) The API version with which to evaluate
+ the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC).
+ :param str bare_metal_server: (optional) The expression that must be
+ satisfied by the properties of a bare metal server provisioned using the
+ image data in this volume.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by
+ the properties of a virtual server instance provisioned using this volume
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'VolumeAllowedUsePatch':
+ """Initialize a VolumeAllowedUsePatch object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a VolumeAllowedUsePatch object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 VolumeAllowedUsePatch object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'VolumeAllowedUsePatch') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'VolumeAllowedUsePatch') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class VolumeAllowedUsePrototype:
+ """
+ VolumeAllowedUsePrototype.
+
+ :param str api_version: (optional) The API version with which to evaluate the
+ expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in UTC).
+ If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: (optional) The expression that must be satisfied
+ by the properties of a bare metal server provisioned using the image data in
+ this volume.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variable is supported, corresponding to the `BareMetalServer` property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by the
+ properties of a virtual server instance provisioned using this volume.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), but
+ does not support built-in functions and macros. In addition, the following
+ variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+
+ def __init__(
+ self,
+ *,
+ api_version: Optional[str] = None,
+ bare_metal_server: Optional[str] = None,
+ instance: Optional[str] = None,
+ ) -> None:
+ """
+ Initialize a VolumeAllowedUsePrototype object.
+
+ :param str api_version: (optional) The API version with which to evaluate
+ the expressions.
+ If specified, the value must be between `2019-01-01` and today's date (in
+ UTC). If unspecified, the `version` query parameter value will be used.
+ :param str bare_metal_server: (optional) The expression that must be
+ satisfied by the properties of a bare metal server provisioned using the
+ image data in this volume.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variable is supported, corresponding to the `BareMetalServer`
+ property:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
+ :param str instance: (optional) The expression that must be satisfied by
+ the properties of a virtual server instance provisioned using this volume.
+ If unspecified, the expression will be set to `true`.
+ The expression follows [Common Expression
+ Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
+ but does not support built-in functions and macros. In addition, the
+ following variables are supported, corresponding to `Instance` properties:
+ - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
+ - `gpu.count` (integer): The number of GPUs
+ - `gpu.manufacturer` (string): The GPU manufacturer
+ - `gpu.memory` (integer): The overall amount of GPU memory in GiB
+ (gibibytes)
+ - `gpu.model` (string): The GPU model.
+ """
+ self.api_version = api_version
+ self.bare_metal_server = bare_metal_server
+ self.instance = instance
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'VolumeAllowedUsePrototype':
+ """Initialize a VolumeAllowedUsePrototype object from a json dictionary."""
+ args = {}
+ if (api_version := _dict.get('api_version')) is not None:
+ args['api_version'] = api_version
+ if (bare_metal_server := _dict.get('bare_metal_server')) is not None:
+ args['bare_metal_server'] = bare_metal_server
+ if (instance := _dict.get('instance')) is not None:
+ args['instance'] = instance
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a VolumeAllowedUsePrototype object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'api_version') and self.api_version is not None:
+ _dict['api_version'] = self.api_version
+ if hasattr(self, 'bare_metal_server') and self.bare_metal_server is not None:
+ _dict['bare_metal_server'] = self.bare_metal_server
+ if hasattr(self, 'instance') and self.instance is not None:
+ _dict['instance'] = self.instance
+ 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 VolumeAllowedUsePrototype object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'VolumeAllowedUsePrototype') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'VolumeAllowedUsePrototype') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class VolumeAttachment:
"""
VolumeAttachment.
@@ -101424,10 +104369,133 @@ def __init__(
raise Exception(msg)
+class VolumeInstanceProfileCollection:
+ """
+ VolumeInstanceProfileCollection.
+
+ :param PageLink first: A link to the first page of resources.
+ :param List[InstanceProfileReference] instance_profiles: A page of instance
+ profiles compatible with the volume.
+ :param int limit: The maximum number of resources that can be returned by the
+ request.
+ :param PageLink next: (optional) A link to the next page of resources. This
+ property is present for all pages
+ except the last page.
+ :param int total_count: The total number of resources across all pages.
+ """
+
+ def __init__(
+ self,
+ first: 'PageLink',
+ instance_profiles: List['InstanceProfileReference'],
+ limit: int,
+ total_count: int,
+ *,
+ next: Optional['PageLink'] = None,
+ ) -> None:
+ """
+ Initialize a VolumeInstanceProfileCollection object.
+
+ :param PageLink first: A link to the first page of resources.
+ :param List[InstanceProfileReference] instance_profiles: A page of instance
+ profiles compatible with the volume.
+ :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 PageLink 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.instance_profiles = instance_profiles
+ self.limit = limit
+ self.next = next
+ self.total_count = total_count
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'VolumeInstanceProfileCollection':
+ """Initialize a VolumeInstanceProfileCollection object from a json dictionary."""
+ args = {}
+ if (first := _dict.get('first')) is not None:
+ args['first'] = PageLink.from_dict(first)
+ else:
+ raise ValueError('Required property \'first\' not present in VolumeInstanceProfileCollection JSON')
+ if (instance_profiles := _dict.get('instance_profiles')) is not None:
+ args['instance_profiles'] = [InstanceProfileReference.from_dict(v) for v in instance_profiles]
+ else:
+ raise ValueError('Required property \'instance_profiles\' not present in VolumeInstanceProfileCollection JSON')
+ if (limit := _dict.get('limit')) is not None:
+ args['limit'] = limit
+ else:
+ raise ValueError('Required property \'limit\' not present in VolumeInstanceProfileCollection JSON')
+ if (next := _dict.get('next')) is not None:
+ args['next'] = PageLink.from_dict(next)
+ if (total_count := _dict.get('total_count')) is not None:
+ args['total_count'] = total_count
+ else:
+ raise ValueError('Required property \'total_count\' not present in VolumeInstanceProfileCollection JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a VolumeInstanceProfileCollection object from 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:
+ if isinstance(self.first, dict):
+ _dict['first'] = self.first
+ else:
+ _dict['first'] = self.first.to_dict()
+ if hasattr(self, 'instance_profiles') and self.instance_profiles is not None:
+ instance_profiles_list = []
+ for v in self.instance_profiles:
+ if isinstance(v, dict):
+ instance_profiles_list.append(v)
+ else:
+ instance_profiles_list.append(v.to_dict())
+ _dict['instance_profiles'] = instance_profiles_list
+ if hasattr(self, 'limit') and self.limit is not None:
+ _dict['limit'] = self.limit
+ if hasattr(self, 'next') and self.next is not None:
+ if isinstance(self.next, dict):
+ _dict['next'] = self.next
+ else:
+ _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 VolumeInstanceProfileCollection object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'VolumeInstanceProfileCollection') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'VolumeInstanceProfileCollection') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class VolumePatch:
"""
VolumePatch.
+ :param VolumeAllowedUsePatch allowed_use: (optional) The usage constraints to be
+ matched against the requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified for boot volumes with an `attachment_state` of
+ `unattached`.
:param int bandwidth: (optional) The maximum bandwidth (in megabits per second)
for the volume.
If specified, the volume profile must not have a `bandwidth.type` of
@@ -101470,6 +104538,7 @@ class VolumePatch:
def __init__(
self,
*,
+ allowed_use: Optional['VolumeAllowedUsePatch'] = None,
bandwidth: Optional[int] = None,
capacity: Optional[int] = None,
iops: Optional[int] = None,
@@ -101480,6 +104549,11 @@ def __init__(
"""
Initialize a VolumePatch object.
+ :param VolumeAllowedUsePatch allowed_use: (optional) The usage constraints
+ to be matched against the requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified for boot volumes with an `attachment_state` of
+ `unattached`.
:param int bandwidth: (optional) The maximum bandwidth (in megabits per
second) for the volume.
If specified, the volume profile must not have a `bandwidth.type` of
@@ -101520,6 +104594,7 @@ def __init__(
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this volume (replacing any existing tags).
"""
+ self.allowed_use = allowed_use
self.bandwidth = bandwidth
self.capacity = capacity
self.iops = iops
@@ -101531,6 +104606,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'VolumePatch':
"""Initialize a VolumePatch object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = VolumeAllowedUsePatch.from_dict(allowed_use)
if (bandwidth := _dict.get('bandwidth')) is not None:
args['bandwidth'] = bandwidth
if (capacity := _dict.get('capacity')) is not None:
@@ -101553,6 +104630,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'bandwidth') and self.bandwidth is not None:
_dict['bandwidth'] = self.bandwidth
if hasattr(self, 'capacity') and self.capacity is not None:
@@ -102411,6 +105493,12 @@ class VolumePrototypeInstanceByImageContext:
"""
VolumePrototypeInstanceByImageContext.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified, the
+ value of
+ this property will be inherited from the `source_image`.
:param int bandwidth: (optional) The maximum bandwidth (in megabits per second)
for the volume.
If the volume profile has a `bandwidth.type` of `dependent`, this property is
@@ -102451,6 +105539,7 @@ def __init__(
self,
profile: 'VolumeProfileIdentity',
*,
+ allowed_use: Optional['VolumeAllowedUsePrototype'] = None,
bandwidth: Optional[int] = None,
capacity: Optional[int] = None,
encryption_key: Optional['EncryptionKeyIdentity'] = None,
@@ -102466,6 +105555,12 @@ def __init__(
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles)
for
this volume.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified,
+ the value of
+ this property will be inherited from the `source_image`.
:param int bandwidth: (optional) The maximum bandwidth (in megabits per
second) for the volume.
If the volume profile has a `bandwidth.type` of `dependent`, this property
@@ -102500,6 +105595,7 @@ def __init__(
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this volume.
"""
+ self.allowed_use = allowed_use
self.bandwidth = bandwidth
self.capacity = capacity
self.encryption_key = encryption_key
@@ -102513,6 +105609,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'VolumePrototypeInstanceByImageContext':
"""Initialize a VolumePrototypeInstanceByImageContext object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = VolumeAllowedUsePrototype.from_dict(allowed_use)
if (bandwidth := _dict.get('bandwidth')) is not None:
args['bandwidth'] = bandwidth
if (capacity := _dict.get('capacity')) is not None:
@@ -102541,6 +105639,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'bandwidth') and self.bandwidth is not None:
_dict['bandwidth'] = self.bandwidth
if hasattr(self, 'capacity') and self.capacity is not None:
@@ -102591,6 +105694,12 @@ class VolumePrototypeInstanceBySourceSnapshotContext:
"""
VolumePrototypeInstanceBySourceSnapshotContext.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified, the
+ value of
+ this property will be inherited from the `source_snapshot`.
:param int bandwidth: (optional) The maximum bandwidth (in megabits per second)
for the volume.
If the volume profile has a `bandwidth.type` of `dependent`, this property is
@@ -102636,6 +105745,7 @@ def __init__(
profile: 'VolumeProfileIdentity',
source_snapshot: 'SnapshotIdentity',
*,
+ allowed_use: Optional['VolumeAllowedUsePrototype'] = None,
bandwidth: Optional[int] = None,
capacity: Optional[int] = None,
encryption_key: Optional['EncryptionKeyIdentity'] = None,
@@ -102657,6 +105767,12 @@ def __init__(
policies.
To create a volume from a `source_snapshot`, the volume profile and the
source snapshot must have the same `storage_generation` value.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified,
+ the value of
+ this property will be inherited from the `source_snapshot`.
:param int bandwidth: (optional) The maximum bandwidth (in megabits per
second) for the volume.
If the volume profile has a `bandwidth.type` of `dependent`, this property
@@ -102689,6 +105805,7 @@ def __init__(
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this volume.
"""
+ self.allowed_use = allowed_use
self.bandwidth = bandwidth
self.capacity = capacity
self.encryption_key = encryption_key
@@ -102703,6 +105820,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'VolumePrototypeInstanceBySourceSnapshotContext':
"""Initialize a VolumePrototypeInstanceBySourceSnapshotContext object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = VolumeAllowedUsePrototype.from_dict(allowed_use)
if (bandwidth := _dict.get('bandwidth')) is not None:
args['bandwidth'] = bandwidth
if (capacity := _dict.get('capacity')) is not None:
@@ -102735,6 +105854,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'bandwidth') and self.bandwidth is not None:
_dict['bandwidth'] = self.bandwidth
if hasattr(self, 'capacity') and self.capacity is not None:
@@ -104976,6 +108100,8 @@ class BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(Backup
:param str match_resource_type: The resource type this backup policy will apply
to. Resources that have both a matching type and a matching user tag will be
subject to the backup policy.
+ A backup policy of type `instance` will create a backup of all volumes with a
+ `storage_generation` value of `1` attached to the instance.
"""
def __init__(
@@ -104998,6 +108124,9 @@ def __init__(
:param str match_resource_type: The resource type this backup policy will
apply to. Resources that have both a matching type and a matching user tag
will be subject to the backup policy.
+ A backup policy of type `instance` will create a backup of all volumes with
+ a
+ `storage_generation` value of `1` attached to the instance.
:param str name: (optional) The name for this backup policy. The name must
not be used by another backup policy in the region. If unspecified, the
name will be a hyphenated list of randomly-selected words.
@@ -105110,6 +108239,8 @@ class MatchResourceTypeEnum(str, Enum):
"""
The resource type this backup policy will apply to. Resources that have both a
matching type and a matching user tag will be subject to the backup policy.
+ A backup policy of type `instance` will create a backup of all volumes with a
+ `storage_generation` value of `1` attached to the instance.
"""
INSTANCE = 'instance'
@@ -111866,6 +114997,7 @@ class BareMetalServerPrototypeBareMetalServerByNetworkAttachment(BareMetalServer
enabled. If enabled, the image must support secure boot or the server will fail
to boot.
:param BareMetalServerInitializationPrototype initialization:
+ :param BareMetalServerMetadataServicePrototype metadata_service: (optional)
:param str name: (optional) The name for this bare metal server. The name must
not be used by another bare metal server in the region. If unspecified, the name
will be a hyphenated list of randomly-selected words.
@@ -111900,6 +115032,7 @@ def __init__(
*,
bandwidth: Optional[int] = None,
enable_secure_boot: Optional[bool] = None,
+ metadata_service: Optional['BareMetalServerMetadataServicePrototype'] = None,
name: Optional[str] = None,
reservation_affinity: Optional['BareMetalServerReservationAffinityPrototype'] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
@@ -111926,6 +115059,7 @@ def __init__(
:param bool enable_secure_boot: (optional) Indicates whether secure boot is
enabled. If enabled, the image must support secure boot or the server will
fail to boot.
+ :param BareMetalServerMetadataServicePrototype metadata_service: (optional)
:param str name: (optional) The name for this bare metal server. The name
must not be used by another bare metal server in the region. If
unspecified, the name will be a hyphenated list of randomly-selected words.
@@ -111947,6 +115081,7 @@ def __init__(
self.bandwidth = bandwidth
self.enable_secure_boot = enable_secure_boot
self.initialization = initialization
+ self.metadata_service = metadata_service
self.name = name
self.profile = profile
self.reservation_affinity = reservation_affinity
@@ -111969,6 +115104,8 @@ def from_dict(cls, _dict: Dict) -> 'BareMetalServerPrototypeBareMetalServerByNet
args['initialization'] = BareMetalServerInitializationPrototype.from_dict(initialization)
else:
raise ValueError('Required property \'initialization\' not present in BareMetalServerPrototypeBareMetalServerByNetworkAttachment JSON')
+ if (metadata_service := _dict.get('metadata_service')) is not None:
+ args['metadata_service'] = BareMetalServerMetadataServicePrototype.from_dict(metadata_service)
if (name := _dict.get('name')) is not None:
args['name'] = name
if (profile := _dict.get('profile')) is not None:
@@ -112012,6 +115149,11 @@ def to_dict(self) -> Dict:
_dict['initialization'] = self.initialization
else:
_dict['initialization'] = self.initialization.to_dict()
+ if hasattr(self, 'metadata_service') and self.metadata_service is not None:
+ if isinstance(self.metadata_service, dict):
+ _dict['metadata_service'] = self.metadata_service
+ else:
+ _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, 'profile') and self.profile is not None:
@@ -112090,6 +115232,7 @@ class BareMetalServerPrototypeBareMetalServerByNetworkInterface(BareMetalServerP
enabled. If enabled, the image must support secure boot or the server will fail
to boot.
:param BareMetalServerInitializationPrototype initialization:
+ :param BareMetalServerMetadataServicePrototype metadata_service: (optional)
:param str name: (optional) The name for this bare metal server. The name must
not be used by another bare metal server in the region. If unspecified, the name
will be a hyphenated list of randomly-selected words.
@@ -112123,6 +115266,7 @@ def __init__(
*,
bandwidth: Optional[int] = None,
enable_secure_boot: Optional[bool] = None,
+ metadata_service: Optional['BareMetalServerMetadataServicePrototype'] = None,
name: Optional[str] = None,
reservation_affinity: Optional['BareMetalServerReservationAffinityPrototype'] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
@@ -112149,6 +115293,7 @@ def __init__(
:param bool enable_secure_boot: (optional) Indicates whether secure boot is
enabled. If enabled, the image must support secure boot or the server will
fail to boot.
+ :param BareMetalServerMetadataServicePrototype metadata_service: (optional)
:param str name: (optional) The name for this bare metal server. The name
must not be used by another bare metal server in the region. If
unspecified, the name will be a hyphenated list of randomly-selected words.
@@ -112169,6 +115314,7 @@ def __init__(
self.bandwidth = bandwidth
self.enable_secure_boot = enable_secure_boot
self.initialization = initialization
+ self.metadata_service = metadata_service
self.name = name
self.profile = profile
self.reservation_affinity = reservation_affinity
@@ -112191,6 +115337,8 @@ def from_dict(cls, _dict: Dict) -> 'BareMetalServerPrototypeBareMetalServerByNet
args['initialization'] = BareMetalServerInitializationPrototype.from_dict(initialization)
else:
raise ValueError('Required property \'initialization\' not present in BareMetalServerPrototypeBareMetalServerByNetworkInterface JSON')
+ if (metadata_service := _dict.get('metadata_service')) is not None:
+ args['metadata_service'] = BareMetalServerMetadataServicePrototype.from_dict(metadata_service)
if (name := _dict.get('name')) is not None:
args['name'] = name
if (profile := _dict.get('profile')) is not None:
@@ -112234,6 +115382,11 @@ def to_dict(self) -> Dict:
_dict['initialization'] = self.initialization
else:
_dict['initialization'] = self.initialization.to_dict()
+ if hasattr(self, 'metadata_service') and self.metadata_service is not None:
+ if isinstance(self.metadata_service, dict):
+ _dict['metadata_service'] = self.metadata_service
+ else:
+ _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, 'profile') and self.profile is not None:
@@ -117850,6 +121003,9 @@ class ImagePrototypeImageByFile(ImagePrototype):
"""
ImagePrototypeImageByFile.
+ :param ImageAllowedUsePrototype allowed_use: (optional) The usage constraints to
+ match against the requested instance or bare metal server properties to
+ determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to set
for this image.
The date and time must not be in the past, and must be earlier than
@@ -117903,6 +121059,7 @@ def __init__(
file: 'ImageFilePrototype',
operating_system: 'OperatingSystemIdentity',
*,
+ allowed_use: Optional['ImageAllowedUsePrototype'] = None,
deprecation_at: Optional[datetime] = None,
name: Optional[str] = None,
obsolescence_at: Optional[datetime] = None,
@@ -117918,6 +121075,9 @@ def __init__(
system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included
in this
image.
+ :param ImageAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to match against the requested instance or bare metal server
+ properties to determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to
set for this image.
The date and time must not be in the past, and must be earlier than
@@ -117962,6 +121122,7 @@ def __init__(
If unspecified, the imported image is treated as unencrypted.
"""
# pylint: disable=super-init-not-called
+ self.allowed_use = allowed_use
self.deprecation_at = deprecation_at
self.name = name
self.obsolescence_at = obsolescence_at
@@ -117975,6 +121136,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'ImagePrototypeImageByFile':
"""Initialize a ImagePrototypeImageByFile object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = ImageAllowedUsePrototype.from_dict(allowed_use)
if (deprecation_at := _dict.get('deprecation_at')) is not None:
args['deprecation_at'] = string_to_datetime(deprecation_at)
if (name := _dict.get('name')) is not None:
@@ -118005,6 +121168,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'deprecation_at') and self.deprecation_at is not None:
_dict['deprecation_at'] = datetime_to_string(self.deprecation_at)
if hasattr(self, 'name') and self.name is not None:
@@ -118058,6 +121226,9 @@ class ImagePrototypeImageBySourceVolume(ImagePrototype):
"""
ImagePrototypeImageBySourceVolume.
+ :param ImageAllowedUsePrototype allowed_use: (optional) The usage constraints to
+ match against the requested instance or bare metal server properties to
+ determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to set
for this image.
The date and time must not be in the past, and must be earlier than
@@ -118097,6 +121268,7 @@ def __init__(
self,
source_volume: 'VolumeIdentity',
*,
+ allowed_use: Optional['ImageAllowedUsePrototype'] = None,
deprecation_at: Optional[datetime] = None,
name: Optional[str] = None,
obsolescence_at: Optional[datetime] = None,
@@ -118112,6 +121284,9 @@ def __init__(
operating system information.
- Not be `active` or `busy`.
During image creation, the specified volume may briefly become `busy`.
+ :param ImageAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to match against the requested instance or bare metal server
+ properties to determine compatibility.
:param datetime deprecation_at: (optional) The deprecation date and time to
set for this image.
The date and time must not be in the past, and must be earlier than
@@ -118142,6 +121317,7 @@ def __init__(
If unspecified, the root key from `source_volume` will be used.
"""
# pylint: disable=super-init-not-called
+ self.allowed_use = allowed_use
self.deprecation_at = deprecation_at
self.name = name
self.obsolescence_at = obsolescence_at
@@ -118153,6 +121329,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'ImagePrototypeImageBySourceVolume':
"""Initialize a ImagePrototypeImageBySourceVolume object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = ImageAllowedUsePrototype.from_dict(allowed_use)
if (deprecation_at := _dict.get('deprecation_at')) is not None:
args['deprecation_at'] = string_to_datetime(deprecation_at)
if (name := _dict.get('name')) is not None:
@@ -118177,6 +121355,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'deprecation_at') and self.deprecation_at is not None:
_dict['deprecation_at'] = datetime_to_string(self.deprecation_at)
if hasattr(self, 'name') and self.name is not None:
@@ -124643,8 +127826,7 @@ class InstancePrototypeInstanceByCatalogOffering(InstancePrototype):
"""
Create an instance by using a catalog offering.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -124756,7 +127938,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -124850,8 +128031,7 @@ class InstancePrototypeInstanceByImage(InstancePrototype):
Create an instance by using an image.
The image's `user_data_format` must be `cloud_init`.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -124950,7 +128130,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -125043,8 +128222,7 @@ class InstancePrototypeInstanceBySourceSnapshot(InstancePrototype):
"""
Create an instance by using a snapshot.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -125142,7 +128320,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -125236,8 +128413,7 @@ class InstancePrototypeInstanceBySourceTemplate(InstancePrototype):
The `primary_network_interface` and `network_interfaces` properties may only be
specified if `primary_network_interface` is specified in the source template.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -125360,7 +128536,6 @@ def __init__(
:param InstanceTemplateIdentity source_template: The template to create
this virtual server instance from.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -125710,8 +128885,7 @@ class InstancePrototypeInstanceByVolume(InstancePrototype):
"""
Create an instance by using a boot volume.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -125808,7 +128982,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -126078,8 +129251,7 @@ class InstanceTemplatePrototypeInstanceTemplateByCatalogOffering(InstanceTemplat
"""
Create an instance template that creates instances by using a catalog offering.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -126190,7 +129362,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -126283,8 +129454,7 @@ class InstanceTemplatePrototypeInstanceTemplateByImage(InstanceTemplatePrototype
Create an instance template that creates instances by using an image.
The image's `user_data_format` must be `cloud_init`.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -126382,7 +129552,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -126474,8 +129643,7 @@ class InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(InstanceTemplate
"""
Create an instance template that creates instances by using a snapshot.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -126572,7 +129740,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -126665,8 +129832,7 @@ class InstanceTemplatePrototypeInstanceTemplateBySourceTemplate(InstanceTemplate
The `primary_network_interface` and `network_interfaces` properties may only be
specified if `primary_network_interface` is specified in the source template.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -126788,7 +129954,6 @@ def __init__(
:param InstanceTemplateIdentity source_template: The template to create
this virtual server instance from.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -127137,8 +130302,7 @@ class InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(InstanceT
"""
Create an instance by using a catalog offering.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -127267,7 +130431,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -127355,8 +130518,7 @@ class InstanceTemplateInstanceByImageInstanceTemplateContext(InstanceTemplate):
"""
Create an instance by using an image.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -127472,7 +130634,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -127560,8 +130721,7 @@ class InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(InstanceTe
"""
Create an instance by using a snapshot.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -127685,7 +130845,6 @@ def __init__(
:param ZoneIdentity zone: The zone this virtual server instance will reside
in.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -130046,6 +133205,140 @@ def __ne__(self, other: 'LoadBalancerPoolIdentityLoadBalancerPoolIdentityById')
return not self == other
+class LoadBalancerPoolMemberTargetByReservedIp(LoadBalancerPoolMemberTarget):
+ """
+ LoadBalancerPoolMemberTargetByReservedIp.
+
+ :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
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support
+ IPv6 addresses in the future.
+ :param Deleted 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 reserved IP.
+ :param str id: The unique identifier for this reserved IP.
+ :param str name: The name for this reserved IP. The name is unique across all
+ reserved IPs in a subnet.
+ :param str resource_type: The resource type.
+ """
+
+ def __init__(
+ self,
+ address: str,
+ href: str,
+ id: str,
+ name: str,
+ resource_type: str,
+ *,
+ deleted: Optional['Deleted'] = None,
+ ) -> None:
+ """
+ Initialize a LoadBalancerPoolMemberTargetByReservedIp 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
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to
+ support IPv6 addresses in the future.
+ :param str href: The URL for this reserved IP.
+ :param str id: The unique identifier for this reserved IP.
+ :param str name: The name for this reserved IP. The name is unique across
+ all reserved IPs in a subnet.
+ :param str resource_type: The resource type.
+ :param Deleted 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.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) -> 'LoadBalancerPoolMemberTargetByReservedIp':
+ """Initialize a LoadBalancerPoolMemberTargetByReservedIp object from a json dictionary."""
+ args = {}
+ if (address := _dict.get('address')) is not None:
+ args['address'] = address
+ else:
+ raise ValueError('Required property \'address\' not present in LoadBalancerPoolMemberTargetByReservedIp JSON')
+ if (deleted := _dict.get('deleted')) is not None:
+ args['deleted'] = Deleted.from_dict(deleted)
+ if (href := _dict.get('href')) is not None:
+ args['href'] = href
+ else:
+ raise ValueError('Required property \'href\' not present in LoadBalancerPoolMemberTargetByReservedIp JSON')
+ if (id := _dict.get('id')) is not None:
+ args['id'] = id
+ else:
+ raise ValueError('Required property \'id\' not present in LoadBalancerPoolMemberTargetByReservedIp JSON')
+ if (name := _dict.get('name')) is not None:
+ args['name'] = name
+ else:
+ raise ValueError('Required property \'name\' not present in LoadBalancerPoolMemberTargetByReservedIp JSON')
+ if (resource_type := _dict.get('resource_type')) is not None:
+ args['resource_type'] = resource_type
+ else:
+ raise ValueError('Required property \'resource_type\' not present in LoadBalancerPoolMemberTargetByReservedIp JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a LoadBalancerPoolMemberTargetByReservedIp object from 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:
+ if isinstance(self.deleted, dict):
+ _dict['deleted'] = self.deleted
+ else:
+ _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 LoadBalancerPoolMemberTargetByReservedIp object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'LoadBalancerPoolMemberTargetByReservedIp') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'LoadBalancerPoolMemberTargetByReservedIp') -> 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 LoadBalancerPoolMemberTargetPrototypeIP(LoadBalancerPoolMemberTargetPrototype):
"""
LoadBalancerPoolMemberTargetPrototypeIP.
@@ -130152,9 +133445,29 @@ def __init__(
raise Exception(msg)
-class LoadBalancerPoolMemberTargetIP(LoadBalancerPoolMemberTarget):
+class LoadBalancerPoolMemberTargetPrototypeReservedIPIdentity(LoadBalancerPoolMemberTargetPrototype):
+ """
+ Identifies a reserved IP by a unique property.
+
+ """
+
+ def __init__(
+ self,
+ ) -> None:
+ """
+ Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentity object.
+
+ """
+ # pylint: disable=super-init-not-called
+ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
+ ", ".join(['LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById', 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref'])
+ )
+ raise Exception(msg)
+
+
+class LoadBalancerPoolMemberTargetIPNotReservedIP(LoadBalancerPoolMemberTarget):
"""
- LoadBalancerPoolMemberTargetIP.
+ LoadBalancerPoolMemberTargetIPNotReservedIP.
:param str address: The IP address.
This property may
@@ -130167,7 +133480,7 @@ def __init__(
address: str,
) -> None:
"""
- Initialize a LoadBalancerPoolMemberTargetIP object.
+ Initialize a LoadBalancerPoolMemberTargetIPNotReservedIP object.
:param str address: The IP address.
This property may
@@ -130178,18 +133491,18 @@ def __init__(
self.address = address
@classmethod
- def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberTargetIP':
- """Initialize a LoadBalancerPoolMemberTargetIP object from a json dictionary."""
+ def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberTargetIPNotReservedIP':
+ """Initialize a LoadBalancerPoolMemberTargetIPNotReservedIP object from a json dictionary."""
args = {}
if (address := _dict.get('address')) is not None:
args['address'] = address
else:
- raise ValueError('Required property \'address\' not present in LoadBalancerPoolMemberTargetIP JSON')
+ raise ValueError('Required property \'address\' not present in LoadBalancerPoolMemberTargetIPNotReservedIP JSON')
return cls(**args)
@classmethod
def _from_dict(cls, _dict):
- """Initialize a LoadBalancerPoolMemberTargetIP object from a json dictionary."""
+ """Initialize a LoadBalancerPoolMemberTargetIPNotReservedIP object from a json dictionary."""
return cls.from_dict(_dict)
def to_dict(self) -> Dict:
@@ -130204,16 +133517,16 @@ def _to_dict(self):
return self.to_dict()
def __str__(self) -> str:
- """Return a `str` version of this LoadBalancerPoolMemberTargetIP object."""
+ """Return a `str` version of this LoadBalancerPoolMemberTargetIPNotReservedIP object."""
return json.dumps(self.to_dict(), indent=2)
- def __eq__(self, other: 'LoadBalancerPoolMemberTargetIP') -> bool:
+ def __eq__(self, other: 'LoadBalancerPoolMemberTargetIPNotReservedIP') -> bool:
"""Return `true` when self and other are equal, false otherwise."""
if not isinstance(other, self.__class__):
return False
return self.__dict__ == other.__dict__
- def __ne__(self, other: 'LoadBalancerPoolMemberTargetIP') -> bool:
+ def __ne__(self, other: 'LoadBalancerPoolMemberTargetIPNotReservedIP') -> bool:
"""Return `true` when self and other are not equal, false otherwise."""
return not self == other
@@ -140941,15 +144254,20 @@ class ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(
bound to it, and it must not be the target of a flow log collector.
Required if the share's `access_control_mode` is `security_group`.
+ :param str access_protocol: The protocol to use to access the share for this
+ share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's `allowed_access_protocols`.
:param str name: (optional) The name for this share mount target. The name must
not be used by another mount target for the file share. If unspecified, the name
will be a hyphenated list of randomly-selected words.
- :param str transit_encryption: (optional) The transit encryption mode to use for
- this share mount target:
+ :param str transit_encryption: The transit encryption mode to use for this share
+ mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
- The
- `access_control_mode` for the share must be `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
:param ShareMountTargetVirtualNetworkInterfacePrototype
@@ -140958,30 +144276,37 @@ class ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(
def __init__(
self,
+ access_protocol: str,
+ transit_encryption: str,
virtual_network_interface: 'ShareMountTargetVirtualNetworkInterfacePrototype',
*,
name: Optional[str] = None,
- transit_encryption: Optional[str] = None,
) -> None:
"""
Initialize a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup object.
+ :param str access_protocol: The protocol to use to access the share for
+ this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's
+ `allowed_access_protocols`.
+ :param str transit_encryption: The transit encryption mode to use for this
+ share mount target:
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
+ The specified value must be listed in the share's
+ `allowed_transit_encryption_modes`.
:param ShareMountTargetVirtualNetworkInterfacePrototype
virtual_network_interface:
:param str name: (optional) The name for this share mount target. The name
must not be used by another mount target for the file share. If
unspecified, the name will be a hyphenated list of randomly-selected words.
- :param str transit_encryption: (optional) The transit encryption mode to
- use for this share mount target:
- - `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity
- certificate. The
- `access_control_mode` for the share must be
- `security_group`.
- The specified value must be listed in the share's
- `allowed_transit_encryption_modes`.
"""
# pylint: disable=super-init-not-called
+ self.access_protocol = access_protocol
self.name = name
self.transit_encryption = transit_encryption
self.virtual_network_interface = virtual_network_interface
@@ -140990,10 +144315,16 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup':
"""Initialize a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup object from a json dictionary."""
args = {}
+ if (access_protocol := _dict.get('access_protocol')) is not None:
+ args['access_protocol'] = access_protocol
+ else:
+ raise ValueError('Required property \'access_protocol\' not present in ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup JSON')
if (name := _dict.get('name')) is not None:
args['name'] = name
if (transit_encryption := _dict.get('transit_encryption')) is not None:
args['transit_encryption'] = transit_encryption
+ else:
+ raise ValueError('Required property \'transit_encryption\' not present in ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup JSON')
if (virtual_network_interface := _dict.get('virtual_network_interface')) is not None:
args['virtual_network_interface'] = virtual_network_interface
else:
@@ -141008,6 +144339,8 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'access_protocol') and self.access_protocol is not None:
+ _dict['access_protocol'] = self.access_protocol
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
if hasattr(self, 'transit_encryption') and self.transit_encryption is not None:
@@ -141037,19 +144370,31 @@ def __ne__(self, other: 'ShareMountTargetPrototypeShareMountTargetByAccessContro
"""Return `true` when self and other are not equal, false otherwise."""
return not self == other
+ class AccessProtocolEnum(str, Enum):
+ """
+ The protocol to use to access the share for this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's `allowed_access_protocols`.
+ """
+
+ NFS4 = 'nfs4'
+
+
class TransitEncryptionEnum(str, Enum):
"""
The transit encryption mode to use for this share mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
- The
- `access_control_mode` for the share must be `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -141059,15 +144404,20 @@ class ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(ShareMount
must not be used by another mount target for this share.
Required if the share's `access_control_mode` is `vpc`.
+ :param str access_protocol: The protocol to use to access the share for this
+ share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's `allowed_access_protocols`.
:param str name: (optional) The name for this share mount target. The name must
not be used by another mount target for the file share. If unspecified, the name
will be a hyphenated list of randomly-selected words.
- :param str transit_encryption: (optional) The transit encryption mode to use for
- this share mount target:
+ :param str transit_encryption: The transit encryption mode to use for this share
+ mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
- The
- `access_control_mode` for the share must be `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
:param VPCIdentity vpc: Identifies a VPC by a unique property.
@@ -141075,29 +144425,36 @@ class ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(ShareMount
def __init__(
self,
+ access_protocol: str,
+ transit_encryption: str,
vpc: 'VPCIdentity',
*,
name: Optional[str] = None,
- transit_encryption: Optional[str] = None,
) -> None:
"""
Initialize a ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC object.
+ :param str access_protocol: The protocol to use to access the share for
+ this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's
+ `allowed_access_protocols`.
+ :param str transit_encryption: The transit encryption mode to use for this
+ share mount target:
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
+ The specified value must be listed in the share's
+ `allowed_transit_encryption_modes`.
:param VPCIdentity vpc: Identifies a VPC by a unique property.
:param str name: (optional) The name for this share mount target. The name
must not be used by another mount target for the file share. If
unspecified, the name will be a hyphenated list of randomly-selected words.
- :param str transit_encryption: (optional) The transit encryption mode to
- use for this share mount target:
- - `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity
- certificate. The
- `access_control_mode` for the share must be
- `security_group`.
- The specified value must be listed in the share's
- `allowed_transit_encryption_modes`.
"""
# pylint: disable=super-init-not-called
+ self.access_protocol = access_protocol
self.name = name
self.transit_encryption = transit_encryption
self.vpc = vpc
@@ -141106,10 +144463,16 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC':
"""Initialize a ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC object from a json dictionary."""
args = {}
+ if (access_protocol := _dict.get('access_protocol')) is not None:
+ args['access_protocol'] = access_protocol
+ else:
+ raise ValueError('Required property \'access_protocol\' not present in ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC JSON')
if (name := _dict.get('name')) is not None:
args['name'] = name
if (transit_encryption := _dict.get('transit_encryption')) is not None:
args['transit_encryption'] = transit_encryption
+ else:
+ raise ValueError('Required property \'transit_encryption\' not present in ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC JSON')
if (vpc := _dict.get('vpc')) is not None:
args['vpc'] = vpc
else:
@@ -141124,6 +144487,8 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'access_protocol') and self.access_protocol is not None:
+ _dict['access_protocol'] = self.access_protocol
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
if hasattr(self, 'transit_encryption') and self.transit_encryption is not None:
@@ -141153,19 +144518,31 @@ def __ne__(self, other: 'ShareMountTargetPrototypeShareMountTargetByAccessContro
"""Return `true` when self and other are not equal, false otherwise."""
return not self == other
+ class AccessProtocolEnum(str, Enum):
+ """
+ The protocol to use to access the share for this share mount target:
+ - `nfs4`: NFSv4 will be used.
+ The specified value must be listed in the share's `allowed_access_protocols`.
+ """
+
+ NFS4 = 'nfs4'
+
+
class TransitEncryptionEnum(str, Enum):
"""
The transit encryption mode to use for this share mount target:
- `none`: Not encrypted in transit.
- - `user_managed`: Encrypted in transit using an instance identity certificate.
- The
- `access_control_mode` for the share must be `security_group`.
+ - `ipsec`: Encrypted in transit using an instance identity certificate. The
+ `access_control_mode` for the share must be `security_group`.
+ - `stunnel`: Encrypted in transit using an stunnel connection. The
+ `access_control_mode` for the share must be `security_group`.
The specified value must be listed in the share's
`allowed_transit_encryption_modes`.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -141469,6 +144846,910 @@ class ProtocolStateFilteringModeEnum(str, Enum):
+class ShareProfileAllowedAccessProtocolsSubset(ShareProfileAllowedAccessProtocols):
+ """
+ ShareProfileAllowedAccessProtocolsSubset.
+
+ :param List[str] default: The default allowed access protocol modes for shares
+ with this profile.
+ :param str type: The type for this profile field.
+ :param List[str] values: The possible allowed access protocols for shares with
+ this profile:
+ - `nfs4`: NFSv4 will be used.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+
+ def __init__(
+ self,
+ default: List[str],
+ type: str,
+ values: List[str],
+ ) -> None:
+ """
+ Initialize a ShareProfileAllowedAccessProtocolsSubset object.
+
+ :param List[str] default: The default allowed access protocol modes for
+ shares with this profile.
+ :param str type: The type for this profile field.
+ :param List[str] values: The possible allowed access protocols for shares
+ with this profile:
+ - `nfs4`: NFSv4 will be used.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+ # pylint: disable=super-init-not-called
+ self.default = default
+ self.type = type
+ self.values = values
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileAllowedAccessProtocolsSubset':
+ """Initialize a ShareProfileAllowedAccessProtocolsSubset object from a json dictionary."""
+ args = {}
+ if (default := _dict.get('default')) is not None:
+ args['default'] = default
+ else:
+ raise ValueError('Required property \'default\' not present in ShareProfileAllowedAccessProtocolsSubset JSON')
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileAllowedAccessProtocolsSubset JSON')
+ if (values := _dict.get('values')) is not None:
+ args['values'] = values
+ else:
+ raise ValueError('Required property \'values\' not present in ShareProfileAllowedAccessProtocolsSubset JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileAllowedAccessProtocolsSubset object from 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
+ 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 ShareProfileAllowedAccessProtocolsSubset object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileAllowedAccessProtocolsSubset') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileAllowedAccessProtocolsSubset') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+ class DefaultEnum(str, Enum):
+ """
+ default.
+ """
+
+ NFS4 = 'nfs4'
+
+
+ class TypeEnum(str, Enum):
+ """
+ The type for this profile field.
+ """
+
+ SUBSET = 'subset'
+
+
+ class ValuesEnum(str, Enum):
+ """
+ values.
+ """
+
+ NFS4 = 'nfs4'
+
+
+
+class ShareProfileAllowedTransitEncryptionModesSubset(ShareProfileAllowedTransitEncryptionModes):
+ """
+ ShareProfileAllowedTransitEncryptionModesSubset.
+
+ :param List[str] default: The default allowed transit encryption modes for
+ shares with this profile.
+ :param str type: The type for this profile field.
+ :param List[str] values: The allowed [transit encryption
+ modes](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-vpc-about&interface=ui#fs-eit)
+ for a share with this profile:
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via an stunnel connection.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+
+ def __init__(
+ self,
+ default: List[str],
+ type: str,
+ values: List[str],
+ ) -> None:
+ """
+ Initialize a ShareProfileAllowedTransitEncryptionModesSubset object.
+
+ :param List[str] default: The default allowed transit encryption modes for
+ shares with this profile.
+ :param str type: The type for this profile field.
+ :param List[str] values: The allowed [transit encryption
+ modes](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-vpc-about&interface=ui#fs-eit)
+ for a share with this profile:
+ - `none`: Not encrypted in transit.
+ - `ipsec`: Encrypted in transit using an instance identity certificate.
+ - `stunnel`: Encrypted in transit using a connection via an stunnel
+ connection.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+ # pylint: disable=super-init-not-called
+ self.default = default
+ self.type = type
+ self.values = values
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileAllowedTransitEncryptionModesSubset':
+ """Initialize a ShareProfileAllowedTransitEncryptionModesSubset object from a json dictionary."""
+ args = {}
+ if (default := _dict.get('default')) is not None:
+ args['default'] = default
+ else:
+ raise ValueError('Required property \'default\' not present in ShareProfileAllowedTransitEncryptionModesSubset JSON')
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileAllowedTransitEncryptionModesSubset JSON')
+ if (values := _dict.get('values')) is not None:
+ args['values'] = values
+ else:
+ raise ValueError('Required property \'values\' not present in ShareProfileAllowedTransitEncryptionModesSubset JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileAllowedTransitEncryptionModesSubset object from 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
+ 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 ShareProfileAllowedTransitEncryptionModesSubset object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileAllowedTransitEncryptionModesSubset') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileAllowedTransitEncryptionModesSubset') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+ class DefaultEnum(str, Enum):
+ """
+ default.
+ """
+
+ IPSEC = 'ipsec'
+ NONE = 'none'
+ STUNNEL = 'stunnel'
+
+
+ class TypeEnum(str, Enum):
+ """
+ The type for this profile field.
+ """
+
+ SUBSET = 'subset'
+
+
+ class ValuesEnum(str, Enum):
+ """
+ values.
+ """
+
+ IPSEC = 'ipsec'
+ NONE = 'none'
+ STUNNEL = 'stunnel'
+
+
+
+class ShareProfileAvailabilityModesEnum(ShareProfileAvailabilityModes):
+ """
+ The permitted data availability modes for a share with this profile.
+
+ :param str default: The default data availability mode for this profile.
+ :param str type: The type for this profile field.
+ :param List[str] values: The data availability mode of the share:
+ - `zonal`: The data availability of this share is limited only to a single zone
+ of a
+ given region as provided by the `zone` of the share.
+ - `regional`: The data availability of this share covers all zones in the region
+ where
+ the share is created.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+
+ def __init__(
+ self,
+ default: str,
+ type: str,
+ values: List[str],
+ ) -> None:
+ """
+ Initialize a ShareProfileAvailabilityModesEnum object.
+
+ :param str default: The default data availability mode for this profile.
+ :param str type: The type for this profile field.
+ :param List[str] values: The data availability mode of the share:
+ - `zonal`: The data availability of this share is limited only to a single
+ zone of a
+ given region as provided by the `zone` of the share.
+ - `regional`: The data availability of this share covers all zones in the
+ region where
+ the share is created.
+ The enumerated values for this property may
+ [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
+ future.
+ """
+ # pylint: disable=super-init-not-called
+ self.default = default
+ self.type = type
+ self.values = values
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileAvailabilityModesEnum':
+ """Initialize a ShareProfileAvailabilityModesEnum object from a json dictionary."""
+ args = {}
+ if (default := _dict.get('default')) is not None:
+ args['default'] = default
+ else:
+ raise ValueError('Required property \'default\' not present in ShareProfileAvailabilityModesEnum JSON')
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileAvailabilityModesEnum JSON')
+ if (values := _dict.get('values')) is not None:
+ args['values'] = values
+ else:
+ raise ValueError('Required property \'values\' not present in ShareProfileAvailabilityModesEnum JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileAvailabilityModesEnum object from 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
+ 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 ShareProfileAvailabilityModesEnum object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileAvailabilityModesEnum') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileAvailabilityModesEnum') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+ class DefaultEnum(str, Enum):
+ """
+ The default data availability mode for this profile.
+ """
+
+ REGIONAL = 'regional'
+ ZONAL = 'zonal'
+
+
+ class TypeEnum(str, Enum):
+ """
+ The type for this profile field.
+ """
+
+ ENUM = 'enum'
+
+
+ class ValuesEnum(str, Enum):
+ """
+ values.
+ """
+
+ REGIONAL = 'regional'
+ ZONAL = 'zonal'
+
+
+
+class ShareProfileAvailabilityModesFixed(ShareProfileAvailabilityModes):
+ """
+ The data availability mode for a share with this profile is fixed.
+
+ :param str type: The type for this profile field.
+ :param str value: The value for this profile field.
+ """
+
+ def __init__(
+ self,
+ type: str,
+ value: str,
+ ) -> None:
+ """
+ Initialize a ShareProfileAvailabilityModesFixed object.
+
+ :param str type: The type for this profile field.
+ :param str value: The value for this profile field.
+ """
+ # pylint: disable=super-init-not-called
+ self.type = type
+ self.value = value
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileAvailabilityModesFixed':
+ """Initialize a ShareProfileAvailabilityModesFixed object from a json dictionary."""
+ args = {}
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileAvailabilityModesFixed JSON')
+ if (value := _dict.get('value')) is not None:
+ args['value'] = value
+ else:
+ raise ValueError('Required property \'value\' not present in ShareProfileAvailabilityModesFixed JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileAvailabilityModesFixed object from 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 ShareProfileAvailabilityModesFixed object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileAvailabilityModesFixed') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileAvailabilityModesFixed') -> 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 value for this profile field.
+ """
+
+ REGIONAL = 'regional'
+ ZONAL = 'zonal'
+
+
+
+class ShareProfileBandwidthDependent(ShareProfileBandwidth):
+ """
+ The permitted bandwidth for a share with this profile depends on its configuration.
+
+ :param str type: The type for this profile field.
+ """
+
+ def __init__(
+ self,
+ type: str,
+ ) -> None:
+ """
+ Initialize a ShareProfileBandwidthDependent object.
+
+ :param str type: The type for this profile field.
+ """
+ # pylint: disable=super-init-not-called
+ self.type = type
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileBandwidthDependent':
+ """Initialize a ShareProfileBandwidthDependent object from a json dictionary."""
+ args = {}
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileBandwidthDependent JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileBandwidthDependent object from 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
+ 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 ShareProfileBandwidthDependent object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileBandwidthDependent') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileBandwidthDependent') -> 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.
+ """
+
+ DEPENDENT = 'dependent'
+
+
+
+class ShareProfileBandwidthDependentRange(ShareProfileBandwidth):
+ """
+ The permitted bandwidth range of a share with this profile depends on its
+ configuration.
+
+ :param int max: The maximum value for this profile field.
+ :param int min: The minimum value for this profile field.
+ :param int step: The increment step value for this profile field.
+ :param str type: The type for this profile field.
+ """
+
+ def __init__(
+ self,
+ max: int,
+ min: int,
+ step: int,
+ type: str,
+ ) -> None:
+ """
+ Initialize a ShareProfileBandwidthDependentRange object.
+
+ :param int max: The maximum value for this profile field.
+ :param int min: The minimum value for this profile field.
+ :param int step: The increment step value for this profile field.
+ :param str type: The type for this profile field.
+ """
+ # pylint: disable=super-init-not-called
+ self.max = max
+ self.min = min
+ self.step = step
+ self.type = type
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileBandwidthDependentRange':
+ """Initialize a ShareProfileBandwidthDependentRange object from a json dictionary."""
+ args = {}
+ if (max := _dict.get('max')) is not None:
+ args['max'] = max
+ else:
+ raise ValueError('Required property \'max\' not present in ShareProfileBandwidthDependentRange JSON')
+ if (min := _dict.get('min')) is not None:
+ args['min'] = min
+ else:
+ raise ValueError('Required property \'min\' not present in ShareProfileBandwidthDependentRange JSON')
+ if (step := _dict.get('step')) is not None:
+ args['step'] = step
+ else:
+ raise ValueError('Required property \'step\' not present in ShareProfileBandwidthDependentRange JSON')
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileBandwidthDependentRange JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileBandwidthDependentRange object from a json dictionary."""
+ return cls.from_dict(_dict)
+
+ def to_dict(self) -> Dict:
+ """Return a json dictionary representing this model."""
+ _dict = {}
+ if hasattr(self, 'max') and self.max is not None:
+ _dict['max'] = self.max
+ if hasattr(self, 'min') and self.min is not None:
+ _dict['min'] = self.min
+ if hasattr(self, 'step') and self.step is not None:
+ _dict['step'] = self.step
+ 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 ShareProfileBandwidthDependentRange object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileBandwidthDependentRange') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileBandwidthDependentRange') -> 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.
+ """
+
+ DEPENDENT_RANGE = 'dependent_range'
+
+
+
+class ShareProfileBandwidthEnum(ShareProfileBandwidth):
+ """
+ The permitted bandwidth values of a share with this profile.
+
+ :param int default: The default value for this profile field.
+ :param str type: The type for this profile field.
+ :param List[int] values: The permitted values for this profile field.
+ """
+
+ def __init__(
+ self,
+ default: int,
+ type: str,
+ values: List[int],
+ ) -> None:
+ """
+ Initialize a ShareProfileBandwidthEnum object.
+
+ :param int default: The default value for this profile field.
+ :param str type: The type for this profile field.
+ :param List[int] values: The permitted values for this profile field.
+ """
+ # pylint: disable=super-init-not-called
+ self.default = default
+ self.type = type
+ self.values = values
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileBandwidthEnum':
+ """Initialize a ShareProfileBandwidthEnum object from a json dictionary."""
+ args = {}
+ if (default := _dict.get('default')) is not None:
+ args['default'] = default
+ else:
+ raise ValueError('Required property \'default\' not present in ShareProfileBandwidthEnum JSON')
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileBandwidthEnum JSON')
+ if (values := _dict.get('values')) is not None:
+ args['values'] = values
+ else:
+ raise ValueError('Required property \'values\' not present in ShareProfileBandwidthEnum JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileBandwidthEnum object from 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
+ 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 ShareProfileBandwidthEnum object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileBandwidthEnum') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileBandwidthEnum') -> 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 ShareProfileBandwidthFixed(ShareProfileBandwidth):
+ """
+ The permitted bandwidth of a share with this profile is fixed.
+
+ :param str type: The type for this profile field.
+ :param int value: The value for this profile field.
+ """
+
+ def __init__(
+ self,
+ type: str,
+ value: int,
+ ) -> None:
+ """
+ Initialize a ShareProfileBandwidthFixed object.
+
+ :param str type: The type for this profile field.
+ :param int value: The value for this profile field.
+ """
+ # pylint: disable=super-init-not-called
+ self.type = type
+ self.value = value
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileBandwidthFixed':
+ """Initialize a ShareProfileBandwidthFixed object from a json dictionary."""
+ args = {}
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileBandwidthFixed JSON')
+ if (value := _dict.get('value')) is not None:
+ args['value'] = value
+ else:
+ raise ValueError('Required property \'value\' not present in ShareProfileBandwidthFixed JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileBandwidthFixed object from 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 ShareProfileBandwidthFixed object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileBandwidthFixed') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileBandwidthFixed') -> 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 ShareProfileBandwidthRange(ShareProfileBandwidth):
+ """
+ The permitted bandwidth range (in megabits per second) of a share with this profile.
+
+ :param int default: The default value for this profile field.
+ :param int max: The maximum value for this profile field.
+ :param int min: The minimum value for this profile field.
+ :param int step: The increment step value for this profile field.
+ :param str type: The type for this profile field.
+ :param int value: (optional)
+ """
+
+ def __init__(
+ self,
+ default: int,
+ max: int,
+ min: int,
+ step: int,
+ type: str,
+ *,
+ value: Optional[int] = None,
+ ) -> None:
+ """
+ Initialize a ShareProfileBandwidthRange object.
+
+ :param int default: The default value for this profile field.
+ :param int max: The maximum value for this profile field.
+ :param int min: The minimum value for this profile field.
+ :param int step: The increment step value for this profile field.
+ :param str type: The type for this profile field.
+ :param int value: (optional)
+ """
+ # pylint: disable=super-init-not-called
+ self.default = default
+ self.max = max
+ self.min = min
+ self.step = step
+ self.type = type
+ self.value = value
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileBandwidthRange':
+ """Initialize a ShareProfileBandwidthRange object from a json dictionary."""
+ args = {}
+ if (default := _dict.get('default')) is not None:
+ args['default'] = default
+ else:
+ raise ValueError('Required property \'default\' not present in ShareProfileBandwidthRange JSON')
+ if (max := _dict.get('max')) is not None:
+ args['max'] = max
+ else:
+ raise ValueError('Required property \'max\' not present in ShareProfileBandwidthRange JSON')
+ if (min := _dict.get('min')) is not None:
+ args['min'] = min
+ else:
+ raise ValueError('Required property \'min\' not present in ShareProfileBandwidthRange JSON')
+ if (step := _dict.get('step')) is not None:
+ args['step'] = step
+ else:
+ raise ValueError('Required property \'step\' not present in ShareProfileBandwidthRange JSON')
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileBandwidthRange JSON')
+ if (value := _dict.get('value')) is not None:
+ args['value'] = value
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileBandwidthRange object from 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, 'max') and self.max is not None:
+ _dict['max'] = self.max
+ if hasattr(self, 'min') and self.min is not None:
+ _dict['min'] = self.min
+ if hasattr(self, 'step') and self.step is not None:
+ _dict['step'] = self.step
+ 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 ShareProfileBandwidthRange object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileBandwidthRange') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileBandwidthRange') -> 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.
+ """
+
+ RANGE = 'range'
+
+
+
class ShareProfileCapacityDependentRange(ShareProfileCapacity):
"""
The permitted total capacity (in gigabytes) of a share with this profile depends on
@@ -142392,20 +146673,100 @@ def __ne__(self, other: 'ShareProfileIdentityByName') -> bool:
return not self == other
+class ShareProfileStorageGenerationFixed(ShareProfileStorageGeneration):
+ """
+ The storage generation value of a share with this profile is fixed.
+
+ :param str type: The type for this profile field.
+ :param int value: The value for this profile field.
+ """
+
+ def __init__(
+ self,
+ type: str,
+ value: int,
+ ) -> None:
+ """
+ Initialize a ShareProfileStorageGenerationFixed object.
+
+ :param str type: The type for this profile field.
+ :param int value: The value for this profile field.
+ """
+ # pylint: disable=super-init-not-called
+ self.type = type
+ self.value = value
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'ShareProfileStorageGenerationFixed':
+ """Initialize a ShareProfileStorageGenerationFixed object from a json dictionary."""
+ args = {}
+ if (type := _dict.get('type')) is not None:
+ args['type'] = type
+ else:
+ raise ValueError('Required property \'type\' not present in ShareProfileStorageGenerationFixed JSON')
+ if (value := _dict.get('value')) is not None:
+ args['value'] = value
+ else:
+ raise ValueError('Required property \'value\' not present in ShareProfileStorageGenerationFixed JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a ShareProfileStorageGenerationFixed object from 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 ShareProfileStorageGenerationFixed object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'ShareProfileStorageGenerationFixed') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'ShareProfileStorageGenerationFixed') -> 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 SharePrototypeShareByOriginShare(SharePrototype):
"""
Create an accessor file share for an existing file share. The values for
- `access_control_mode`, `encryption_key`, `initial_owner`, `iops`, `profile`, `size`,
- and
- `zone` will be inherited from `origin_share`.
+ `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`,
+ `initial_owner`, `iops`, `profile`, `size`, and `zone` will be inherited from
+ `origin_share`.
+ Accessor file shares can only be created for shares with a `storage_generation` of
+ `1`.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile will
+ be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be used
@@ -142418,6 +146779,9 @@ class SharePrototypeShareByOriginShare(SharePrototype):
`access_control_mode` of `security_group`, and must not have an
`accessor_binding_role` of `accessor`.
The specified share may be in a different account, subject to IAM policies.
+ :param ResourceGroupIdentity resource_group: (optional) The resource group to
+ use. If unspecified, the resource group from
+ the origin share will be used.
"""
def __init__(
@@ -142429,6 +146793,7 @@ def __init__(
name: Optional[str] = None,
replica_share: Optional['SharePrototypeShareContext'] = None,
user_tags: Optional[List[str]] = None,
+ resource_group: Optional['ResourceGroupIdentity'] = None,
) -> None:
"""
Initialize a SharePrototypeShareByOriginShare object.
@@ -142440,11 +146805,11 @@ def __init__(
The specified share may be in a different account, subject to IAM policies.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile
+ will be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be
@@ -142452,6 +146817,9 @@ def __init__(
hyphenated list of randomly-selected words.
:param SharePrototypeShareContext replica_share: (optional)
:param List[str] user_tags: (optional) The tags for this resource.
+ :param ResourceGroupIdentity resource_group: (optional) The resource group
+ to use. If unspecified, the resource group from
+ the origin share will be used.
"""
# pylint: disable=super-init-not-called
self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
@@ -142460,6 +146828,7 @@ def __init__(
self.replica_share = replica_share
self.user_tags = user_tags
self.origin_share = origin_share
+ self.resource_group = resource_group
@classmethod
def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareByOriginShare':
@@ -142479,6 +146848,8 @@ def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareByOriginShare':
args['origin_share'] = origin_share
else:
raise ValueError('Required property \'origin_share\' not present in SharePrototypeShareByOriginShare JSON')
+ if (resource_group := _dict.get('resource_group')) is not None:
+ args['resource_group'] = resource_group
return cls(**args)
@classmethod
@@ -142513,6 +146884,11 @@ def to_dict(self) -> Dict:
_dict['origin_share'] = self.origin_share
else:
_dict['origin_share'] = self.origin_share.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()
return _dict
def _to_dict(self):
@@ -142538,8 +146914,9 @@ class AllowedTransitEncryptionModesEnum(str, Enum):
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
@@ -142549,11 +146926,11 @@ class SharePrototypeShareBySize(SharePrototype):
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile will
+ be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be used
@@ -142569,6 +146946,20 @@ class SharePrototypeShareBySize(SharePrototype):
- `vpc`: All clients in the VPC for a mount target have access to the mount
target.
Mount targets for this share require a VPC.
+ :param List[str] allowed_access_protocols: (optional) The access protocols to
+ allow for this share. If unspecified:
+ - If share mount targets are specified, only the access protocols specified by
+ those
+ share mount target will be allowed.
+ - Otherwise, the default access protocols from the profile will be used.
+ :param int bandwidth: (optional) The maximum bandwidth (in megabits per second)
+ for the file share.
+ If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this
+ property is system-managed and must not be specified. Otherwise, the specified
+ value must be within the `bandwidth` range of the share's profile.
+ Provided the property is user-managed, if it is unspecified, its value will be
+ set based on the specified [`size` and
+ `iops`](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles&interface=api).
:param EncryptionKeyIdentity encryption_key: (optional) The root key to use to
wrap the data encryption key for the share.
If unspecified, the `encryption` type for the share will be `provider_managed`.
@@ -142594,16 +146985,18 @@ class SharePrototypeShareBySize(SharePrototype):
snapshots.
The specified value must be within the permitted `capacity` range of the share's
profile and supported by the share's specified IOPS.
- :param ZoneIdentity zone: The zone this file share will reside in. For a replica
- share in the same region as
+ :param ZoneIdentity zone: (optional) The zone this file share will reside in.
+ For a replica share in the same region as
the source share, this must be a different zone from the source share.
+ This property must be specified if the share profile `availability_mode` is
+ `zonal`,
+ and must not be specified otherwise.
"""
def __init__(
self,
profile: 'ShareProfileIdentity',
size: int,
- zone: 'ZoneIdentity',
*,
allowed_transit_encryption_modes: Optional[List[str]] = None,
mount_targets: Optional[List['ShareMountTargetPrototype']] = None,
@@ -142611,10 +147004,13 @@ def __init__(
replica_share: Optional['SharePrototypeShareContext'] = None,
user_tags: Optional[List[str]] = None,
access_control_mode: Optional[str] = None,
+ allowed_access_protocols: Optional[List[str]] = None,
+ bandwidth: Optional[int] = None,
encryption_key: Optional['EncryptionKeyIdentity'] = None,
initial_owner: Optional['ShareInitialOwner'] = None,
iops: Optional[int] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
+ zone: Optional['ZoneIdentity'] = None,
) -> None:
"""
Initialize a SharePrototypeShareBySize object.
@@ -142628,16 +147024,13 @@ def __init__(
snapshots.
The specified value must be within the permitted `capacity` range of the
share's profile and supported by the share's specified IOPS.
- :param ZoneIdentity zone: The zone this file share will reside in. For a
- replica share in the same region as
- the source share, this must be a different zone from the source share.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile
+ will be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be
@@ -142655,6 +147048,21 @@ def __init__(
- `vpc`: All clients in the VPC for a mount target have access to the mount
target.
Mount targets for this share require a VPC.
+ :param List[str] allowed_access_protocols: (optional) The access protocols
+ to allow for this share. If unspecified:
+ - If share mount targets are specified, only the access protocols specified
+ by those
+ share mount target will be allowed.
+ - Otherwise, the default access protocols from the profile will be used.
+ :param int bandwidth: (optional) The maximum bandwidth (in megabits per
+ second) for the file share.
+ If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this
+ property is system-managed and must not be specified. Otherwise, the
+ specified value must be within the `bandwidth` range of the share's
+ profile.
+ Provided the property is user-managed, if it is unspecified, its value will
+ be set based on the specified [`size` and
+ `iops`](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles&interface=api).
:param EncryptionKeyIdentity encryption_key: (optional) The root key to use
to wrap the data encryption key for the share.
If unspecified, the `encryption` type for the share will be
@@ -142673,6 +147081,12 @@ def __init__(
to use. If unspecified, the account's [default resource
group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be
used.
+ :param ZoneIdentity zone: (optional) The zone this file share will reside
+ in. For a replica share in the same region as
+ the source share, this must be a different zone from the source share.
+ This property must be specified if the share profile `availability_mode` is
+ `zonal`,
+ and must not be specified otherwise.
"""
# pylint: disable=super-init-not-called
self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
@@ -142681,6 +147095,8 @@ def __init__(
self.replica_share = replica_share
self.user_tags = user_tags
self.access_control_mode = access_control_mode
+ self.allowed_access_protocols = allowed_access_protocols
+ self.bandwidth = bandwidth
self.encryption_key = encryption_key
self.initial_owner = initial_owner
self.iops = iops
@@ -142705,6 +147121,10 @@ def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareBySize':
args['user_tags'] = user_tags
if (access_control_mode := _dict.get('access_control_mode')) is not None:
args['access_control_mode'] = access_control_mode
+ if (allowed_access_protocols := _dict.get('allowed_access_protocols')) is not None:
+ args['allowed_access_protocols'] = allowed_access_protocols
+ if (bandwidth := _dict.get('bandwidth')) is not None:
+ args['bandwidth'] = bandwidth
if (encryption_key := _dict.get('encryption_key')) is not None:
args['encryption_key'] = encryption_key
if (initial_owner := _dict.get('initial_owner')) is not None:
@@ -142723,8 +147143,6 @@ def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareBySize':
raise ValueError('Required property \'size\' not present in SharePrototypeShareBySize JSON')
if (zone := _dict.get('zone')) is not None:
args['zone'] = zone
- else:
- raise ValueError('Required property \'zone\' not present in SharePrototypeShareBySize JSON')
return cls(**args)
@classmethod
@@ -142756,6 +147174,10 @@ def to_dict(self) -> Dict:
_dict['user_tags'] = self.user_tags
if hasattr(self, 'access_control_mode') and self.access_control_mode is not None:
_dict['access_control_mode'] = self.access_control_mode
+ if hasattr(self, 'allowed_access_protocols') and self.allowed_access_protocols is not None:
+ _dict['allowed_access_protocols'] = self.allowed_access_protocols
+ if hasattr(self, 'bandwidth') and self.bandwidth is not None:
+ _dict['bandwidth'] = self.bandwidth
if hasattr(self, 'encryption_key') and self.encryption_key is not None:
if isinstance(self.encryption_key, dict):
_dict['encryption_key'] = self.encryption_key
@@ -142810,8 +147232,9 @@ class AllowedTransitEncryptionModesEnum(str, Enum):
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
class AccessControlModeEnum(str, Enum):
@@ -142829,20 +147252,31 @@ class AccessControlModeEnum(str, Enum):
VPC = 'vpc'
+ class AllowedAccessProtocolsEnum(str, Enum):
+ """
+ allowed_access_protocols.
+ """
+
+ NFS4 = 'nfs4'
+
+
class SharePrototypeShareBySourceShare(SharePrototype):
"""
Create a replica file share for an existing file share. The values for
- `access_control_mode`, `encryption_key`, `initial_owner`, and `size` will be inherited
- from `source_share`.
+ `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`,
+ `initial_owner`, and `size` will be inherited from the `source_share`.
+ Replica file shares can only be created if the source share has a `storage_generation`
+ of
+ `1`.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile will
+ be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be used
@@ -142865,8 +147299,9 @@ class SharePrototypeShareBySourceShare(SharePrototype):
specified size.
:param ShareProfileIdentity profile: The
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use
- for this file share. The profile must support the share's specified IOPS and
- size.
+ for this file share. The profile must:
+ - support the share's specified IOPS and size, and
+ - have the same `storage_generation` as the source share.
:param str replication_cron_spec: The cron specification for the file share
replication schedule.
Replication of a share can be scheduled to occur at most once every 15 minutes.
@@ -142877,14 +147312,18 @@ class SharePrototypeShareBySourceShare(SharePrototype):
use. If unspecified, the resource group from
the source share will be used.
:param ShareIdentity source_share: The source file share for this replica file
- share. The specified file share must not
- already have a replica, and must not be a replica. If source file share is
- specified
- by CRN, it may be in an [associated partner
+ share. The specified file share must:
+ - Not already have a replica.
+ - Not be a replica.
+ - Have a `storage_generation` of `1`.
+ If source file share is specified by CRN, it may be in an [associated partner
region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication).
- :param ZoneIdentity zone: The zone this file share will reside in. For a replica
- share in the same region as
+ :param ZoneIdentity zone: (optional) The zone this file share will reside in.
+ For a replica share in the same region as
the source share, this must be a different zone from the source share.
+ This property must be specified if the share profile `availability_mode` is
+ `zonal`,
+ and must not be specified otherwise.
"""
def __init__(
@@ -142892,7 +147331,6 @@ def __init__(
profile: 'ShareProfileIdentity',
replication_cron_spec: str,
source_share: 'ShareIdentity',
- zone: 'ZoneIdentity',
*,
allowed_transit_encryption_modes: Optional[List[str]] = None,
mount_targets: Optional[List['ShareMountTargetPrototype']] = None,
@@ -142902,6 +147340,7 @@ def __init__(
encryption_key: Optional['EncryptionKeyIdentity'] = None,
iops: Optional[int] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
+ zone: Optional['ZoneIdentity'] = None,
) -> None:
"""
Initialize a SharePrototypeShareBySourceShare object.
@@ -142909,8 +147348,9 @@ def __init__(
:param ShareProfileIdentity profile: The
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles)
to use
- for this file share. The profile must support the share's specified IOPS
- and size.
+ for this file share. The profile must:
+ - support the share's specified IOPS and size, and
+ - have the same `storage_generation` as the source share.
:param str replication_cron_spec: The cron specification for the file share
replication schedule.
Replication of a share can be scheduled to occur at most once every 15
@@ -142919,21 +147359,20 @@ def __init__(
[increase](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in
the future.
:param ShareIdentity source_share: The source file share for this replica
- file share. The specified file share must not
- already have a replica, and must not be a replica. If source file share is
- specified
- by CRN, it may be in an [associated partner
+ file share. The specified file share must:
+ - Not already have a replica.
+ - Not be a replica.
+ - Have a `storage_generation` of `1`.
+ If source file share is specified by CRN, it may be in an [associated
+ partner
region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication).
- :param ZoneIdentity zone: The zone this file share will reside in. For a
- replica share in the same region as
- the source share, this must be a different zone from the source share.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile
+ will be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be
@@ -142957,6 +147396,12 @@ def __init__(
:param ResourceGroupIdentity resource_group: (optional) The resource group
to use. If unspecified, the resource group from
the source share will be used.
+ :param ZoneIdentity zone: (optional) The zone this file share will reside
+ in. For a replica share in the same region as
+ the source share, this must be a different zone from the source share.
+ This property must be specified if the share profile `availability_mode` is
+ `zonal`,
+ and must not be specified otherwise.
"""
# pylint: disable=super-init-not-called
self.allowed_transit_encryption_modes = allowed_transit_encryption_modes
@@ -143006,8 +147451,6 @@ def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareBySourceShare':
raise ValueError('Required property \'source_share\' not present in SharePrototypeShareBySourceShare JSON')
if (zone := _dict.get('zone')) is not None:
args['zone'] = zone
- else:
- raise ValueError('Required property \'zone\' not present in SharePrototypeShareBySourceShare JSON')
return cls(**args)
@classmethod
@@ -143091,24 +147534,25 @@ class AllowedTransitEncryptionModesEnum(str, Enum):
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
class SharePrototypeShareBySourceSnapshot(SharePrototype):
"""
Create a file share from a source snapshot. The initial value for
- `access_control_mode`, and the zone the file share resides in will be inherited from
- `source_snapshot`.
+ `access_control_mode`,
+ `initial_owner` and `zone` will be inherited from `source_snapshot`.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile will
+ be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be used
@@ -143116,13 +147560,33 @@ class SharePrototypeShareBySourceSnapshot(SharePrototype):
list of randomly-selected words.
:param SharePrototypeShareContext replica_share: (optional)
:param List[str] user_tags: (optional) The tags for this resource.
+ :param List[str] allowed_access_protocols: (optional) The access protocols to
+ allow for this share. If unspecified:
+ - If share mount targets are specified, only the access protocols specified by
+ those
+ share mount target will be allowed.
+ - Otherwise, the default access protocols from the profile will be used.
+ :param int bandwidth: (optional) The maximum bandwidth (in megabits per second)
+ for the file share.
+ If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this
+ property is system-managed and must not be specified. Otherwise, the specified
+ value must be within the `bandwidth` range of the share's profile.
+ Provided the property is user-managed, if it is unspecified, its value will be
+ set based on the specified [`size` and
+ `iops`](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles&interface=api).
:param EncryptionKeyIdentity encryption_key: (optional) The root key to use to
wrap the data encryption key for the share.
The specified key may be in a different account, subject to IAM policies.
- If unspecified, the source snapshot's `encryption_key` will be used.
+ If unspecified, the source share's `encryption_key` will be used.
+ For snapshots of shares with `storage_generation` of `2`, an encryption key may
+ only
+ be specified if the source share's `encryption` is `user_managed`.
:param ShareInitialOwner initial_owner: (optional) The owner assigned to the
file share at creation. Subsequent changes to the owner
must be performed by a client that has mounted the file share.
+ `initial_owner` for a share created from a source snapshot can only be specified
+ for
+ snapshots of shares with `storage_generation` of `1`.
:param int iops: (optional) The maximum input/output operations per second
(IOPS) for the file share.
If the share profile has an `iops.type` of `dependent` or `fixed`, this property
@@ -143131,8 +147595,9 @@ class SharePrototypeShareBySourceSnapshot(SharePrototype):
specified size.
:param ShareProfileIdentity profile: The
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use
- for this file share. The profile must support the share's specified IOPS and
- size.
+ for this file share. The profile must:
+ - support the share's specified IOPS and size, and
+ - have the same `storage_generation` as the source snapshot.
: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) will be
@@ -143159,6 +147624,8 @@ def __init__(
name: Optional[str] = None,
replica_share: Optional['SharePrototypeShareContext'] = None,
user_tags: Optional[List[str]] = None,
+ allowed_access_protocols: Optional[List[str]] = None,
+ bandwidth: Optional[int] = None,
encryption_key: Optional['EncryptionKeyIdentity'] = None,
initial_owner: Optional['ShareInitialOwner'] = None,
iops: Optional[int] = None,
@@ -143171,8 +147638,9 @@ def __init__(
:param ShareProfileIdentity profile: The
[profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles)
to use
- for this file share. The profile must support the share's specified IOPS
- and size.
+ for this file share. The profile must:
+ - support the share's specified IOPS and size, and
+ - have the same `storage_generation` as the source snapshot.
:param ShareSourceSnapshotPrototype source_snapshot: The source snapshot to
clone this file share from.
This file share will reside in the same zone as the specified source
@@ -143182,11 +147650,11 @@ def __init__(
to be able to restore a share for it.
:param List[str] allowed_transit_encryption_modes: (optional) The transit
encryption modes to allow for this share. If unspecified:
- - If share mount targets are specified, and those share mount targets all
- specify a
- `transit_encryption` of `user_managed`, then only `user_managed` will be
- allowed.
- - Otherwise, all `transit_encryption` modes will be allowed.
+ - If share mount targets are specified, then only transit encryption modes
+ specified by those share mount target will be allowed.
+ - Otherwise, the default allowed transit encryption modes from the profile
+ will be
+ used.
:param List[ShareMountTargetPrototype] mount_targets: (optional) The mount
targets for the file share. Each mount target must be in a unique VPC.
:param str name: (optional) The name for this share. The name must not be
@@ -143194,13 +147662,34 @@ def __init__(
hyphenated list of randomly-selected words.
:param SharePrototypeShareContext replica_share: (optional)
:param List[str] user_tags: (optional) The tags for this resource.
+ :param List[str] allowed_access_protocols: (optional) The access protocols
+ to allow for this share. If unspecified:
+ - If share mount targets are specified, only the access protocols specified
+ by those
+ share mount target will be allowed.
+ - Otherwise, the default access protocols from the profile will be used.
+ :param int bandwidth: (optional) The maximum bandwidth (in megabits per
+ second) for the file share.
+ If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this
+ property is system-managed and must not be specified. Otherwise, the
+ specified value must be within the `bandwidth` range of the share's
+ profile.
+ Provided the property is user-managed, if it is unspecified, its value will
+ be set based on the specified [`size` and
+ `iops`](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles&interface=api).
:param EncryptionKeyIdentity encryption_key: (optional) The root key to use
to wrap the data encryption key for the share.
The specified key may be in a different account, subject to IAM policies.
- If unspecified, the source snapshot's `encryption_key` will be used.
+ If unspecified, the source share's `encryption_key` will be used.
+ For snapshots of shares with `storage_generation` of `2`, an encryption key
+ may only
+ be specified if the source share's `encryption` is `user_managed`.
:param ShareInitialOwner initial_owner: (optional) The owner assigned to
the file share at creation. Subsequent changes to the owner
must be performed by a client that has mounted the file share.
+ `initial_owner` for a share created from a source snapshot can only be
+ specified for
+ snapshots of shares with `storage_generation` of `1`.
:param int iops: (optional) The maximum input/output operations per second
(IOPS) for the file share.
If the share profile has an `iops.type` of `dependent` or `fixed`, this
@@ -143222,6 +147711,8 @@ def __init__(
self.name = name
self.replica_share = replica_share
self.user_tags = user_tags
+ self.allowed_access_protocols = allowed_access_protocols
+ self.bandwidth = bandwidth
self.encryption_key = encryption_key
self.initial_owner = initial_owner
self.iops = iops
@@ -143244,6 +147735,10 @@ def from_dict(cls, _dict: Dict) -> 'SharePrototypeShareBySourceSnapshot':
args['replica_share'] = SharePrototypeShareContext.from_dict(replica_share)
if (user_tags := _dict.get('user_tags')) is not None:
args['user_tags'] = user_tags
+ if (allowed_access_protocols := _dict.get('allowed_access_protocols')) is not None:
+ args['allowed_access_protocols'] = allowed_access_protocols
+ if (bandwidth := _dict.get('bandwidth')) is not None:
+ args['bandwidth'] = bandwidth
if (encryption_key := _dict.get('encryption_key')) is not None:
args['encryption_key'] = encryption_key
if (initial_owner := _dict.get('initial_owner')) is not None:
@@ -143291,6 +147786,10 @@ def to_dict(self) -> Dict:
_dict['replica_share'] = self.replica_share.to_dict()
if hasattr(self, 'user_tags') and self.user_tags is not None:
_dict['user_tags'] = self.user_tags
+ if hasattr(self, 'allowed_access_protocols') and self.allowed_access_protocols is not None:
+ _dict['allowed_access_protocols'] = self.allowed_access_protocols
+ if hasattr(self, 'bandwidth') and self.bandwidth is not None:
+ _dict['bandwidth'] = self.bandwidth
if hasattr(self, 'encryption_key') and self.encryption_key is not None:
if isinstance(self.encryption_key, dict):
_dict['encryption_key'] = self.encryption_key
@@ -143345,8 +147844,17 @@ class AllowedTransitEncryptionModesEnum(str, Enum):
allowed_transit_encryption_modes.
"""
+ IPSEC = 'ipsec'
NONE = 'none'
- USER_MANAGED = 'user_managed'
+ STUNNEL = 'stunnel'
+
+
+ class AllowedAccessProtocolsEnum(str, Enum):
+ """
+ allowed_access_protocols.
+ """
+
+ NFS4 = 'nfs4'
@@ -143507,8 +148015,9 @@ class SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(Snaps
If unspecified, the name will be a hyphenated list of randomly-selected words.
:param ResourceGroupIdentity resource_group: (optional)
:param List[SnapshotPrototypeSnapshotConsistencyGroupContext] snapshots: The
- data-consistent member snapshots to create. All snapshots must specify a
- `source_volume` attached to the same virtual server instance.
+ data-consistent member snapshots to create. Each snapshot must specify a
+ `source_volume` attached to the same virtual server instance, and all source
+ volumes must have a `storage_generation` value of `1`.
"""
def __init__(
@@ -143523,9 +148032,10 @@ def __init__(
Initialize a SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots object.
:param List[SnapshotPrototypeSnapshotConsistencyGroupContext] snapshots:
- The data-consistent member snapshots to create. All snapshots must specify
+ The data-consistent member snapshots to create. Each snapshot must specify
a
- `source_volume` attached to the same virtual server instance.
+ `source_volume` attached to the same virtual server instance, and all
+ source volumes must have a `storage_generation` value of `1`.
:param bool delete_snapshots_on_delete: (optional) Indicates whether
deleting the snapshot consistency group will also delete the snapshots in
the group.
@@ -143788,6 +148298,10 @@ class SnapshotPrototypeSnapshotBySourceSnapshot(SnapshotPrototype):
"""
SnapshotPrototypeSnapshotBySourceSnapshot.
+ :param SnapshotAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to match against the requested instance or bare metal server properties to
+ determine compatibility.
+ Can only be specified for bootable snapshots.
:param List[SnapshotClonePrototype] clones: (optional) The clones to create for
this snapshot.
:param str name: (optional) The name for this snapshot. The name must not be
@@ -143818,6 +148332,7 @@ def __init__(
self,
source_snapshot: 'SnapshotIdentityByCRN',
*,
+ allowed_use: Optional['SnapshotAllowedUsePrototype'] = None,
clones: Optional[List['SnapshotClonePrototype']] = None,
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
@@ -143832,6 +148347,10 @@ def __init__(
The specified snapshot must not already be the source of another snapshot
in this
region.
+ :param SnapshotAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to match against the requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified for bootable snapshots.
:param List[SnapshotClonePrototype] clones: (optional) The clones to create
for this snapshot.
:param str name: (optional) The name for this snapshot. The name must not
@@ -143853,6 +148372,7 @@ def __init__(
The specified key may be in a different account, subject to IAM policies.
"""
# pylint: disable=super-init-not-called
+ self.allowed_use = allowed_use
self.clones = clones
self.name = name
self.resource_group = resource_group
@@ -143864,6 +148384,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'SnapshotPrototypeSnapshotBySourceSnapshot':
"""Initialize a SnapshotPrototypeSnapshotBySourceSnapshot object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = SnapshotAllowedUsePrototype.from_dict(allowed_use)
if (clones := _dict.get('clones')) is not None:
args['clones'] = [SnapshotClonePrototype.from_dict(v) for v in clones]
if (name := _dict.get('name')) is not None:
@@ -143888,6 +148410,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'clones') and self.clones is not None:
clones_list = []
for v in self.clones:
@@ -143940,6 +148467,10 @@ class SnapshotPrototypeSnapshotBySourceVolume(SnapshotPrototype):
"""
SnapshotPrototypeSnapshotBySourceVolume.
+ :param SnapshotAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to match against the requested instance or bare metal server properties to
+ determine compatibility.
+ Can only be specified for bootable snapshots.
:param List[SnapshotClonePrototype] clones: (optional) The clones to create for
this snapshot.
:param str name: (optional) The name for this snapshot. The name must not be
@@ -143956,6 +148487,7 @@ def __init__(
self,
source_volume: 'VolumeIdentity',
*,
+ allowed_use: Optional['SnapshotAllowedUsePrototype'] = None,
clones: Optional[List['SnapshotClonePrototype']] = None,
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
@@ -143966,6 +148498,10 @@ def __init__(
:param VolumeIdentity source_volume: The volume to create this snapshot
from.
+ :param SnapshotAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to match against the requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified for bootable snapshots.
:param List[SnapshotClonePrototype] clones: (optional) The clones to create
for this snapshot.
:param str name: (optional) The name for this snapshot. The name must not
@@ -143977,6 +148513,7 @@ def __init__(
this snapshot.
"""
# pylint: disable=super-init-not-called
+ self.allowed_use = allowed_use
self.clones = clones
self.name = name
self.resource_group = resource_group
@@ -143987,6 +148524,8 @@ def __init__(
def from_dict(cls, _dict: Dict) -> 'SnapshotPrototypeSnapshotBySourceVolume':
"""Initialize a SnapshotPrototypeSnapshotBySourceVolume object from a json dictionary."""
args = {}
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = SnapshotAllowedUsePrototype.from_dict(allowed_use)
if (clones := _dict.get('clones')) is not None:
args['clones'] = [SnapshotClonePrototype.from_dict(v) for v in clones]
if (name := _dict.get('name')) is not None:
@@ -144009,6 +148548,11 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.to_dict()
if hasattr(self, 'clones') and self.clones is not None:
clones_list = []
for v in self.clones:
@@ -152799,6 +157343,12 @@ class VolumePrototypeVolumeBySourceSnapshot(VolumePrototype):
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this
volume.
:param ZoneIdentity zone: The zone this volume will reside in.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified, the
+ value of
+ this property will be inherited from the `source_snapshot`.
:param int capacity: (optional) The capacity to use for the volume (in
gigabytes). The specified value must be at least the snapshot's
`minimum_capacity`, and must be within the `capacity` range of the volume's
@@ -152825,6 +157375,7 @@ def __init__(
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
user_tags: Optional[List[str]] = None,
+ allowed_use: Optional['VolumeAllowedUsePrototype'] = None,
capacity: Optional[int] = None,
encryption_key: Optional['EncryptionKeyIdentity'] = None,
) -> None:
@@ -152862,6 +157413,12 @@ def __init__(
:param List[str] user_tags: (optional) The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this volume.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified,
+ the value of
+ this property will be inherited from the `source_snapshot`.
:param int capacity: (optional) The capacity to use for the volume (in
gigabytes). The specified value must be at least the snapshot's
`minimum_capacity`, and must be within the `capacity` range of the volume's
@@ -152881,6 +157438,7 @@ def __init__(
self.resource_group = resource_group
self.user_tags = user_tags
self.zone = zone
+ self.allowed_use = allowed_use
self.capacity = capacity
self.encryption_key = encryption_key
self.source_snapshot = source_snapshot
@@ -152907,6 +157465,8 @@ def from_dict(cls, _dict: Dict) -> 'VolumePrototypeVolumeBySourceSnapshot':
args['zone'] = zone
else:
raise ValueError('Required property \'zone\' not present in VolumePrototypeVolumeBySourceSnapshot JSON')
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = VolumeAllowedUsePrototype.from_dict(allowed_use)
if (capacity := _dict.get('capacity')) is not None:
args['capacity'] = capacity
if (encryption_key := _dict.get('encryption_key')) is not None:
@@ -152948,6 +157508,11 @@ def to_dict(self) -> Dict:
_dict['zone'] = self.zone
else:
_dict['zone'] = self.zone.to_dict()
+ if hasattr(self, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.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:
@@ -157456,8 +162021,7 @@ class InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanc
"""
InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -157562,7 +162126,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -157859,8 +162422,7 @@ class InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanc
"""
InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -157965,7 +162527,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -158261,8 +162822,7 @@ class InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment
"""
InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -158369,7 +162929,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -158666,8 +163225,7 @@ class InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(
"""
InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -158774,7 +163332,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -159070,8 +163627,7 @@ class InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceB
"""
InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -159177,7 +163733,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -159463,8 +164018,7 @@ class InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceB
"""
InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -159570,7 +164124,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -159855,8 +164408,7 @@ class InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachme
"""
InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -159961,7 +164513,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -160247,8 +164798,7 @@ class InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterfac
"""
InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -160353,7 +164903,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -160638,8 +165187,7 @@ class InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplate
"""
InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -160743,7 +165291,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -161039,8 +165586,7 @@ class InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplate
"""
InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -161144,7 +165690,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -161439,8 +165984,7 @@ class InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageIns
"""
InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -161546,7 +166090,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -161842,8 +166385,7 @@ class InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageIns
"""
InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -161949,7 +166491,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -162244,8 +166785,7 @@ class InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateB
"""
InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -162350,7 +166890,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -162635,8 +167174,7 @@ class InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateB
"""
InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -162741,7 +167279,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -163025,8 +167562,7 @@ class InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceBy
"""
InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -163148,7 +167684,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -163472,8 +168007,7 @@ class InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceBy
"""
InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -163595,7 +168129,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -163918,8 +168451,7 @@ class InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInsta
"""
InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -164043,7 +168575,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -164367,8 +168898,7 @@ class InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInsta
"""
InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -164492,7 +169022,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -164815,8 +169344,7 @@ class InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceByS
"""
InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -164942,7 +169470,6 @@ def __init__(
:param InstanceNetworkAttachmentPrototype primary_network_attachment: The
primary network attachment to create for the virtual server instance.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -165268,8 +169795,7 @@ class InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceByS
"""
InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface.
- :param InstanceAvailabilityPolicyPrototype availability_policy: (optional) The
- availability policy to use for this virtual server instance.
+ :param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment represents
@@ -165398,7 +169924,6 @@ def __init__(
:param NetworkInterfacePrototype primary_network_interface: The primary
instance network interface to create.
:param InstanceAvailabilityPolicyPrototype availability_policy: (optional)
- The availability policy to use for this virtual server instance.
:param List[InstanceClusterNetworkAttachmentPrototypeInstanceContext]
cluster_network_attachments: (optional) The cluster network attachments to
create for this virtual server instance. A cluster network attachment
@@ -166571,6 +171096,126 @@ def __ne__(self, other: 'LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdenti
return not self == other
+class LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref(LoadBalancerPoolMemberTargetPrototypeReservedIPIdentity):
+ """
+ LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref.
+
+ :param str href: The URL for this reserved IP.
+ """
+
+ def __init__(
+ self,
+ href: str,
+ ) -> None:
+ """
+ Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref object.
+
+ :param str href: The URL for this reserved IP.
+ """
+ # pylint: disable=super-init-not-called
+ self.href = href
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref':
+ """Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref object from a json dictionary."""
+ args = {}
+ if (href := _dict.get('href')) is not None:
+ args['href'] = href
+ else:
+ raise ValueError('Required property \'href\' not present in LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref object from 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 LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
+class LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById(LoadBalancerPoolMemberTargetPrototypeReservedIPIdentity):
+ """
+ LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById.
+
+ :param str id: The unique identifier for this reserved IP.
+ """
+
+ def __init__(
+ self,
+ id: str,
+ ) -> None:
+ """
+ Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById object.
+
+ :param str id: The unique identifier for this reserved IP.
+ """
+ # pylint: disable=super-init-not-called
+ self.id = id
+
+ @classmethod
+ def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById':
+ """Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById object from a json dictionary."""
+ args = {}
+ if (id := _dict.get('id')) is not None:
+ args['id'] = id
+ else:
+ raise ValueError('Required property \'id\' not present in LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById JSON')
+ return cls(**args)
+
+ @classmethod
+ def _from_dict(cls, _dict):
+ """Initialize a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById object from 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 LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById object."""
+ return json.dumps(self.to_dict(), indent=2)
+
+ def __eq__(self, other: 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById') -> bool:
+ """Return `true` when self and other are equal, false otherwise."""
+ if not isinstance(other, self.__class__):
+ return False
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other: 'LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById') -> bool:
+ """Return `true` when self and other are not equal, false otherwise."""
+ return not self == other
+
+
class NetworkInterfaceIPPrototypeReservedIPIdentityByHref(NetworkInterfaceIPPrototypeReservedIPIdentity):
"""
NetworkInterfaceIPPrototypeReservedIPIdentityByHref.
@@ -169797,6 +174442,12 @@ class VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototy
:param List[str] user_tags: (optional) The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this
volume.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage constraints
+ to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified, the
+ value of
+ this property will be inherited from the `source_snapshot`.
:param int capacity: (optional) The capacity to use for the volume (in
gigabytes). The specified value must be at least the snapshot's
`minimum_capacity`, and must be within the `capacity` range of the volume's
@@ -169822,6 +174473,7 @@ def __init__(
name: Optional[str] = None,
resource_group: Optional['ResourceGroupIdentity'] = None,
user_tags: Optional[List[str]] = None,
+ allowed_use: Optional['VolumeAllowedUsePrototype'] = None,
capacity: Optional[int] = None,
encryption_key: Optional['EncryptionKeyIdentity'] = None,
) -> None:
@@ -169860,6 +174512,12 @@ def __init__(
:param List[str] user_tags: (optional) The [user
tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with
this volume.
+ :param VolumeAllowedUsePrototype allowed_use: (optional) The usage
+ constraints to be matched against requested instance or bare metal server
+ properties to determine compatibility.
+ Can only be specified if `source_snapshot` is bootable. If not specified,
+ the value of
+ this property will be inherited from the `source_snapshot`.
:param int capacity: (optional) The capacity to use for the volume (in
gigabytes). The specified value must be at least the snapshot's
`minimum_capacity`, and must be within the `capacity` range of the volume's
@@ -169878,6 +174536,7 @@ def __init__(
self.profile = profile
self.resource_group = resource_group
self.user_tags = user_tags
+ self.allowed_use = allowed_use
self.capacity = capacity
self.encryption_key = encryption_key
self.source_snapshot = source_snapshot
@@ -169900,6 +174559,8 @@ def from_dict(cls, _dict: Dict) -> 'VolumeAttachmentPrototypeVolumeVolumePrototy
args['resource_group'] = resource_group
if (user_tags := _dict.get('user_tags')) is not None:
args['user_tags'] = user_tags
+ if (allowed_use := _dict.get('allowed_use')) is not None:
+ args['allowed_use'] = VolumeAllowedUsePrototype.from_dict(allowed_use)
if (capacity := _dict.get('capacity')) is not None:
args['capacity'] = capacity
if (encryption_key := _dict.get('encryption_key')) is not None:
@@ -169936,6 +174597,11 @@ def to_dict(self) -> Dict:
_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, 'allowed_use') and self.allowed_use is not None:
+ if isinstance(self.allowed_use, dict):
+ _dict['allowed_use'] = self.allowed_use
+ else:
+ _dict['allowed_use'] = self.allowed_use.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:
@@ -170325,9 +174991,9 @@ def __ne__(self, other: 'InstanceGroupManagerActionPrototypeScheduledActionProto
##############################################################################
-class VpcsPager:
+class BackupPoliciesPager:
"""
- VpcsPager can be used to simplify the use of the "list_vpcs" method.
+ BackupPoliciesPager can be used to simplify the use of the "list_backup_policies" method.
"""
def __init__(
@@ -170336,23 +175002,27 @@ def __init__(
client: VpcV1,
limit: int = None,
resource_group_id: str = None,
- classic_access: bool = None,
+ name: str = None,
+ tag: str = None,
) -> None:
"""
- Initialize a VpcsPager object.
+ Initialize a BackupPoliciesPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param bool classic_access: (optional) Filters the collection to VPCs with
- a `classic_access` property matching the specified value.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str tag: (optional) Filters the collection to resources with an item
+ in the `tags` property matching the exact specified tag.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
self._resource_group_id = resource_group_id
- self._classic_access = classic_access
+ self._name = name
+ self._tag = tag
def has_next(self) -> bool:
"""
@@ -170363,16 +175033,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPC.
+ :return: A List[dict], where each element is a dict that represents an instance of BackupPolicy.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpcs(
+ result = self._client.list_backup_policies(
limit=self._limit,
resource_group_id=self._resource_group_id,
- classic_access=self._classic_access,
+ name=self._name,
+ tag=self._tag,
start=self._page_context.get('next'),
).get_result()
@@ -170384,13 +175055,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('vpcs')
+ return result.get('backup_policies')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPC.
+ :return: A List[dict], where each element is a dict that represents an instance of BackupPolicy.
:rtype: List[dict]
"""
results = []
@@ -170400,28 +175071,58 @@ def get_all(self) -> List[dict]:
return results
-class VpcAddressPrefixesPager:
+class BackupPolicyJobsPager:
"""
- VpcAddressPrefixesPager can be used to simplify the use of the "list_vpc_address_prefixes" method.
+ BackupPolicyJobsPager can be used to simplify the use of the "list_backup_policy_jobs" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpc_id: str,
+ backup_policy_id: str,
+ status: str = None,
+ backup_policy_plan_id: str = None,
limit: int = None,
+ sort: str = None,
+ source_id: str = None,
+ target_snapshots_id: str = None,
+ target_snapshots_crn: str = None,
) -> None:
"""
- Initialize a VpcAddressPrefixesPager object.
- :param str vpc_id: The VPC identifier.
+ Initialize a BackupPolicyJobsPager object.
+ :param str backup_policy_id: The backup policy identifier.
+ :param str status: (optional) Filters the collection to backup policy jobs
+ with a `status` property matching the specified value.
+ :param str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching the
+ specified identifier.
: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 str source_id: (optional) Filters the collection to backup policy
+ jobs with a `source.id` property matching the specified identifier.
+ :param str target_snapshots_id: (optional) Filters the collection to backup
+ policy jobs with an item in the `target_snapshots` property with an `id`
+ property matching the specified identifier.
+ :param str target_snapshots_crn: (optional) Filters the collection to
+ backup policy jobs with an item in the `target_snapshots` property with a
+ `crn` property matching the specified CRN.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpc_id = vpc_id
+ self._backup_policy_id = backup_policy_id
+ self._status = status
+ self._backup_policy_plan_id = backup_policy_plan_id
self._limit = limit
+ self._sort = sort
+ self._source_id = source_id
+ self._target_snapshots_id = target_snapshots_id
+ self._target_snapshots_crn = target_snapshots_crn
def has_next(self) -> bool:
"""
@@ -170432,15 +175133,21 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of AddressPrefix.
+ :return: A List[dict], where each element is a dict that represents an instance of BackupPolicyJob.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpc_address_prefixes(
- vpc_id=self._vpc_id,
+ result = self._client.list_backup_policy_jobs(
+ backup_policy_id=self._backup_policy_id,
+ status=self._status,
+ backup_policy_plan_id=self._backup_policy_plan_id,
limit=self._limit,
+ sort=self._sort,
+ source_id=self._source_id,
+ target_snapshots_id=self._target_snapshots_id,
+ target_snapshots_crn=self._target_snapshots_crn,
start=self._page_context.get('next'),
).get_result()
@@ -170452,13 +175159,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('address_prefixes')
+ return result.get('jobs')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of AddressPrefix.
+ :return: A List[dict], where each element is a dict that represents an instance of BackupPolicyJob.
:rtype: List[dict]
"""
results = []
@@ -170468,52 +175175,122 @@ def get_all(self) -> List[dict]:
return results
-class VpcDnsResolutionBindingsPager:
+class BareMetalServerProfilesPager:
"""
- VpcDnsResolutionBindingsPager can be used to simplify the use of the "list_vpc_dns_resolution_bindings" method.
+ BareMetalServerProfilesPager can be used to simplify the use of the "list_bare_metal_server_profiles" method.
+ """
+
+ def __init__(
+ self,
+ *,
+ client: VpcV1,
+ limit: int = None,
+ ) -> None:
+ """
+ Initialize a BareMetalServerProfilesPager object.
+ :param int limit: (optional) The number of resources to return on a page.
+ """
+ self._has_next = True
+ self._client = client
+ self._page_context = {'next': None}
+ self._limit = limit
+
+ def has_next(self) -> bool:
+ """
+ Returns true if there are potentially more results to be retrieved.
+ """
+ return self._has_next
+
+ def get_next(self) -> List[dict]:
+ """
+ Returns the next page of results.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerProfile.
+ :rtype: List[dict]
+ """
+ if not self.has_next():
+ raise StopIteration(message='No more results available')
+
+ result = self._client.list_bare_metal_server_profiles(
+ limit=self._limit,
+ start=self._page_context.get('next'),
+ ).get_result()
+
+ next = None
+ next_page_link = result.get('next')
+ if next_page_link is not None:
+ next = get_query_param(next_page_link.get('href'), 'start')
+ self._page_context['next'] = next
+ if next is None:
+ self._has_next = False
+
+ return result.get('profiles')
+
+ def get_all(self) -> List[dict]:
+ """
+ Returns all results by invoking get_next() repeatedly
+ until all pages of results have been retrieved.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerProfile.
+ :rtype: List[dict]
+ """
+ results = []
+ while self.has_next():
+ next_page = self.get_next()
+ results.extend(next_page)
+ return results
+
+
+class BareMetalServersPager:
+ """
+ BareMetalServersPager can be used to simplify the use of the "list_bare_metal_servers" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpc_id: str,
- sort: str = None,
limit: int = None,
+ resource_group_id: str = None,
name: str = None,
+ reservation_id: str = None,
+ reservation_crn: str = None,
+ reservation_name: str = None,
+ vpc_id: str = None,
vpc_crn: str = None,
vpc_name: str = None,
- account_id: str = None,
) -> None:
"""
- Initialize a VpcDnsResolutionBindingsPager object.
- :param str vpc_id: The VPC 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.
+ Initialize a BareMetalServersPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
+ :param str reservation_id: (optional) Filters the collection to resources
+ with a `reservation.id` property matching the specified identifier.
+ :param str reservation_crn: (optional) Filters the collection to resources
+ with a `reservation.crn` property matching the specified identifier.
+ :param str reservation_name: (optional) Filters the collection to resources
+ with a `reservation.name` property matching the specified identifier.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
:param str vpc_crn: (optional) Filters the collection to resources with a
`vpc.crn` property matching the specified CRN.
:param str vpc_name: (optional) Filters the collection to resources with a
`vpc.name` property matching the exact specified name.
- :param str account_id: (optional) Filters the collection to resources with
- a `vpc.remote.account.id` property matching the specified account
- identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpc_id = vpc_id
- self._sort = sort
self._limit = limit
+ self._resource_group_id = resource_group_id
self._name = name
+ self._reservation_id = reservation_id
+ self._reservation_crn = reservation_crn
+ self._reservation_name = reservation_name
+ self._vpc_id = vpc_id
self._vpc_crn = vpc_crn
self._vpc_name = vpc_name
- self._account_id = account_id
def has_next(self) -> bool:
"""
@@ -170524,20 +175301,22 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPCDNSResolutionBinding.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServer.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpc_dns_resolution_bindings(
- vpc_id=self._vpc_id,
- sort=self._sort,
+ result = self._client.list_bare_metal_servers(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
name=self._name,
+ reservation_id=self._reservation_id,
+ reservation_crn=self._reservation_crn,
+ reservation_name=self._reservation_name,
+ vpc_id=self._vpc_id,
vpc_crn=self._vpc_crn,
vpc_name=self._vpc_name,
- account_id=self._account_id,
start=self._page_context.get('next'),
).get_result()
@@ -170549,13 +175328,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('dns_resolution_bindings')
+ return result.get('bare_metal_servers')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPCDNSResolutionBinding.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServer.
:rtype: List[dict]
"""
results = []
@@ -170565,31 +175344,27 @@ def get_all(self) -> List[dict]:
return results
-class VpcRoutesPager:
+class BareMetalServerNetworkAttachmentsPager:
"""
- VpcRoutesPager can be used to simplify the use of the "list_vpc_routes" method.
+ BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "list_bare_metal_server_network_attachments" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpc_id: str,
- zone_name: str = None,
+ bare_metal_server_id: str,
limit: int = None,
) -> None:
"""
- Initialize a VpcRoutesPager object.
- :param str vpc_id: The VPC identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
+ Initialize a BareMetalServerNetworkAttachmentsPager object.
+ :param str bare_metal_server_id: The bare metal server identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpc_id = vpc_id
- self._zone_name = zone_name
+ self._bare_metal_server_id = bare_metal_server_id
self._limit = limit
def has_next(self) -> bool:
@@ -170601,15 +175376,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Route.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkAttachment.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpc_routes(
- vpc_id=self._vpc_id,
- zone_name=self._zone_name,
+ result = self._client.list_bare_metal_server_network_attachments(
+ bare_metal_server_id=self._bare_metal_server_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -170622,13 +175396,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('routes')
+ return result.get('network_attachments')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Route.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkAttachment.
:rtype: List[dict]
"""
results = []
@@ -170638,32 +175412,28 @@ def get_all(self) -> List[dict]:
return results
-class VpcRoutingTablesPager:
+class BareMetalServerNetworkInterfacesPager:
"""
- VpcRoutingTablesPager can be used to simplify the use of the "list_vpc_routing_tables" method.
+ BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "list_bare_metal_server_network_interfaces" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpc_id: str,
+ bare_metal_server_id: str,
limit: int = None,
- is_default: bool = None,
) -> None:
"""
- Initialize a VpcRoutingTablesPager object.
- :param str vpc_id: The VPC identifier.
+ Initialize a BareMetalServerNetworkInterfacesPager object.
+ :param str bare_metal_server_id: The bare metal server identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param bool is_default: (optional) Filters the collection to routing tables
- with an `is_default` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpc_id = vpc_id
+ self._bare_metal_server_id = bare_metal_server_id
self._limit = limit
- self._is_default = is_default
def has_next(self) -> bool:
"""
@@ -170674,16 +175444,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of RoutingTable.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkInterface.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpc_routing_tables(
- vpc_id=self._vpc_id,
+ result = self._client.list_bare_metal_server_network_interfaces(
+ bare_metal_server_id=self._bare_metal_server_id,
limit=self._limit,
- is_default=self._is_default,
start=self._page_context.get('next'),
).get_result()
@@ -170695,13 +175464,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('routing_tables')
+ return result.get('network_interfaces')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of RoutingTable.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkInterface.
:rtype: List[dict]
"""
results = []
@@ -170711,30 +175480,24 @@ def get_all(self) -> List[dict]:
return results
-class VpcRoutingTableRoutesPager:
+class ClusterNetworkProfilesPager:
"""
- VpcRoutingTableRoutesPager can be used to simplify the use of the "list_vpc_routing_table_routes" method.
+ ClusterNetworkProfilesPager can be used to simplify the use of the "list_cluster_network_profiles" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpc_id: str,
- routing_table_id: str,
limit: int = None,
) -> None:
"""
- Initialize a VpcRoutingTableRoutesPager object.
- :param str vpc_id: The VPC identifier.
- :param str routing_table_id: The routing table identifier.
+ Initialize a ClusterNetworkProfilesPager object.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpc_id = vpc_id
- self._routing_table_id = routing_table_id
self._limit = limit
def has_next(self) -> bool:
@@ -170746,15 +175509,13 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Route.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkProfile.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpc_routing_table_routes(
- vpc_id=self._vpc_id,
- routing_table_id=self._routing_table_id,
+ result = self._client.list_cluster_network_profiles(
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -170767,13 +175528,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('routes')
+ return result.get('profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Route.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkProfile.
:rtype: List[dict]
"""
results = []
@@ -170783,9 +175544,9 @@ def get_all(self) -> List[dict]:
return results
-class SubnetsPager:
+class ClusterNetworksPager:
"""
- SubnetsPager can be used to simplify the use of the "list_subnets" method.
+ ClusterNetworksPager can be used to simplify the use of the "list_cluster_networks" method.
"""
def __init__(
@@ -170794,43 +175555,42 @@ def __init__(
client: VpcV1,
limit: int = None,
resource_group_id: str = None,
- zone_name: str = None,
+ name: str = None,
+ sort: str = None,
vpc_id: str = None,
vpc_crn: str = None,
vpc_name: str = None,
- routing_table_id: str = None,
- routing_table_name: str = None,
) -> None:
"""
- Initialize a SubnetsPager object.
+ Initialize a ClusterNetworksPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
- :param str routing_table_id: (optional) Filters the collection to subnets
- with a `routing_table.id` property matching the specified identifier.
- :param str routing_table_name: (optional) Filters the collection to subnets
- with a `routing_table.name` property matching the exact specified name.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :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 str vpc_id: (optional) Filters the collection to cluster networks
+ with a `vpc.id` property matching the specified id.
+ :param str vpc_crn: (optional) Filters the collection to cluster networks
+ with a `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to cluster networks
+ with a `vpc.name` property matching the specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
self._resource_group_id = resource_group_id
- self._zone_name = zone_name
+ self._name = name
+ self._sort = sort
self._vpc_id = vpc_id
self._vpc_crn = vpc_crn
self._vpc_name = vpc_name
- self._routing_table_id = routing_table_id
- self._routing_table_name = routing_table_name
def has_next(self) -> bool:
"""
@@ -170841,21 +175601,20 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Subnet.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetwork.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_subnets(
+ result = self._client.list_cluster_networks(
limit=self._limit,
resource_group_id=self._resource_group_id,
- zone_name=self._zone_name,
+ name=self._name,
+ sort=self._sort,
vpc_id=self._vpc_id,
vpc_crn=self._vpc_crn,
vpc_name=self._vpc_name,
- routing_table_id=self._routing_table_id,
- routing_table_name=self._routing_table_name,
start=self._page_context.get('next'),
).get_result()
@@ -170867,13 +175626,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('subnets')
+ return result.get('cluster_networks')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Subnet.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetwork.
:rtype: List[dict]
"""
results = []
@@ -170883,52 +175642,39 @@ def get_all(self) -> List[dict]:
return results
-class SubnetReservedIpsPager:
+class ClusterNetworkInterfacesPager:
"""
- SubnetReservedIpsPager can be used to simplify the use of the "list_subnet_reserved_ips" method.
+ ClusterNetworkInterfacesPager can be used to simplify the use of the "list_cluster_network_interfaces" method.
"""
def __init__(
self,
*,
client: VpcV1,
- subnet_id: str,
+ cluster_network_id: str,
limit: int = None,
+ name: str = None,
sort: str = None,
- target_id: str = None,
- target_crn: str = None,
- target_name: str = None,
- target_resource_type: str = None,
) -> None:
"""
- Initialize a SubnetReservedIpsPager object.
- :param str subnet_id: The subnet identifier.
+ Initialize a ClusterNetworkInterfacesPager object.
+ :param str cluster_network_id: The cluster network identifier.
:param int limit: (optional) The number of resources to return on a page.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
: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 str target_id: (optional) Filters the collection to resources with a
- `target.id` property matching the specified identifier.
- :param str target_crn: (optional) Filters the collection to resources with
- a `target.crn` property matching the specified CRN.
- :param str target_name: (optional) Filters the collection to resources with
- a `target.name` property matching the exact specified name.
- :param str target_resource_type: (optional) Filters the collection to
- resources with a `target.resource_type` property matching the specified
- value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._subnet_id = subnet_id
+ self._cluster_network_id = cluster_network_id
self._limit = limit
+ self._name = name
self._sort = sort
- self._target_id = target_id
- self._target_crn = target_crn
- self._target_name = target_name
- self._target_resource_type = target_resource_type
def has_next(self) -> bool:
"""
@@ -170939,20 +175685,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkInterface.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_subnet_reserved_ips(
- subnet_id=self._subnet_id,
+ result = self._client.list_cluster_network_interfaces(
+ cluster_network_id=self._cluster_network_id,
limit=self._limit,
+ name=self._name,
sort=self._sort,
- target_id=self._target_id,
- target_crn=self._target_crn,
- target_name=self._target_name,
- target_resource_type=self._target_resource_type,
start=self._page_context.get('next'),
).get_result()
@@ -170964,13 +175707,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('reserved_ips')
+ return result.get('interfaces')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkInterface.
:rtype: List[dict]
"""
results = []
@@ -170980,55 +175723,39 @@ def get_all(self) -> List[dict]:
return results
-class ImagesPager:
+class ClusterNetworkSubnetsPager:
"""
- ImagesPager can be used to simplify the use of the "list_images" method.
+ ClusterNetworkSubnetsPager can be used to simplify the use of the "list_cluster_network_subnets" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ cluster_network_id: str,
limit: int = None,
- resource_group_id: str = None,
name: str = None,
- status: List[str] = None,
- visibility: str = None,
- user_data_format: List[str] = None,
- remote_account_id: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a ImagesPager object.
+ Initialize a ClusterNetworkSubnetsPager object.
+ :param str cluster_network_id: The cluster network identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
- :param List[str] status: (optional) Filters the collection to images with a
- `status` property matching one of the specified comma-separated values.
- :param str visibility: (optional) Filters the collection to images with a
- `visibility` property matching the specified value.
- :param List[str] user_data_format: (optional) Filters the collection to
- images with a `user_data_format` property matching one of the specified
- comma-separated values.
- :param str remote_account_id: (optional) Filters the collection to images
- with a `remote.account.id` property matching the specified account
- identifier.
- This parameter also supports the values null and not:null which filter the
- collection to resources which have no remote account identifier or any
- remote account identifier, respectively.
+ :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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._cluster_network_id = cluster_network_id
self._limit = limit
- self._resource_group_id = resource_group_id
self._name = name
- self._status = status
- self._visibility = visibility
- self._user_data_format = user_data_format
- self._remote_account_id = remote_account_id
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -171039,20 +175766,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Image.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnet.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_images(
+ result = self._client.list_cluster_network_subnets(
+ cluster_network_id=self._cluster_network_id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
name=self._name,
- status=self._status,
- visibility=self._visibility,
- user_data_format=self._user_data_format,
- remote_account_id=self._remote_account_id,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -171064,13 +175788,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('images')
+ return result.get('subnets')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Image.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnet.
:rtype: List[dict]
"""
results = []
@@ -171080,25 +175804,43 @@ def get_all(self) -> List[dict]:
return results
-class OperatingSystemsPager:
+class ClusterNetworkSubnetReservedIpsPager:
"""
- OperatingSystemsPager can be used to simplify the use of the "list_operating_systems" method.
+ ClusterNetworkSubnetReservedIpsPager can be used to simplify the use of the "list_cluster_network_subnet_reserved_ips" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ cluster_network_id: str,
+ cluster_network_subnet_id: str,
limit: int = None,
+ name: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a OperatingSystemsPager object.
+ Initialize a ClusterNetworkSubnetReservedIpsPager object.
+ :param str cluster_network_id: The cluster network identifier.
+ :param str cluster_network_subnet_id: The cluster network subnet
+ identifier.
:param int limit: (optional) The number of resources to return on a page.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._cluster_network_id = cluster_network_id
+ self._cluster_network_subnet_id = cluster_network_subnet_id
self._limit = limit
+ self._name = name
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -171109,14 +175851,18 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of OperatingSystem.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnetReservedIP.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_operating_systems(
+ result = self._client.list_cluster_network_subnet_reserved_ips(
+ cluster_network_id=self._cluster_network_id,
+ cluster_network_subnet_id=self._cluster_network_subnet_id,
limit=self._limit,
+ name=self._name,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -171128,13 +175874,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('operating_systems')
+ return result.get('reserved_ips')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of OperatingSystem.
+ :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnetReservedIP.
:rtype: List[dict]
"""
results = []
@@ -171144,9 +175890,9 @@ def get_all(self) -> List[dict]:
return results
-class KeysPager:
+class DedicatedHostGroupsPager:
"""
- KeysPager can be used to simplify the use of the "list_keys" method.
+ DedicatedHostGroupsPager can be used to simplify the use of the "list_dedicated_host_groups" method.
"""
def __init__(
@@ -171155,19 +175901,27 @@ def __init__(
client: VpcV1,
limit: int = None,
resource_group_id: str = None,
+ zone_name: str = None,
+ name: str = None,
) -> None:
"""
- Initialize a KeysPager object.
+ Initialize a DedicatedHostGroupsPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
self._resource_group_id = resource_group_id
+ self._zone_name = zone_name
+ self._name = name
def has_next(self) -> bool:
"""
@@ -171178,15 +175932,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Key.
+ :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostGroup.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_keys(
+ result = self._client.list_dedicated_host_groups(
limit=self._limit,
resource_group_id=self._resource_group_id,
+ zone_name=self._zone_name,
+ name=self._name,
start=self._page_context.get('next'),
).get_result()
@@ -171198,13 +175954,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('keys')
+ return result.get('groups')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Key.
+ :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostGroup.
:rtype: List[dict]
"""
results = []
@@ -171214,9 +175970,9 @@ def get_all(self) -> List[dict]:
return results
-class InstancesPager:
+class DedicatedHostProfilesPager:
"""
- InstancesPager can be used to simplify the use of the "list_instances" method.
+ DedicatedHostProfilesPager can be used to simplify the use of the "list_dedicated_host_profiles" method.
"""
def __init__(
@@ -171224,96 +175980,97 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ ) -> None:
+ """
+ Initialize a DedicatedHostProfilesPager object.
+ :param int limit: (optional) The number of resources to return on a page.
+ """
+ self._has_next = True
+ self._client = client
+ self._page_context = {'next': None}
+ self._limit = limit
+
+ def has_next(self) -> bool:
+ """
+ Returns true if there are potentially more results to be retrieved.
+ """
+ return self._has_next
+
+ def get_next(self) -> List[dict]:
+ """
+ Returns the next page of results.
+ :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostProfile.
+ :rtype: List[dict]
+ """
+ if not self.has_next():
+ raise StopIteration(message='No more results available')
+
+ result = self._client.list_dedicated_host_profiles(
+ limit=self._limit,
+ start=self._page_context.get('next'),
+ ).get_result()
+
+ next = None
+ next_page_link = result.get('next')
+ if next_page_link is not None:
+ next = get_query_param(next_page_link.get('href'), 'start')
+ self._page_context['next'] = next
+ if next is None:
+ self._has_next = False
+
+ return result.get('profiles')
+
+ def get_all(self) -> List[dict]:
+ """
+ Returns all results by invoking get_next() repeatedly
+ until all pages of results have been retrieved.
+ :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostProfile.
+ :rtype: List[dict]
+ """
+ results = []
+ while self.has_next():
+ next_page = self.get_next()
+ results.extend(next_page)
+ return results
+
+
+class DedicatedHostsPager:
+ """
+ DedicatedHostsPager can be used to simplify the use of the "list_dedicated_hosts" method.
+ """
+
+ def __init__(
+ self,
+ *,
+ client: VpcV1,
+ dedicated_host_group_id: str = None,
+ limit: int = None,
resource_group_id: str = None,
+ zone_name: str = None,
name: str = None,
- cluster_network_id: str = None,
- cluster_network_crn: str = None,
- cluster_network_name: str = None,
- dedicated_host_id: str = None,
- dedicated_host_crn: str = None,
- dedicated_host_name: str = None,
- placement_group_id: str = None,
- placement_group_crn: str = None,
- placement_group_name: str = None,
- reservation_affinity_policy: str = None,
- reservation_id: str = None,
- reservation_crn: str = None,
- reservation_name: str = None,
- vpc_id: str = None,
- vpc_crn: str = None,
- vpc_name: str = None,
) -> None:
"""
- Initialize a InstancesPager object.
+ Initialize a DedicatedHostsPager object.
+ :param str dedicated_host_group_id: (optional) Filters the collection to
+ dedicated hosts with a `group.id` property matching the specified
+ identifier.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
- :param str cluster_network_id: (optional) Filters the collection to
- instances with a `cluster_network.id` property matching the specified
- identifier.
- :param str cluster_network_crn: (optional) Filters the collection to
- instances with a `cluster_network.crn` property matching the specified CRN.
- :param str cluster_network_name: (optional) Filters the collection to
- resources with a `cluster_network.name` property matching the exact
- specified name.
- :param str dedicated_host_id: (optional) Filters the collection to
- resources with a `dedicated_host.id` property matching the specified
- identifier.
- :param str dedicated_host_crn: (optional) Filters the collection to
- resources with a `dedicated_host.crn` property matching the specified CRN.
- :param str dedicated_host_name: (optional) Filters the collection to
- resources with a `dedicated_host.name` property matching the exact
- specified name.
- :param str placement_group_id: (optional) Filters the collection to
- resources with a `placement_target.id` property matching the specified
- placement group identifier.
- :param str placement_group_crn: (optional) Filters the collection to
- resources with a `placement_target.crn` property matching the specified
- placement group CRN.
- :param str placement_group_name: (optional) Filters the collection to
- resources with a `placement_target.name` property matching the exact
- specified placement group name.
- :param str reservation_affinity_policy: (optional) Filters the collection
- to instances with a `reservation_affinity.policy` property matching the
- specified value.
- :param str reservation_id: (optional) Filters the collection to resources
- with a `reservation.id` property matching the specified identifier.
- :param str reservation_crn: (optional) Filters the collection to resources
- with a `reservation.crn` property matching the specified identifier.
- :param str reservation_name: (optional) Filters the collection to resources
- with a `reservation.name` property matching the specified identifier.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._dedicated_host_group_id = dedicated_host_group_id
self._limit = limit
self._resource_group_id = resource_group_id
+ self._zone_name = zone_name
self._name = name
- self._cluster_network_id = cluster_network_id
- self._cluster_network_crn = cluster_network_crn
- self._cluster_network_name = cluster_network_name
- self._dedicated_host_id = dedicated_host_id
- self._dedicated_host_crn = dedicated_host_crn
- self._dedicated_host_name = dedicated_host_name
- self._placement_group_id = placement_group_id
- self._placement_group_crn = placement_group_crn
- self._placement_group_name = placement_group_name
- self._reservation_affinity_policy = reservation_affinity_policy
- self._reservation_id = reservation_id
- self._reservation_crn = reservation_crn
- self._reservation_name = reservation_name
- self._vpc_id = vpc_id
- self._vpc_crn = vpc_crn
- self._vpc_name = vpc_name
def has_next(self) -> bool:
"""
@@ -171324,32 +176081,18 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Instance.
+ :return: A List[dict], where each element is a dict that represents an instance of DedicatedHost.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instances(
+ result = self._client.list_dedicated_hosts(
+ dedicated_host_group_id=self._dedicated_host_group_id,
limit=self._limit,
resource_group_id=self._resource_group_id,
+ zone_name=self._zone_name,
name=self._name,
- cluster_network_id=self._cluster_network_id,
- cluster_network_crn=self._cluster_network_crn,
- cluster_network_name=self._cluster_network_name,
- dedicated_host_id=self._dedicated_host_id,
- dedicated_host_crn=self._dedicated_host_crn,
- dedicated_host_name=self._dedicated_host_name,
- placement_group_id=self._placement_group_id,
- placement_group_crn=self._placement_group_crn,
- placement_group_name=self._placement_group_name,
- reservation_affinity_policy=self._reservation_affinity_policy,
- reservation_id=self._reservation_id,
- reservation_crn=self._reservation_crn,
- reservation_name=self._reservation_name,
- vpc_id=self._vpc_id,
- vpc_crn=self._vpc_crn,
- vpc_name=self._vpc_name,
start=self._page_context.get('next'),
).get_result()
@@ -171361,13 +176104,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('instances')
+ return result.get('dedicated_hosts')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Instance.
+ :return: A List[dict], where each element is a dict that represents an instance of DedicatedHost.
:rtype: List[dict]
"""
results = []
@@ -171377,28 +176120,56 @@ def get_all(self) -> List[dict]:
return results
-class InstanceClusterNetworkAttachmentsPager:
+class EndpointGatewaysPager:
"""
- InstanceClusterNetworkAttachmentsPager can be used to simplify the use of the "list_instance_cluster_network_attachments" method.
+ EndpointGatewaysPager can be used to simplify the use of the "list_endpoint_gateways" method.
"""
def __init__(
self,
*,
client: VpcV1,
- instance_id: str,
+ name: str = None,
limit: int = None,
+ resource_group_id: str = None,
+ lifecycle_state: List[str] = None,
+ vpc_id: str = None,
+ vpc_crn: str = None,
+ vpc_name: str = None,
+ allow_dns_resolution_binding: bool = None,
) -> None:
"""
- Initialize a InstanceClusterNetworkAttachmentsPager object.
- :param str instance_id: The virtual server instance identifier.
+ Initialize a EndpointGatewaysPager object.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param List[str] lifecycle_state: (optional) Filters the collection to
+ resources with a `lifecycle_state` property matching one of the specified
+ comma-separated values.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param bool allow_dns_resolution_binding: (optional) Filters the collection
+ to endpoint gateways with an `allow_dns_resolution_binding` property
+ matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._instance_id = instance_id
+ self._name = name
self._limit = limit
+ self._resource_group_id = resource_group_id
+ self._lifecycle_state = lifecycle_state
+ self._vpc_id = vpc_id
+ self._vpc_crn = vpc_crn
+ self._vpc_name = vpc_name
+ self._allow_dns_resolution_binding = allow_dns_resolution_binding
def has_next(self) -> bool:
"""
@@ -171409,15 +176180,21 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceClusterNetworkAttachment.
+ :return: A List[dict], where each element is a dict that represents an instance of EndpointGateway.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_cluster_network_attachments(
- instance_id=self._instance_id,
+ result = self._client.list_endpoint_gateways(
+ name=self._name,
limit=self._limit,
+ resource_group_id=self._resource_group_id,
+ lifecycle_state=self._lifecycle_state,
+ vpc_id=self._vpc_id,
+ vpc_crn=self._vpc_crn,
+ vpc_name=self._vpc_name,
+ allow_dns_resolution_binding=self._allow_dns_resolution_binding,
start=self._page_context.get('next'),
).get_result()
@@ -171429,13 +176206,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('cluster_network_attachments')
+ return result.get('endpoint_gateways')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceClusterNetworkAttachment.
+ :return: A List[dict], where each element is a dict that represents an instance of EndpointGateway.
:rtype: List[dict]
"""
results = []
@@ -171445,31 +176222,35 @@ def get_all(self) -> List[dict]:
return results
-class InstanceNetworkInterfaceIpsPager:
+class EndpointGatewayIpsPager:
"""
- InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "list_instance_network_interface_ips" method.
+ EndpointGatewayIpsPager can be used to simplify the use of the "list_endpoint_gateway_ips" method.
"""
def __init__(
self,
*,
client: VpcV1,
- instance_id: str,
- network_interface_id: str,
+ endpoint_gateway_id: str,
limit: int = None,
+ sort: str = None,
) -> None:
"""
- Initialize a InstanceNetworkInterfaceIpsPager object.
- :param str instance_id: The virtual server instance identifier.
- :param str network_interface_id: The instance network interface identifier.
+ Initialize a EndpointGatewayIpsPager object.
+ :param str endpoint_gateway_id: The endpoint gateway identifier.
: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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._instance_id = instance_id
- self._network_interface_id = network_interface_id
+ self._endpoint_gateway_id = endpoint_gateway_id
self._limit = limit
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -171486,10 +176267,10 @@ def get_next(self) -> List[dict]:
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_network_interface_ips(
- instance_id=self._instance_id,
- network_interface_id=self._network_interface_id,
+ result = self._client.list_endpoint_gateway_ips(
+ endpoint_gateway_id=self._endpoint_gateway_id,
limit=self._limit,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -171517,9 +176298,9 @@ def get_all(self) -> List[dict]:
return results
-class InstanceGroupsPager:
+class FloatingIpsPager:
"""
- InstanceGroupsPager can be used to simplify the use of the "list_instance_groups" method.
+ FloatingIpsPager can be used to simplify the use of the "list_floating_ips" method.
"""
def __init__(
@@ -171527,15 +176308,44 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ resource_group_id: str = None,
+ sort: str = None,
+ target_id: str = None,
+ target_crn: str = None,
+ target_name: str = None,
+ target_resource_type: str = None,
) -> None:
"""
- Initialize a InstanceGroupsPager object.
+ Initialize a FloatingIpsPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching 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 str target_id: (optional) Filters the collection to resources with a
+ `target.id` property matching the specified identifier.
+ :param str target_crn: (optional) Filters the collection to resources with
+ a `target.crn` property matching the specified CRN.
+ :param str target_name: (optional) Filters the collection to resources with
+ a `target.name` property matching the exact specified name.
+ :param str target_resource_type: (optional) Filters the collection to
+ resources with a `target.resource_type` property matching the specified
+ value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
+ self._resource_group_id = resource_group_id
+ self._sort = sort
+ self._target_id = target_id
+ self._target_crn = target_crn
+ self._target_name = target_name
+ self._target_resource_type = target_resource_type
def has_next(self) -> bool:
"""
@@ -171546,14 +176356,20 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of FloatingIP.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_groups(
+ result = self._client.list_floating_ips(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
+ sort=self._sort,
+ target_id=self._target_id,
+ target_crn=self._target_crn,
+ target_name=self._target_name,
+ target_resource_type=self._target_resource_type,
start=self._page_context.get('next'),
).get_result()
@@ -171565,13 +176381,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('instance_groups')
+ return result.get('floating_ips')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of FloatingIP.
:rtype: List[dict]
"""
results = []
@@ -171581,28 +176397,55 @@ def get_all(self) -> List[dict]:
return results
-class InstanceGroupManagersPager:
+class FlowLogCollectorsPager:
"""
- InstanceGroupManagersPager can be used to simplify the use of the "list_instance_group_managers" method.
+ FlowLogCollectorsPager can be used to simplify the use of the "list_flow_log_collectors" method.
"""
def __init__(
self,
*,
client: VpcV1,
- instance_group_id: str,
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,
) -> None:
"""
- Initialize a InstanceGroupManagersPager object.
- :param str instance_group_id: The instance group identifier.
+ Initialize a FlowLogCollectorsPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param str target_id: (optional) Filters the collection to resources with a
+ `target.id` property matching the specified identifier.
+ :param str target_resource_type: (optional) Filters the collection to
+ resources with a `target.resource_type` property matching the specified
+ value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._instance_group_id = instance_group_id
self._limit = limit
+ self._resource_group_id = resource_group_id
+ self._name = name
+ self._vpc_id = vpc_id
+ self._vpc_crn = vpc_crn
+ self._vpc_name = vpc_name
+ self._target_id = target_id
+ self._target_resource_type = target_resource_type
def has_next(self) -> bool:
"""
@@ -171613,15 +176456,21 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManager.
+ :return: A List[dict], where each element is a dict that represents an instance of FlowLogCollector.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_group_managers(
- instance_group_id=self._instance_group_id,
+ result = self._client.list_flow_log_collectors(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
+ name=self._name,
+ vpc_id=self._vpc_id,
+ vpc_crn=self._vpc_crn,
+ vpc_name=self._vpc_name,
+ target_id=self._target_id,
+ target_resource_type=self._target_resource_type,
start=self._page_context.get('next'),
).get_result()
@@ -171633,13 +176482,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('managers')
+ return result.get('flow_log_collectors')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManager.
+ :return: A List[dict], where each element is a dict that represents an instance of FlowLogCollector.
:rtype: List[dict]
"""
results = []
@@ -171649,32 +176498,55 @@ def get_all(self) -> List[dict]:
return results
-class InstanceGroupManagerActionsPager:
+class ImagesPager:
"""
- InstanceGroupManagerActionsPager can be used to simplify the use of the "list_instance_group_manager_actions" method.
+ ImagesPager can be used to simplify the use of the "list_images" method.
"""
def __init__(
self,
*,
client: VpcV1,
- instance_group_id: str,
- instance_group_manager_id: str,
limit: int = None,
+ resource_group_id: str = None,
+ name: str = None,
+ status: List[str] = None,
+ visibility: str = None,
+ user_data_format: List[str] = None,
+ remote_account_id: str = None,
) -> None:
"""
- Initialize a InstanceGroupManagerActionsPager object.
- :param str instance_group_id: The instance group identifier.
- :param str instance_group_manager_id: The instance group manager
- identifier.
+ Initialize a ImagesPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param List[str] status: (optional) Filters the collection to images with a
+ `status` property matching one of the specified comma-separated values.
+ :param str visibility: (optional) Filters the collection to images with a
+ `visibility` property matching the specified value.
+ :param List[str] user_data_format: (optional) Filters the collection to
+ images with a `user_data_format` property matching one of the specified
+ comma-separated values.
+ :param str remote_account_id: (optional) Filters the collection to images
+ with a `remote.account.id` property matching the specified account
+ identifier.
+ This parameter also supports the values null and not:null which filter the
+ collection to resources which have no remote account identifier or any
+ remote account identifier, respectively.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._instance_group_id = instance_group_id
- self._instance_group_manager_id = instance_group_manager_id
self._limit = limit
+ self._resource_group_id = resource_group_id
+ self._name = name
+ self._status = status
+ self._visibility = visibility
+ self._user_data_format = user_data_format
+ self._remote_account_id = remote_account_id
def has_next(self) -> bool:
"""
@@ -171685,16 +176557,20 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerAction.
+ :return: A List[dict], where each element is a dict that represents an instance of Image.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_group_manager_actions(
- instance_group_id=self._instance_group_id,
- instance_group_manager_id=self._instance_group_manager_id,
+ result = self._client.list_images(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
+ name=self._name,
+ status=self._status,
+ visibility=self._visibility,
+ user_data_format=self._user_data_format,
+ remote_account_id=self._remote_account_id,
start=self._page_context.get('next'),
).get_result()
@@ -171706,13 +176582,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('actions')
+ return result.get('images')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerAction.
+ :return: A List[dict], where each element is a dict that represents an instance of Image.
:rtype: List[dict]
"""
results = []
@@ -171722,31 +176598,27 @@ def get_all(self) -> List[dict]:
return results
-class InstanceGroupManagerPoliciesPager:
+class ImageBareMetalServerProfilesPager:
"""
- InstanceGroupManagerPoliciesPager can be used to simplify the use of the "list_instance_group_manager_policies" method.
+ ImageBareMetalServerProfilesPager can be used to simplify the use of the "list_image_bare_metal_server_profiles" method.
"""
def __init__(
self,
*,
client: VpcV1,
- instance_group_id: str,
- instance_group_manager_id: str,
+ id: str,
limit: int = None,
) -> None:
"""
- Initialize a InstanceGroupManagerPoliciesPager object.
- :param str instance_group_id: The instance group identifier.
- :param str instance_group_manager_id: The instance group manager
- identifier.
+ Initialize a ImageBareMetalServerProfilesPager object.
+ :param str id: The image identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._instance_group_id = instance_group_id
- self._instance_group_manager_id = instance_group_manager_id
+ self._id = id
self._limit = limit
def has_next(self) -> bool:
@@ -171758,15 +176630,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerProfileReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_group_manager_policies(
- instance_group_id=self._instance_group_id,
- instance_group_manager_id=self._instance_group_manager_id,
+ result = self._client.list_image_bare_metal_server_profiles(
+ id=self._id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -171779,13 +176650,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('policies')
+ return result.get('bare_metal_server_profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerProfileReference.
:rtype: List[dict]
"""
results = []
@@ -171795,27 +176666,27 @@ def get_all(self) -> List[dict]:
return results
-class InstanceGroupMembershipsPager:
+class ImageInstanceProfilesPager:
"""
- InstanceGroupMembershipsPager can be used to simplify the use of the "list_instance_group_memberships" method.
+ ImageInstanceProfilesPager can be used to simplify the use of the "list_image_instance_profiles" method.
"""
def __init__(
self,
*,
client: VpcV1,
- instance_group_id: str,
+ id: str,
limit: int = None,
) -> None:
"""
- Initialize a InstanceGroupMembershipsPager object.
- :param str instance_group_id: The instance group identifier.
+ Initialize a ImageInstanceProfilesPager object.
+ :param str id: The image identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._instance_group_id = instance_group_id
+ self._id = id
self._limit = limit
def has_next(self) -> bool:
@@ -171827,14 +176698,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupMembership.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceProfileReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_instance_group_memberships(
- instance_group_id=self._instance_group_id,
+ result = self._client.list_image_instance_profiles(
+ id=self._id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -171847,13 +176718,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('memberships')
+ return result.get('instance_profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupMembership.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceProfileReference.
:rtype: List[dict]
"""
results = []
@@ -171863,9 +176734,9 @@ def get_all(self) -> List[dict]:
return results
-class ReservationsPager:
+class OperatingSystemsPager:
"""
- ReservationsPager can be used to simplify the use of the "list_reservations" method.
+ OperatingSystemsPager can be used to simplify the use of the "list_operating_systems" method.
"""
def __init__(
@@ -171873,38 +176744,15 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
- name: str = None,
- profile_resource_type: str = None,
- affinity_policy: str = None,
- resource_group_id: str = None,
- zone_name: str = None,
) -> None:
"""
- Initialize a ReservationsPager object.
+ Initialize a OperatingSystemsPager object.
:param int limit: (optional) The number of resources to return on a page.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str profile_resource_type: (optional) Filters the collection of
- resources with a `profile.resource_type` property matching the specified
- value.
- :param str affinity_policy: (optional) Filters the collection to
- reservations with an `affinity_policy` property matching the specified
- value.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
- self._name = name
- self._profile_resource_type = profile_resource_type
- self._affinity_policy = affinity_policy
- self._resource_group_id = resource_group_id
- self._zone_name = zone_name
def has_next(self) -> bool:
"""
@@ -171915,19 +176763,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Reservation.
+ :return: A List[dict], where each element is a dict that represents an instance of OperatingSystem.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_reservations(
+ result = self._client.list_operating_systems(
limit=self._limit,
- name=self._name,
- profile_resource_type=self._profile_resource_type,
- affinity_policy=self._affinity_policy,
- resource_group_id=self._resource_group_id,
- zone_name=self._zone_name,
start=self._page_context.get('next'),
).get_result()
@@ -171939,13 +176782,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('reservations')
+ return result.get('operating_systems')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Reservation.
+ :return: A List[dict], where each element is a dict that represents an instance of OperatingSystem.
:rtype: List[dict]
"""
results = []
@@ -171955,9 +176798,9 @@ def get_all(self) -> List[dict]:
return results
-class DedicatedHostGroupsPager:
+class InstanceGroupsPager:
"""
- DedicatedHostGroupsPager can be used to simplify the use of the "list_dedicated_host_groups" method.
+ InstanceGroupsPager can be used to simplify the use of the "list_instance_groups" method.
"""
def __init__(
@@ -171965,28 +176808,15 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
- resource_group_id: str = None,
- zone_name: str = None,
- name: str = None,
) -> None:
"""
- Initialize a DedicatedHostGroupsPager object.
+ Initialize a InstanceGroupsPager object.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
- self._resource_group_id = resource_group_id
- self._zone_name = zone_name
- self._name = name
def has_next(self) -> bool:
"""
@@ -171997,17 +176827,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroup.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_dedicated_host_groups(
+ result = self._client.list_instance_groups(
limit=self._limit,
- resource_group_id=self._resource_group_id,
- zone_name=self._zone_name,
- name=self._name,
start=self._page_context.get('next'),
).get_result()
@@ -172019,13 +176846,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('groups')
+ return result.get('instance_groups')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroup.
:rtype: List[dict]
"""
results = []
@@ -172035,24 +176862,27 @@ def get_all(self) -> List[dict]:
return results
-class DedicatedHostProfilesPager:
+class InstanceGroupManagersPager:
"""
- DedicatedHostProfilesPager can be used to simplify the use of the "list_dedicated_host_profiles" method.
+ InstanceGroupManagersPager can be used to simplify the use of the "list_instance_group_managers" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ instance_group_id: str,
limit: int = None,
) -> None:
"""
- Initialize a DedicatedHostProfilesPager object.
+ Initialize a InstanceGroupManagersPager object.
+ :param str instance_group_id: The instance group identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._instance_group_id = instance_group_id
self._limit = limit
def has_next(self) -> bool:
@@ -172064,13 +176894,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManager.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_dedicated_host_profiles(
+ result = self._client.list_instance_group_managers(
+ instance_group_id=self._instance_group_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -172083,13 +176914,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('profiles')
+ return result.get('managers')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of DedicatedHostProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManager.
:rtype: List[dict]
"""
results = []
@@ -172099,43 +176930,32 @@ def get_all(self) -> List[dict]:
return results
-class DedicatedHostsPager:
+class InstanceGroupManagerActionsPager:
"""
- DedicatedHostsPager can be used to simplify the use of the "list_dedicated_hosts" method.
+ InstanceGroupManagerActionsPager can be used to simplify the use of the "list_instance_group_manager_actions" method.
"""
def __init__(
self,
*,
client: VpcV1,
- dedicated_host_group_id: str = None,
+ instance_group_id: str,
+ instance_group_manager_id: str,
limit: int = None,
- resource_group_id: str = None,
- zone_name: str = None,
- name: str = None,
) -> None:
"""
- Initialize a DedicatedHostsPager object.
- :param str dedicated_host_group_id: (optional) Filters the collection to
- dedicated hosts with a `group.id` property matching the specified
+ Initialize a InstanceGroupManagerActionsPager object.
+ :param str instance_group_id: The instance group identifier.
+ :param str instance_group_manager_id: The instance group manager
identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._dedicated_host_group_id = dedicated_host_group_id
+ self._instance_group_id = instance_group_id
+ self._instance_group_manager_id = instance_group_manager_id
self._limit = limit
- self._resource_group_id = resource_group_id
- self._zone_name = zone_name
- self._name = name
def has_next(self) -> bool:
"""
@@ -172146,18 +176966,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of DedicatedHost.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerAction.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_dedicated_hosts(
- dedicated_host_group_id=self._dedicated_host_group_id,
+ result = self._client.list_instance_group_manager_actions(
+ instance_group_id=self._instance_group_id,
+ instance_group_manager_id=self._instance_group_manager_id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
- zone_name=self._zone_name,
- name=self._name,
start=self._page_context.get('next'),
).get_result()
@@ -172169,13 +176987,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('dedicated_hosts')
+ return result.get('actions')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of DedicatedHost.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerAction.
:rtype: List[dict]
"""
results = []
@@ -172185,24 +177003,31 @@ def get_all(self) -> List[dict]:
return results
-class PlacementGroupsPager:
+class InstanceGroupManagerPoliciesPager:
"""
- PlacementGroupsPager can be used to simplify the use of the "list_placement_groups" method.
+ InstanceGroupManagerPoliciesPager can be used to simplify the use of the "list_instance_group_manager_policies" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ instance_group_id: str,
+ instance_group_manager_id: str,
limit: int = None,
) -> None:
"""
- Initialize a PlacementGroupsPager object.
+ Initialize a InstanceGroupManagerPoliciesPager object.
+ :param str instance_group_id: The instance group identifier.
+ :param str instance_group_manager_id: The instance group manager
+ identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._instance_group_id = instance_group_id
+ self._instance_group_manager_id = instance_group_manager_id
self._limit = limit
def has_next(self) -> bool:
@@ -172214,13 +177039,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of PlacementGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerPolicy.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_placement_groups(
+ result = self._client.list_instance_group_manager_policies(
+ instance_group_id=self._instance_group_id,
+ instance_group_manager_id=self._instance_group_manager_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -172233,13 +177060,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('placement_groups')
+ return result.get('policies')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of PlacementGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupManagerPolicy.
:rtype: List[dict]
"""
results = []
@@ -172249,24 +177076,27 @@ def get_all(self) -> List[dict]:
return results
-class BareMetalServerProfilesPager:
+class InstanceGroupMembershipsPager:
"""
- BareMetalServerProfilesPager can be used to simplify the use of the "list_bare_metal_server_profiles" method.
+ InstanceGroupMembershipsPager can be used to simplify the use of the "list_instance_group_memberships" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ instance_group_id: str,
limit: int = None,
) -> None:
"""
- Initialize a BareMetalServerProfilesPager object.
+ Initialize a InstanceGroupMembershipsPager object.
+ :param str instance_group_id: The instance group identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._instance_group_id = instance_group_id
self._limit = limit
def has_next(self) -> bool:
@@ -172278,13 +177108,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupMembership.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_bare_metal_server_profiles(
+ result = self._client.list_instance_group_memberships(
+ instance_group_id=self._instance_group_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -172297,13 +177128,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('profiles')
+ return result.get('memberships')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceGroupMembership.
:rtype: List[dict]
"""
results = []
@@ -172313,9 +177144,9 @@ def get_all(self) -> List[dict]:
return results
-class BareMetalServersPager:
+class InstancesPager:
"""
- BareMetalServersPager can be used to simplify the use of the "list_bare_metal_servers" method.
+ InstancesPager can be used to simplify the use of the "list_instances" method.
"""
def __init__(
@@ -172325,6 +177156,16 @@ def __init__(
limit: int = None,
resource_group_id: str = None,
name: str = None,
+ cluster_network_id: str = None,
+ cluster_network_crn: str = None,
+ cluster_network_name: str = None,
+ dedicated_host_id: str = None,
+ dedicated_host_crn: str = None,
+ dedicated_host_name: str = None,
+ placement_group_id: str = None,
+ placement_group_crn: str = None,
+ placement_group_name: str = None,
+ reservation_affinity_policy: str = None,
reservation_id: str = None,
reservation_crn: str = None,
reservation_name: str = None,
@@ -172333,13 +177174,41 @@ def __init__(
vpc_name: str = None,
) -> None:
"""
- Initialize a BareMetalServersPager object.
+ Initialize a InstancesPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
+ :param str cluster_network_id: (optional) Filters the collection to
+ instances with a `cluster_network.id` property matching the specified
+ identifier.
+ :param str cluster_network_crn: (optional) Filters the collection to
+ instances with a `cluster_network.crn` property matching the specified CRN.
+ :param str cluster_network_name: (optional) Filters the collection to
+ resources with a `cluster_network.name` property matching the exact
+ specified name.
+ :param str dedicated_host_id: (optional) Filters the collection to
+ resources with a `dedicated_host.id` property matching the specified
+ identifier.
+ :param str dedicated_host_crn: (optional) Filters the collection to
+ resources with a `dedicated_host.crn` property matching the specified CRN.
+ :param str dedicated_host_name: (optional) Filters the collection to
+ resources with a `dedicated_host.name` property matching the exact
+ specified name.
+ :param str placement_group_id: (optional) Filters the collection to
+ resources with a `placement_target.id` property matching the specified
+ placement group identifier.
+ :param str placement_group_crn: (optional) Filters the collection to
+ resources with a `placement_target.crn` property matching the specified
+ placement group CRN.
+ :param str placement_group_name: (optional) Filters the collection to
+ resources with a `placement_target.name` property matching the exact
+ specified placement group name.
+ :param str reservation_affinity_policy: (optional) Filters the collection
+ to instances with a `reservation_affinity.policy` property matching the
+ specified value.
:param str reservation_id: (optional) Filters the collection to resources
with a `reservation.id` property matching the specified identifier.
:param str reservation_crn: (optional) Filters the collection to resources
@@ -172359,6 +177228,16 @@ def __init__(
self._limit = limit
self._resource_group_id = resource_group_id
self._name = name
+ self._cluster_network_id = cluster_network_id
+ self._cluster_network_crn = cluster_network_crn
+ self._cluster_network_name = cluster_network_name
+ self._dedicated_host_id = dedicated_host_id
+ self._dedicated_host_crn = dedicated_host_crn
+ self._dedicated_host_name = dedicated_host_name
+ self._placement_group_id = placement_group_id
+ self._placement_group_crn = placement_group_crn
+ self._placement_group_name = placement_group_name
+ self._reservation_affinity_policy = reservation_affinity_policy
self._reservation_id = reservation_id
self._reservation_crn = reservation_crn
self._reservation_name = reservation_name
@@ -172375,16 +177254,26 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServer.
+ :return: A List[dict], where each element is a dict that represents an instance of Instance.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_bare_metal_servers(
+ result = self._client.list_instances(
limit=self._limit,
resource_group_id=self._resource_group_id,
name=self._name,
+ cluster_network_id=self._cluster_network_id,
+ cluster_network_crn=self._cluster_network_crn,
+ cluster_network_name=self._cluster_network_name,
+ dedicated_host_id=self._dedicated_host_id,
+ dedicated_host_crn=self._dedicated_host_crn,
+ dedicated_host_name=self._dedicated_host_name,
+ placement_group_id=self._placement_group_id,
+ placement_group_crn=self._placement_group_crn,
+ placement_group_name=self._placement_group_name,
+ reservation_affinity_policy=self._reservation_affinity_policy,
reservation_id=self._reservation_id,
reservation_crn=self._reservation_crn,
reservation_name=self._reservation_name,
@@ -172402,13 +177291,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('bare_metal_servers')
+ return result.get('instances')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServer.
+ :return: A List[dict], where each element is a dict that represents an instance of Instance.
:rtype: List[dict]
"""
results = []
@@ -172418,27 +177307,27 @@ def get_all(self) -> List[dict]:
return results
-class BareMetalServerNetworkAttachmentsPager:
+class InstanceClusterNetworkAttachmentsPager:
"""
- BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "list_bare_metal_server_network_attachments" method.
+ InstanceClusterNetworkAttachmentsPager can be used to simplify the use of the "list_instance_cluster_network_attachments" method.
"""
def __init__(
self,
*,
client: VpcV1,
- bare_metal_server_id: str,
+ instance_id: str,
limit: int = None,
) -> None:
"""
- Initialize a BareMetalServerNetworkAttachmentsPager object.
- :param str bare_metal_server_id: The bare metal server identifier.
+ Initialize a InstanceClusterNetworkAttachmentsPager object.
+ :param str instance_id: The virtual server instance identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._bare_metal_server_id = bare_metal_server_id
+ self._instance_id = instance_id
self._limit = limit
def has_next(self) -> bool:
@@ -172450,14 +177339,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkAttachment.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceClusterNetworkAttachment.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_bare_metal_server_network_attachments(
- bare_metal_server_id=self._bare_metal_server_id,
+ result = self._client.list_instance_cluster_network_attachments(
+ instance_id=self._instance_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -172470,13 +177359,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('network_attachments')
+ return result.get('cluster_network_attachments')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkAttachment.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceClusterNetworkAttachment.
:rtype: List[dict]
"""
results = []
@@ -172486,27 +177375,30 @@ def get_all(self) -> List[dict]:
return results
-class BareMetalServerNetworkInterfacesPager:
+class InstanceNetworkInterfaceIpsPager:
"""
- BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "list_bare_metal_server_network_interfaces" method.
+ InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "list_instance_network_interface_ips" method.
"""
def __init__(
self,
*,
client: VpcV1,
- bare_metal_server_id: str,
+ instance_id: str,
+ network_interface_id: str,
limit: int = None,
) -> None:
"""
- Initialize a BareMetalServerNetworkInterfacesPager object.
- :param str bare_metal_server_id: The bare metal server identifier.
+ Initialize a InstanceNetworkInterfaceIpsPager object.
+ :param str instance_id: The virtual server instance identifier.
+ :param str network_interface_id: The instance network interface identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._bare_metal_server_id = bare_metal_server_id
+ self._instance_id = instance_id
+ self._network_interface_id = network_interface_id
self._limit = limit
def has_next(self) -> bool:
@@ -172518,14 +177410,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkInterface.
+ :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_bare_metal_server_network_interfaces(
- bare_metal_server_id=self._bare_metal_server_id,
+ result = self._client.list_instance_network_interface_ips(
+ instance_id=self._instance_id,
+ network_interface_id=self._network_interface_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -172538,13 +177431,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('network_interfaces')
+ return result.get('ips')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of BareMetalServerNetworkInterface.
+ :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
:rtype: List[dict]
"""
results = []
@@ -172554,9 +177447,9 @@ def get_all(self) -> List[dict]:
return results
-class VolumeProfilesPager:
+class KeysPager:
"""
- VolumeProfilesPager can be used to simplify the use of the "list_volume_profiles" method.
+ KeysPager can be used to simplify the use of the "list_keys" method.
"""
def __init__(
@@ -172564,15 +177457,20 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ resource_group_id: str = None,
) -> None:
"""
- Initialize a VolumeProfilesPager object.
+ Initialize a KeysPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
+ self._resource_group_id = resource_group_id
def has_next(self) -> bool:
"""
@@ -172583,14 +177481,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VolumeProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of Key.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_volume_profiles(
+ result = self._client.list_keys(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
start=self._page_context.get('next'),
).get_result()
@@ -172602,13 +177501,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('profiles')
+ return result.get('keys')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VolumeProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of Key.
:rtype: List[dict]
"""
results = []
@@ -172618,9 +177517,9 @@ def get_all(self) -> List[dict]:
return results
-class VolumesPager:
+class LoadBalancerProfilesPager:
"""
- VolumesPager can be used to simplify the use of the "list_volumes" method.
+ LoadBalancerProfilesPager can be used to simplify the use of the "list_load_balancer_profiles" method.
"""
def __init__(
@@ -172628,51 +177527,15 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
- attachment_state: str = None,
- encryption: str = None,
- name: str = None,
- operating_system_family: str = None,
- operating_system_architecture: str = None,
- tag: str = None,
- zone_name: str = None,
) -> None:
"""
- Initialize a VolumesPager object.
+ Initialize a LoadBalancerProfilesPager object.
:param int limit: (optional) The number of resources to return on a page.
- :param str attachment_state: (optional) Filters the collection to volumes
- with an `attachment_state` property matching the specified value.
- :param str encryption: (optional) Filters the collection to resources with
- an `encryption` property matching the specified value.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str operating_system_family: (optional) Filters the collection to
- resources with an `operating_system.family` property matching the specified
- operating system family.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no operating system or any operating
- system, respectively.
- :param str operating_system_architecture: (optional) Filters the collection
- to resources with an `operating_system.architecture` property matching the
- specified operating system architecture.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no operating system or any operating
- system, respectively.
- :param str tag: (optional) Filters the collection to resources with an item
- in the `tags` property matching the exact specified tag.
- :param str zone_name: (optional) Filters the collection to resources with a
- `zone.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
- self._attachment_state = attachment_state
- self._encryption = encryption
- self._name = name
- self._operating_system_family = operating_system_family
- self._operating_system_architecture = operating_system_architecture
- self._tag = tag
- self._zone_name = zone_name
def has_next(self) -> bool:
"""
@@ -172683,21 +177546,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Volume.
+ :return: A List[dict], where each element is a dict that represents an instance of LoadBalancerProfile.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_volumes(
+ result = self._client.list_load_balancer_profiles(
limit=self._limit,
- attachment_state=self._attachment_state,
- encryption=self._encryption,
- name=self._name,
- operating_system_family=self._operating_system_family,
- operating_system_architecture=self._operating_system_architecture,
- tag=self._tag,
- zone_name=self._zone_name,
start=self._page_context.get('next'),
).get_result()
@@ -172709,13 +177565,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('volumes')
+ return result.get('profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Volume.
+ :return: A List[dict], where each element is a dict that represents an instance of LoadBalancerProfile.
:rtype: List[dict]
"""
results = []
@@ -172725,9 +177581,9 @@ def get_all(self) -> List[dict]:
return results
-class SnapshotConsistencyGroupsPager:
+class LoadBalancersPager:
"""
- SnapshotConsistencyGroupsPager can be used to simplify the use of the "list_snapshot_consistency_groups" method.
+ LoadBalancersPager can be used to simplify the use of the "list_load_balancers" method.
"""
def __init__(
@@ -172735,36 +177591,15 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
- resource_group_id: str = None,
- name: str = None,
- sort: str = None,
- backup_policy_plan_id: str = None,
) -> None:
"""
- Initialize a SnapshotConsistencyGroupsPager object.
+ Initialize a LoadBalancersPager object.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :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 str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
- self._resource_group_id = resource_group_id
- self._name = name
- self._sort = sort
- self._backup_policy_plan_id = backup_policy_plan_id
def has_next(self) -> bool:
"""
@@ -172775,18 +177610,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of SnapshotConsistencyGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of LoadBalancer.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_snapshot_consistency_groups(
+ result = self._client.list_load_balancers(
limit=self._limit,
- resource_group_id=self._resource_group_id,
- name=self._name,
- sort=self._sort,
- backup_policy_plan_id=self._backup_policy_plan_id,
start=self._page_context.get('next'),
).get_result()
@@ -172798,13 +177629,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('snapshot_consistency_groups')
+ return result.get('load_balancers')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of SnapshotConsistencyGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of LoadBalancer.
:rtype: List[dict]
"""
results = []
@@ -172814,9 +177645,9 @@ def get_all(self) -> List[dict]:
return results
-class SnapshotsPager:
+class NetworkAclsPager:
"""
- SnapshotsPager can be used to simplify the use of the "list_snapshots" method.
+ NetworkAclsPager can be used to simplify the use of the "list_network_acls" method.
"""
def __init__(
@@ -172824,117 +177655,20 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
- tag: str = None,
resource_group_id: str = None,
- name: str = None,
- source_volume_id: str = None,
- source_volume_crn: str = None,
- source_image_id: str = None,
- source_image_crn: str = None,
- sort: str = None,
- backup_policy_plan_id: str = None,
- copies_id: str = None,
- copies_name: str = None,
- copies_crn: str = None,
- copies_remote_region_name: str = None,
- source_snapshot_id: str = None,
- source_snapshot_remote_region_name: str = None,
- source_volume_remote_region_name: str = None,
- source_image_remote_region_name: str = None,
- clones_zone_name: str = None,
- snapshot_consistency_group_id: str = None,
- snapshot_consistency_group_crn: str = None,
) -> None:
"""
- Initialize a SnapshotsPager object.
+ Initialize a NetworkAclsPager object.
:param int limit: (optional) The number of resources to return on a page.
- :param str tag: (optional) Filters the collection to resources with an item
- in the `tags` property matching the exact specified tag.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str source_volume_id: (optional) Filters the collection to resources
- with a `source_volume.id` property matching the specified identifier.
- :param str source_volume_crn: (optional) Filters the collection to
- resources with a `source_volume.crn` property matching the specified CRN.
- :param str source_image_id: (optional) Filters the collection to resources
- with a `source_image.id` property matching the specified identifier.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no source image or any existent
- source image, respectively.
- :param str source_image_crn: (optional) Filters the collection to resources
- with a `source_image.crn` property matching the specified CRN.
- This parameter also supports the values `null` and `not:null` which filter
- the collection to resources which have no source image or any existent
- source image, respectively.
- :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 str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
- :param str copies_id: (optional) Filters the collection to snapshots with
- an item in the `copies` property with an `id` property matching the
- specified identifier.
- :param str copies_name: (optional) Filters the collection to snapshots with
- an item in the `copies` property with a `name` property matching the exact
- specified name.
- :param str copies_crn: (optional) Filters the collection to snapshots with
- an item in the `copies` property with a `crn` property matching the
- specified CRN.
- :param str copies_remote_region_name: (optional) Filters the collection to
- snapshots with an item in the `copies` property with a
- `remote.region.name` property matching the exact specified name.
- :param str source_snapshot_id: (optional) Filters the collection to
- resources with a `source_snapshot.id` property matching the specified
- identifier.
- :param str source_snapshot_remote_region_name: (optional) Filters the
- collection to resources with a `source_snapshot.remote.region.name`
- property matching the exact specified name.
- :param str source_volume_remote_region_name: (optional) Filters the
- collection to resources with a `source_volume.remote.region.name` property
- matching the exact specified name.
- :param str source_image_remote_region_name: (optional) Filters the
- collection to resources with a `source_image.remote.region.name` property
- matching the exact specified name.
- :param str clones_zone_name: (optional) Filters the collection to snapshots
- with an item in the `clones` property with a `zone.name` property matching
- the exact specified name.
- :param str snapshot_consistency_group_id: (optional) Filters the collection
- to resources with a `snapshot_consistency_group.id` property matching the
- specified identifier.
- :param str snapshot_consistency_group_crn: (optional) Filters the
- collection to resources with a `snapshot_consistency_group.crn` property
- matching the specified identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
- self._tag = tag
self._resource_group_id = resource_group_id
- self._name = name
- self._source_volume_id = source_volume_id
- self._source_volume_crn = source_volume_crn
- self._source_image_id = source_image_id
- self._source_image_crn = source_image_crn
- self._sort = sort
- self._backup_policy_plan_id = backup_policy_plan_id
- self._copies_id = copies_id
- self._copies_name = copies_name
- self._copies_crn = copies_crn
- self._copies_remote_region_name = copies_remote_region_name
- self._source_snapshot_id = source_snapshot_id
- self._source_snapshot_remote_region_name = source_snapshot_remote_region_name
- self._source_volume_remote_region_name = source_volume_remote_region_name
- self._source_image_remote_region_name = source_image_remote_region_name
- self._clones_zone_name = clones_zone_name
- self._snapshot_consistency_group_id = snapshot_consistency_group_id
- self._snapshot_consistency_group_crn = snapshot_consistency_group_crn
def has_next(self) -> bool:
"""
@@ -172945,34 +177679,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Snapshot.
+ :return: A List[dict], where each element is a dict that represents an instance of NetworkACL.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_snapshots(
+ result = self._client.list_network_acls(
limit=self._limit,
- tag=self._tag,
resource_group_id=self._resource_group_id,
- name=self._name,
- source_volume_id=self._source_volume_id,
- source_volume_crn=self._source_volume_crn,
- source_image_id=self._source_image_id,
- source_image_crn=self._source_image_crn,
- sort=self._sort,
- backup_policy_plan_id=self._backup_policy_plan_id,
- copies_id=self._copies_id,
- copies_name=self._copies_name,
- copies_crn=self._copies_crn,
- copies_remote_region_name=self._copies_remote_region_name,
- source_snapshot_id=self._source_snapshot_id,
- source_snapshot_remote_region_name=self._source_snapshot_remote_region_name,
- source_volume_remote_region_name=self._source_volume_remote_region_name,
- source_image_remote_region_name=self._source_image_remote_region_name,
- clones_zone_name=self._clones_zone_name,
- snapshot_consistency_group_id=self._snapshot_consistency_group_id,
- snapshot_consistency_group_crn=self._snapshot_consistency_group_crn,
start=self._page_context.get('next'),
).get_result()
@@ -172984,13 +177699,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('snapshots')
+ return result.get('network_acls')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Snapshot.
+ :return: A List[dict], where each element is a dict that represents an instance of NetworkACL.
:rtype: List[dict]
"""
results = []
@@ -173000,32 +177715,32 @@ def get_all(self) -> List[dict]:
return results
-class ShareProfilesPager:
+class NetworkAclRulesPager:
"""
- ShareProfilesPager can be used to simplify the use of the "list_share_profiles" method.
+ NetworkAclRulesPager can be used to simplify the use of the "list_network_acl_rules" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ network_acl_id: str,
limit: int = None,
- sort: str = None,
+ direction: str = None,
) -> None:
"""
- Initialize a ShareProfilesPager object.
+ Initialize a NetworkAclRulesPager object.
+ :param str network_acl_id: The network ACL identifier.
: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 str direction: (optional) Filters the collection to rules with a
+ `direction` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._network_acl_id = network_acl_id
self._limit = limit
- self._sort = sort
+ self._direction = direction
def has_next(self) -> bool:
"""
@@ -173036,15 +177751,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ShareProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of NetworkACLRuleItem.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_share_profiles(
+ result = self._client.list_network_acl_rules(
+ network_acl_id=self._network_acl_id,
limit=self._limit,
- sort=self._sort,
+ direction=self._direction,
start=self._page_context.get('next'),
).get_result()
@@ -173056,13 +177772,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('profiles')
+ return result.get('rules')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ShareProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of NetworkACLRuleItem.
:rtype: List[dict]
"""
results = []
@@ -173072,9 +177788,9 @@ def get_all(self) -> List[dict]:
return results
-class SharesPager:
+class PlacementGroupsPager:
"""
- SharesPager can be used to simplify the use of the "list_shares" method.
+ PlacementGroupsPager can be used to simplify the use of the "list_placement_groups" method.
"""
def __init__(
@@ -173082,35 +177798,15 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
- resource_group_id: str = None,
- name: str = None,
- sort: str = None,
- replication_role: str = None,
) -> None:
"""
- Initialize a SharesPager object.
+ Initialize a PlacementGroupsPager object.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :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 str replication_role: (optional) Filters the collection to file
- shares with a `replication_role` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
- self._resource_group_id = resource_group_id
- self._name = name
- self._sort = sort
- self._replication_role = replication_role
def has_next(self) -> bool:
"""
@@ -173121,18 +177817,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of Share.
+ :return: A List[dict], where each element is a dict that represents an instance of PlacementGroup.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_shares(
+ result = self._client.list_placement_groups(
limit=self._limit,
- resource_group_id=self._resource_group_id,
- name=self._name,
- sort=self._sort,
- replication_role=self._replication_role,
start=self._page_context.get('next'),
).get_result()
@@ -173144,13 +177836,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('shares')
+ return result.get('placement_groups')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of Share.
+ :return: A List[dict], where each element is a dict that represents an instance of PlacementGroup.
:rtype: List[dict]
"""
results = []
@@ -173160,28 +177852,30 @@ def get_all(self) -> List[dict]:
return results
-class ShareAccessorBindingsPager:
+class PrivatePathServiceGatewaysPager:
"""
- ShareAccessorBindingsPager can be used to simplify the use of the "list_share_accessor_bindings" method.
+ PrivatePathServiceGatewaysPager can be used to simplify the use of the "list_private_path_service_gateways" method.
"""
def __init__(
self,
*,
client: VpcV1,
- id: str,
limit: int = None,
+ resource_group_id: str = None,
) -> None:
"""
- Initialize a ShareAccessorBindingsPager object.
- :param str id: The file share identifier.
+ Initialize a PrivatePathServiceGatewaysPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._id = id
self._limit = limit
+ self._resource_group_id = resource_group_id
def has_next(self) -> bool:
"""
@@ -173192,15 +177886,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ShareAccessorBinding.
+ :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGateway.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_share_accessor_bindings(
- id=self._id,
+ result = self._client.list_private_path_service_gateways(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
start=self._page_context.get('next'),
).get_result()
@@ -173212,13 +177906,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('accessor_bindings')
+ return result.get('private_path_service_gateways')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ShareAccessorBinding.
+ :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGateway.
:rtype: List[dict]
"""
results = []
@@ -173228,32 +177922,33 @@ def get_all(self) -> List[dict]:
return results
-class ShareMountTargetsPager:
+class PrivatePathServiceGatewayAccountPoliciesPager:
"""
- ShareMountTargetsPager can be used to simplify the use of the "list_share_mount_targets" method.
+ PrivatePathServiceGatewayAccountPoliciesPager can be used to simplify the use of the "list_private_path_service_gateway_account_policies" method.
"""
def __init__(
self,
*,
client: VpcV1,
- share_id: str,
- name: str = None,
+ private_path_service_gateway_id: str,
limit: int = None,
+ account_id: str = None,
) -> None:
"""
- Initialize a ShareMountTargetsPager object.
- :param str share_id: The file share identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ Initialize a PrivatePathServiceGatewayAccountPoliciesPager object.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
:param int limit: (optional) The number of resources to return on a page.
+ :param str account_id: (optional) Filters the collection to resources with
+ an `account.id` property matching the specified identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._share_id = share_id
- self._name = name
+ self._private_path_service_gateway_id = private_path_service_gateway_id
self._limit = limit
+ self._account_id = account_id
def has_next(self) -> bool:
"""
@@ -173264,16 +177959,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ShareMountTarget.
+ :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayAccountPolicy.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_share_mount_targets(
- share_id=self._share_id,
- name=self._name,
+ result = self._client.list_private_path_service_gateway_account_policies(
+ private_path_service_gateway_id=self._private_path_service_gateway_id,
limit=self._limit,
+ account_id=self._account_id,
start=self._page_context.get('next'),
).get_result()
@@ -173285,13 +177980,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('mount_targets')
+ return result.get('account_policies')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ShareMountTarget.
+ :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayAccountPolicy.
:rtype: List[dict]
"""
results = []
@@ -173301,45 +177996,37 @@ def get_all(self) -> List[dict]:
return results
-class ShareSnapshotsPager:
+class PrivatePathServiceGatewayEndpointGatewayBindingsPager:
"""
- ShareSnapshotsPager can be used to simplify the use of the "list_share_snapshots" method.
+ PrivatePathServiceGatewayEndpointGatewayBindingsPager can be used to simplify the use of the "list_private_path_service_gateway_endpoint_gateway_bindings" method.
"""
def __init__(
self,
*,
client: VpcV1,
- share_id: str,
- backup_policy_plan_id: str = None,
- name: str = None,
+ private_path_service_gateway_id: str,
limit: int = None,
- sort: str = None,
+ status: str = None,
+ account_id: str = None,
) -> None:
"""
- Initialize a ShareSnapshotsPager object.
- :param str share_id: The file share identifier, or `-` to wildcard all
- accessible file shares.
- :param str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ Initialize a PrivatePathServiceGatewayEndpointGatewayBindingsPager object.
+ :param str private_path_service_gateway_id: The private path service
+ gateway identifier.
: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 str status: (optional) Filters the collection to endpoint gateway
+ bindings with a `status` property matching the specified value.
+ :param str account_id: (optional) Filters the collection to resources with
+ an `account.id` property matching the specified identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._share_id = share_id
- self._backup_policy_plan_id = backup_policy_plan_id
- self._name = name
+ self._private_path_service_gateway_id = private_path_service_gateway_id
self._limit = limit
- self._sort = sort
+ self._status = status
+ self._account_id = account_id
def has_next(self) -> bool:
"""
@@ -173350,18 +178037,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ShareSnapshot.
+ :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayEndpointGatewayBinding.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_share_snapshots(
- share_id=self._share_id,
- backup_policy_plan_id=self._backup_policy_plan_id,
- name=self._name,
+ result = self._client.list_private_path_service_gateway_endpoint_gateway_bindings(
+ private_path_service_gateway_id=self._private_path_service_gateway_id,
limit=self._limit,
- sort=self._sort,
+ status=self._status,
+ account_id=self._account_id,
start=self._page_context.get('next'),
).get_result()
@@ -173373,13 +178059,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('snapshots')
+ return result.get('endpoint_gateway_bindings')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ShareSnapshot.
+ :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayEndpointGatewayBinding.
:rtype: List[dict]
"""
results = []
@@ -173389,9 +178075,9 @@ def get_all(self) -> List[dict]:
return results
-class BackupPoliciesPager:
+class PublicAddressRangesPager:
"""
- BackupPoliciesPager can be used to simplify the use of the "list_backup_policies" method.
+ PublicAddressRangesPager can be used to simplify the use of the "list_public_address_ranges" method.
"""
def __init__(
@@ -173400,27 +178086,19 @@ def __init__(
client: VpcV1,
limit: int = None,
resource_group_id: str = None,
- name: str = None,
- tag: str = None,
) -> None:
"""
- Initialize a BackupPoliciesPager object.
+ Initialize a PublicAddressRangesPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str tag: (optional) Filters the collection to resources with an item
- in the `tags` property matching the exact specified tag.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
self._resource_group_id = resource_group_id
- self._name = name
- self._tag = tag
def has_next(self) -> bool:
"""
@@ -173431,17 +178109,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of BackupPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of PublicAddressRange.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_backup_policies(
+ result = self._client.list_public_address_ranges(
limit=self._limit,
resource_group_id=self._resource_group_id,
- name=self._name,
- tag=self._tag,
start=self._page_context.get('next'),
).get_result()
@@ -173453,13 +178129,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('backup_policies')
+ return result.get('public_address_ranges')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of BackupPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of PublicAddressRange.
:rtype: List[dict]
"""
results = []
@@ -173469,58 +178145,30 @@ def get_all(self) -> List[dict]:
return results
-class BackupPolicyJobsPager:
+class PublicGatewaysPager:
"""
- BackupPolicyJobsPager can be used to simplify the use of the "list_backup_policy_jobs" method.
+ PublicGatewaysPager can be used to simplify the use of the "list_public_gateways" method.
"""
def __init__(
self,
*,
client: VpcV1,
- backup_policy_id: str,
- status: str = None,
- backup_policy_plan_id: str = None,
limit: int = None,
- sort: str = None,
- source_id: str = None,
- target_snapshots_id: str = None,
- target_snapshots_crn: str = None,
+ resource_group_id: str = None,
) -> None:
"""
- Initialize a BackupPolicyJobsPager object.
- :param str backup_policy_id: The backup policy identifier.
- :param str status: (optional) Filters the collection to backup policy jobs
- with a `status` property matching the specified value.
- :param str backup_policy_plan_id: (optional) Filters the collection to
- backup policy jobs with a `backup_policy_plan.id` property matching the
- specified identifier.
+ Initialize a PublicGatewaysPager object.
: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 str source_id: (optional) Filters the collection to backup policy
- jobs with a `source.id` property matching the specified identifier.
- :param str target_snapshots_id: (optional) Filters the collection to backup
- policy jobs with an item in the `target_snapshots` property with an `id`
- property matching the specified identifier.
- :param str target_snapshots_crn: (optional) Filters the collection to
- backup policy jobs with an item in the `target_snapshots` property with a
- `crn` property matching the specified CRN.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._backup_policy_id = backup_policy_id
- self._status = status
- self._backup_policy_plan_id = backup_policy_plan_id
self._limit = limit
- self._sort = sort
- self._source_id = source_id
- self._target_snapshots_id = target_snapshots_id
- self._target_snapshots_crn = target_snapshots_crn
+ self._resource_group_id = resource_group_id
def has_next(self) -> bool:
"""
@@ -173531,21 +178179,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of BackupPolicyJob.
+ :return: A List[dict], where each element is a dict that represents an instance of PublicGateway.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_backup_policy_jobs(
- backup_policy_id=self._backup_policy_id,
- status=self._status,
- backup_policy_plan_id=self._backup_policy_plan_id,
+ result = self._client.list_public_gateways(
limit=self._limit,
- sort=self._sort,
- source_id=self._source_id,
- target_snapshots_id=self._target_snapshots_id,
- target_snapshots_crn=self._target_snapshots_crn,
+ resource_group_id=self._resource_group_id,
start=self._page_context.get('next'),
).get_result()
@@ -173557,13 +178199,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('jobs')
+ return result.get('public_gateways')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of BackupPolicyJob.
+ :return: A List[dict], where each element is a dict that represents an instance of PublicGateway.
:rtype: List[dict]
"""
results = []
@@ -173573,9 +178215,9 @@ def get_all(self) -> List[dict]:
return results
-class VirtualNetworkInterfacesPager:
+class ReservationsPager:
"""
- VirtualNetworkInterfacesPager can be used to simplify the use of the "list_virtual_network_interfaces" method.
+ ReservationsPager can be used to simplify the use of the "list_reservations" method.
"""
def __init__(
@@ -173583,20 +178225,38 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ name: str = None,
+ profile_resource_type: str = None,
+ affinity_policy: str = None,
resource_group_id: str = None,
+ zone_name: str = None,
) -> None:
"""
- Initialize a VirtualNetworkInterfacesPager object.
+ Initialize a ReservationsPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str profile_resource_type: (optional) Filters the collection of
+ resources with a `profile.resource_type` property matching the specified
+ value.
+ :param str affinity_policy: (optional) Filters the collection to
+ reservations with an `affinity_policy` property matching the specified
+ value.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
+ self._name = name
+ self._profile_resource_type = profile_resource_type
+ self._affinity_policy = affinity_policy
self._resource_group_id = resource_group_id
+ self._zone_name = zone_name
def has_next(self) -> bool:
"""
@@ -173607,15 +178267,19 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VirtualNetworkInterface.
+ :return: A List[dict], where each element is a dict that represents an instance of Reservation.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_virtual_network_interfaces(
+ result = self._client.list_reservations(
limit=self._limit,
+ name=self._name,
+ profile_resource_type=self._profile_resource_type,
+ affinity_policy=self._affinity_policy,
resource_group_id=self._resource_group_id,
+ zone_name=self._zone_name,
start=self._page_context.get('next'),
).get_result()
@@ -173627,13 +178291,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('virtual_network_interfaces')
+ return result.get('reservations')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VirtualNetworkInterface.
+ :return: A List[dict], where each element is a dict that represents an instance of Reservation.
:rtype: List[dict]
"""
results = []
@@ -173643,36 +178307,42 @@ def get_all(self) -> List[dict]:
return results
-class NetworkInterfaceFloatingIpsPager:
+class SecurityGroupsPager:
"""
- NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "list_network_interface_floating_ips" method.
+ SecurityGroupsPager can be used to simplify the use of the "list_security_groups" method.
"""
def __init__(
self,
*,
client: VpcV1,
- virtual_network_interface_id: str,
limit: int = None,
- sort: str = None,
+ resource_group_id: str = None,
+ vpc_id: str = None,
+ vpc_crn: str = None,
+ vpc_name: str = None,
) -> None:
"""
- Initialize a NetworkInterfaceFloatingIpsPager object.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
+ Initialize a SecurityGroupsPager object.
: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
- `-name` sorts the collection by the `name` property in descending order,
- and the value `name` sorts it by the `name` property in ascending order.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._virtual_network_interface_id = virtual_network_interface_id
self._limit = limit
- self._sort = sort
+ self._resource_group_id = resource_group_id
+ self._vpc_id = vpc_id
+ self._vpc_crn = vpc_crn
+ self._vpc_name = vpc_name
def has_next(self) -> bool:
"""
@@ -173683,16 +178353,18 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of FloatingIPReference.
+ :return: A List[dict], where each element is a dict that represents an instance of SecurityGroup.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_network_interface_floating_ips(
- virtual_network_interface_id=self._virtual_network_interface_id,
+ result = self._client.list_security_groups(
limit=self._limit,
- sort=self._sort,
+ resource_group_id=self._resource_group_id,
+ vpc_id=self._vpc_id,
+ vpc_crn=self._vpc_crn,
+ vpc_name=self._vpc_name,
start=self._page_context.get('next'),
).get_result()
@@ -173704,13 +178376,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('floating_ips')
+ return result.get('security_groups')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of FloatingIPReference.
+ :return: A List[dict], where each element is a dict that represents an instance of SecurityGroup.
:rtype: List[dict]
"""
results = []
@@ -173720,36 +178392,28 @@ def get_all(self) -> List[dict]:
return results
-class VirtualNetworkInterfaceIpsPager:
+class SecurityGroupTargetsPager:
"""
- VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "list_virtual_network_interface_ips" method.
+ SecurityGroupTargetsPager can be used to simplify the use of the "list_security_group_targets" method.
"""
def __init__(
self,
*,
client: VpcV1,
- virtual_network_interface_id: str,
+ security_group_id: str,
limit: int = None,
- sort: str = None,
) -> None:
"""
- Initialize a VirtualNetworkInterfaceIpsPager object.
- :param str virtual_network_interface_id: The virtual network interface
- identifier.
+ Initialize a SecurityGroupTargetsPager object.
+ :param str security_group_id: The security group identifier.
: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
- `-name` sorts the collection by the `name` property in descending order,
- and the value `name` sorts it by the `name` property in ascending order.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._virtual_network_interface_id = virtual_network_interface_id
+ self._security_group_id = security_group_id
self._limit = limit
- self._sort = sort
def has_next(self) -> bool:
"""
@@ -173760,16 +178424,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ReservedIPReference.
+ :return: A List[dict], where each element is a dict that represents an instance of SecurityGroupTargetReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_virtual_network_interface_ips(
- virtual_network_interface_id=self._virtual_network_interface_id,
+ result = self._client.list_security_group_targets(
+ security_group_id=self._security_group_id,
limit=self._limit,
- sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -173781,13 +178444,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('ips')
+ return result.get('targets')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ReservedIPReference.
+ :return: A List[dict], where each element is a dict that represents an instance of SecurityGroupTargetReference.
:rtype: List[dict]
"""
results = []
@@ -173797,9 +178460,9 @@ def get_all(self) -> List[dict]:
return results
-class ClusterNetworkProfilesPager:
+class ShareProfilesPager:
"""
- ClusterNetworkProfilesPager can be used to simplify the use of the "list_cluster_network_profiles" method.
+ ShareProfilesPager can be used to simplify the use of the "list_share_profiles" method.
"""
def __init__(
@@ -173807,15 +178470,22 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ sort: str = None,
) -> None:
"""
- Initialize a ClusterNetworkProfilesPager object.
+ Initialize a ShareProfilesPager object.
: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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -173826,14 +178496,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareProfile.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_cluster_network_profiles(
+ result = self._client.list_share_profiles(
limit=self._limit,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -173851,7 +178522,7 @@ def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareProfile.
:rtype: List[dict]
"""
results = []
@@ -173861,9 +178532,9 @@ def get_all(self) -> List[dict]:
return results
-class ClusterNetworksPager:
+class SharesPager:
"""
- ClusterNetworksPager can be used to simplify the use of the "list_cluster_networks" method.
+ SharesPager can be used to simplify the use of the "list_shares" method.
"""
def __init__(
@@ -173874,12 +178545,10 @@ def __init__(
resource_group_id: str = None,
name: str = None,
sort: str = None,
- vpc_id: str = None,
- vpc_crn: str = None,
- vpc_name: str = None,
+ replication_role: str = None,
) -> None:
"""
- Initialize a ClusterNetworksPager object.
+ Initialize a SharesPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
@@ -173891,12 +178560,8 @@ def __init__(
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 vpc_id: (optional) Filters the collection to cluster networks
- with a `vpc.id` property matching the specified id.
- :param str vpc_crn: (optional) Filters the collection to cluster networks
- with a `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to cluster networks
- with a `vpc.name` property matching the specified name.
+ :param str replication_role: (optional) Filters the collection to file
+ shares with a `replication_role` property matching the specified value.
"""
self._has_next = True
self._client = client
@@ -173905,9 +178570,7 @@ def __init__(
self._resource_group_id = resource_group_id
self._name = name
self._sort = sort
- self._vpc_id = vpc_id
- self._vpc_crn = vpc_crn
- self._vpc_name = vpc_name
+ self._replication_role = replication_role
def has_next(self) -> bool:
"""
@@ -173918,20 +178581,18 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetwork.
+ :return: A List[dict], where each element is a dict that represents an instance of Share.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_cluster_networks(
+ result = self._client.list_shares(
limit=self._limit,
resource_group_id=self._resource_group_id,
name=self._name,
sort=self._sort,
- vpc_id=self._vpc_id,
- vpc_crn=self._vpc_crn,
- vpc_name=self._vpc_name,
+ replication_role=self._replication_role,
start=self._page_context.get('next'),
).get_result()
@@ -173943,13 +178604,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('cluster_networks')
+ return result.get('shares')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetwork.
+ :return: A List[dict], where each element is a dict that represents an instance of Share.
:rtype: List[dict]
"""
results = []
@@ -173959,26 +178620,172 @@ def get_all(self) -> List[dict]:
return results
-class ClusterNetworkInterfacesPager:
+class ShareAccessorBindingsPager:
"""
- ClusterNetworkInterfacesPager can be used to simplify the use of the "list_cluster_network_interfaces" method.
+ ShareAccessorBindingsPager can be used to simplify the use of the "list_share_accessor_bindings" method.
"""
def __init__(
self,
*,
client: VpcV1,
- cluster_network_id: str,
+ id: str,
+ limit: int = None,
+ ) -> None:
+ """
+ Initialize a ShareAccessorBindingsPager object.
+ :param str id: The file share identifier.
+ :param int limit: (optional) The number of resources to return on a page.
+ """
+ self._has_next = True
+ self._client = client
+ self._page_context = {'next': None}
+ self._id = id
+ self._limit = limit
+
+ def has_next(self) -> bool:
+ """
+ Returns true if there are potentially more results to be retrieved.
+ """
+ return self._has_next
+
+ def get_next(self) -> List[dict]:
+ """
+ Returns the next page of results.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareAccessorBinding.
+ :rtype: List[dict]
+ """
+ if not self.has_next():
+ raise StopIteration(message='No more results available')
+
+ result = self._client.list_share_accessor_bindings(
+ id=self._id,
+ limit=self._limit,
+ start=self._page_context.get('next'),
+ ).get_result()
+
+ next = None
+ next_page_link = result.get('next')
+ if next_page_link is not None:
+ next = get_query_param(next_page_link.get('href'), 'start')
+ self._page_context['next'] = next
+ if next is None:
+ self._has_next = False
+
+ return result.get('accessor_bindings')
+
+ def get_all(self) -> List[dict]:
+ """
+ Returns all results by invoking get_next() repeatedly
+ until all pages of results have been retrieved.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareAccessorBinding.
+ :rtype: List[dict]
+ """
+ results = []
+ while self.has_next():
+ next_page = self.get_next()
+ results.extend(next_page)
+ return results
+
+
+class ShareMountTargetsPager:
+ """
+ ShareMountTargetsPager can be used to simplify the use of the "list_share_mount_targets" method.
+ """
+
+ def __init__(
+ self,
+ *,
+ client: VpcV1,
+ share_id: str,
+ name: str = None,
limit: int = None,
+ ) -> None:
+ """
+ Initialize a ShareMountTargetsPager object.
+ :param str share_id: The file share identifier.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param int limit: (optional) The number of resources to return on a page.
+ """
+ self._has_next = True
+ self._client = client
+ self._page_context = {'next': None}
+ self._share_id = share_id
+ self._name = name
+ self._limit = limit
+
+ def has_next(self) -> bool:
+ """
+ Returns true if there are potentially more results to be retrieved.
+ """
+ return self._has_next
+
+ def get_next(self) -> List[dict]:
+ """
+ Returns the next page of results.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareMountTarget.
+ :rtype: List[dict]
+ """
+ if not self.has_next():
+ raise StopIteration(message='No more results available')
+
+ result = self._client.list_share_mount_targets(
+ share_id=self._share_id,
+ name=self._name,
+ limit=self._limit,
+ start=self._page_context.get('next'),
+ ).get_result()
+
+ next = None
+ next_page_link = result.get('next')
+ if next_page_link is not None:
+ next = get_query_param(next_page_link.get('href'), 'start')
+ self._page_context['next'] = next
+ if next is None:
+ self._has_next = False
+
+ return result.get('mount_targets')
+
+ def get_all(self) -> List[dict]:
+ """
+ Returns all results by invoking get_next() repeatedly
+ until all pages of results have been retrieved.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareMountTarget.
+ :rtype: List[dict]
+ """
+ results = []
+ while self.has_next():
+ next_page = self.get_next()
+ results.extend(next_page)
+ return results
+
+
+class ShareSnapshotsPager:
+ """
+ ShareSnapshotsPager can be used to simplify the use of the "list_share_snapshots" method.
+ """
+
+ def __init__(
+ self,
+ *,
+ client: VpcV1,
+ share_id: str,
+ backup_policy_plan_id: str = None,
name: str = None,
+ limit: int = None,
sort: str = None,
) -> None:
"""
- Initialize a ClusterNetworkInterfacesPager object.
- :param str cluster_network_id: The cluster network identifier.
- :param int limit: (optional) The number of resources to return on a page.
+ Initialize a ShareSnapshotsPager object.
+ :param str share_id: The file share identifier, or `-` to wildcard all
+ accessible file shares.
+ :param str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching the
+ specified identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
+ :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
@@ -173988,9 +178795,10 @@ def __init__(
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._cluster_network_id = cluster_network_id
- self._limit = limit
+ self._share_id = share_id
+ self._backup_policy_plan_id = backup_policy_plan_id
self._name = name
+ self._limit = limit
self._sort = sort
def has_next(self) -> bool:
@@ -174002,16 +178810,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkInterface.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareSnapshot.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_cluster_network_interfaces(
- cluster_network_id=self._cluster_network_id,
- limit=self._limit,
+ result = self._client.list_share_snapshots(
+ share_id=self._share_id,
+ backup_policy_plan_id=self._backup_policy_plan_id,
name=self._name,
+ limit=self._limit,
sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -174024,13 +178833,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('interfaces')
+ return result.get('snapshots')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkInterface.
+ :return: A List[dict], where each element is a dict that represents an instance of ShareSnapshot.
:rtype: List[dict]
"""
results = []
@@ -174040,24 +178849,27 @@ def get_all(self) -> List[dict]:
return results
-class ClusterNetworkSubnetsPager:
+class SnapshotConsistencyGroupsPager:
"""
- ClusterNetworkSubnetsPager can be used to simplify the use of the "list_cluster_network_subnets" method.
+ SnapshotConsistencyGroupsPager can be used to simplify the use of the "list_snapshot_consistency_groups" method.
"""
def __init__(
self,
*,
client: VpcV1,
- cluster_network_id: str,
limit: int = None,
+ resource_group_id: str = None,
name: str = None,
sort: str = None,
+ backup_policy_plan_id: str = None,
) -> None:
"""
- Initialize a ClusterNetworkSubnetsPager object.
- :param str cluster_network_id: The cluster network identifier.
+ Initialize a SnapshotConsistencyGroupsPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
:param str sort: (optional) Sorts the returned collection by the specified
@@ -174065,14 +178877,18 @@ def __init__(
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 a `backup_policy_plan.id` property matching the
+ specified identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._cluster_network_id = cluster_network_id
self._limit = limit
+ self._resource_group_id = resource_group_id
self._name = name
self._sort = sort
+ self._backup_policy_plan_id = backup_policy_plan_id
def has_next(self) -> bool:
"""
@@ -174083,17 +178899,18 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnet.
+ :return: A List[dict], where each element is a dict that represents an instance of SnapshotConsistencyGroup.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_cluster_network_subnets(
- cluster_network_id=self._cluster_network_id,
+ result = self._client.list_snapshot_consistency_groups(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
name=self._name,
sort=self._sort,
+ backup_policy_plan_id=self._backup_policy_plan_id,
start=self._page_context.get('next'),
).get_result()
@@ -174105,13 +178922,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('subnets')
+ return result.get('snapshot_consistency_groups')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnet.
+ :return: A List[dict], where each element is a dict that represents an instance of SnapshotConsistencyGroup.
:rtype: List[dict]
"""
results = []
@@ -174121,43 +178938,127 @@ def get_all(self) -> List[dict]:
return results
-class ClusterNetworkSubnetReservedIpsPager:
+class SnapshotsPager:
"""
- ClusterNetworkSubnetReservedIpsPager can be used to simplify the use of the "list_cluster_network_subnet_reserved_ips" method.
+ SnapshotsPager can be used to simplify the use of the "list_snapshots" method.
"""
def __init__(
self,
*,
client: VpcV1,
- cluster_network_id: str,
- cluster_network_subnet_id: str,
limit: int = None,
+ tag: str = None,
+ resource_group_id: str = None,
name: str = None,
+ source_volume_id: str = None,
+ source_volume_crn: str = None,
+ source_image_id: str = None,
+ source_image_crn: str = None,
sort: str = None,
+ backup_policy_plan_id: str = None,
+ copies_id: str = None,
+ copies_name: str = None,
+ copies_crn: str = None,
+ copies_remote_region_name: str = None,
+ source_snapshot_id: str = None,
+ source_snapshot_remote_region_name: str = None,
+ source_volume_remote_region_name: str = None,
+ source_image_remote_region_name: str = None,
+ clones_zone_name: str = None,
+ snapshot_consistency_group_id: str = None,
+ snapshot_consistency_group_crn: str = None,
) -> None:
"""
- Initialize a ClusterNetworkSubnetReservedIpsPager object.
- :param str cluster_network_id: The cluster network identifier.
- :param str cluster_network_subnet_id: The cluster network subnet
- identifier.
+ Initialize a SnapshotsPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str tag: (optional) Filters the collection to resources with an item
+ in the `tags` property matching the exact specified tag.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
:param str name: (optional) Filters the collection to resources with a
`name` property matching the exact specified name.
+ :param str source_volume_id: (optional) Filters the collection to resources
+ with a `source_volume.id` property matching the specified identifier.
+ :param str source_volume_crn: (optional) Filters the collection to
+ resources with a `source_volume.crn` property matching the specified CRN.
+ :param str source_image_id: (optional) Filters the collection to resources
+ with a `source_image.id` property matching the specified identifier.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no source image or any existent
+ source image, respectively.
+ :param str source_image_crn: (optional) Filters the collection to resources
+ with a `source_image.crn` property matching the specified CRN.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no source image or any existent
+ source image, respectively.
: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 str backup_policy_plan_id: (optional) Filters the collection to
+ backup policy jobs with a `backup_policy_plan.id` property matching the
+ specified identifier.
+ :param str copies_id: (optional) Filters the collection to snapshots with
+ an item in the `copies` property with an `id` property matching the
+ specified identifier.
+ :param str copies_name: (optional) Filters the collection to snapshots with
+ an item in the `copies` property with a `name` property matching the exact
+ specified name.
+ :param str copies_crn: (optional) Filters the collection to snapshots with
+ an item in the `copies` property with a `crn` property matching the
+ specified CRN.
+ :param str copies_remote_region_name: (optional) Filters the collection to
+ snapshots with an item in the `copies` property with a
+ `remote.region.name` property matching the exact specified name.
+ :param str source_snapshot_id: (optional) Filters the collection to
+ resources with a `source_snapshot.id` property matching the specified
+ identifier.
+ :param str source_snapshot_remote_region_name: (optional) Filters the
+ collection to resources with a `source_snapshot.remote.region.name`
+ property matching the exact specified name.
+ :param str source_volume_remote_region_name: (optional) Filters the
+ collection to resources with a `source_volume.remote.region.name` property
+ matching the exact specified name.
+ :param str source_image_remote_region_name: (optional) Filters the
+ collection to resources with a `source_image.remote.region.name` property
+ matching the exact specified name.
+ :param str clones_zone_name: (optional) Filters the collection to snapshots
+ with an item in the `clones` property with a `zone.name` property matching
+ the exact specified name.
+ :param str snapshot_consistency_group_id: (optional) Filters the collection
+ to resources with a `snapshot_consistency_group.id` property matching the
+ specified identifier.
+ :param str snapshot_consistency_group_crn: (optional) Filters the
+ collection to resources with a `snapshot_consistency_group.crn` property
+ matching the specified identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._cluster_network_id = cluster_network_id
- self._cluster_network_subnet_id = cluster_network_subnet_id
self._limit = limit
+ self._tag = tag
+ self._resource_group_id = resource_group_id
self._name = name
+ self._source_volume_id = source_volume_id
+ self._source_volume_crn = source_volume_crn
+ self._source_image_id = source_image_id
+ self._source_image_crn = source_image_crn
self._sort = sort
+ self._backup_policy_plan_id = backup_policy_plan_id
+ self._copies_id = copies_id
+ self._copies_name = copies_name
+ self._copies_crn = copies_crn
+ self._copies_remote_region_name = copies_remote_region_name
+ self._source_snapshot_id = source_snapshot_id
+ self._source_snapshot_remote_region_name = source_snapshot_remote_region_name
+ self._source_volume_remote_region_name = source_volume_remote_region_name
+ self._source_image_remote_region_name = source_image_remote_region_name
+ self._clones_zone_name = clones_zone_name
+ self._snapshot_consistency_group_id = snapshot_consistency_group_id
+ self._snapshot_consistency_group_crn = snapshot_consistency_group_crn
def has_next(self) -> bool:
"""
@@ -174168,18 +179069,34 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnetReservedIP.
+ :return: A List[dict], where each element is a dict that represents an instance of Snapshot.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_cluster_network_subnet_reserved_ips(
- cluster_network_id=self._cluster_network_id,
- cluster_network_subnet_id=self._cluster_network_subnet_id,
+ result = self._client.list_snapshots(
limit=self._limit,
+ tag=self._tag,
+ resource_group_id=self._resource_group_id,
name=self._name,
+ source_volume_id=self._source_volume_id,
+ source_volume_crn=self._source_volume_crn,
+ source_image_id=self._source_image_id,
+ source_image_crn=self._source_image_crn,
sort=self._sort,
+ backup_policy_plan_id=self._backup_policy_plan_id,
+ copies_id=self._copies_id,
+ copies_name=self._copies_name,
+ copies_crn=self._copies_crn,
+ copies_remote_region_name=self._copies_remote_region_name,
+ source_snapshot_id=self._source_snapshot_id,
+ source_snapshot_remote_region_name=self._source_snapshot_remote_region_name,
+ source_volume_remote_region_name=self._source_volume_remote_region_name,
+ source_image_remote_region_name=self._source_image_remote_region_name,
+ clones_zone_name=self._clones_zone_name,
+ snapshot_consistency_group_id=self._snapshot_consistency_group_id,
+ snapshot_consistency_group_crn=self._snapshot_consistency_group_crn,
start=self._page_context.get('next'),
).get_result()
@@ -174191,13 +179108,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('reserved_ips')
+ return result.get('snapshots')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ClusterNetworkSubnetReservedIP.
+ :return: A List[dict], where each element is a dict that represents an instance of Snapshot.
:rtype: List[dict]
"""
results = []
@@ -174207,30 +179124,28 @@ def get_all(self) -> List[dict]:
return results
-class PublicGatewaysPager:
+class SnapshotInstanceProfilesPager:
"""
- PublicGatewaysPager can be used to simplify the use of the "list_public_gateways" method.
+ SnapshotInstanceProfilesPager can be used to simplify the use of the "list_snapshot_instance_profiles" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ id: str,
limit: int = None,
- resource_group_id: str = None,
) -> None:
"""
- Initialize a PublicGatewaysPager object.
+ Initialize a SnapshotInstanceProfilesPager object.
+ :param str id: The snapshot identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._id = id
self._limit = limit
- self._resource_group_id = resource_group_id
def has_next(self) -> bool:
"""
@@ -174241,15 +179156,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of PublicGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceProfileReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_public_gateways(
+ result = self._client.list_snapshot_instance_profiles(
+ id=self._id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
start=self._page_context.get('next'),
).get_result()
@@ -174261,13 +179176,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('public_gateways')
+ return result.get('instance_profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of PublicGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceProfileReference.
:rtype: List[dict]
"""
results = []
@@ -174277,9 +179192,9 @@ def get_all(self) -> List[dict]:
return results
-class FloatingIpsPager:
+class SubnetsPager:
"""
- FloatingIpsPager can be used to simplify the use of the "list_floating_ips" method.
+ SubnetsPager can be used to simplify the use of the "list_subnets" method.
"""
def __init__(
@@ -174288,43 +179203,43 @@ def __init__(
client: VpcV1,
limit: int = None,
resource_group_id: str = None,
- sort: str = None,
- target_id: str = None,
- target_crn: str = None,
- target_name: str = None,
- target_resource_type: str = None,
+ zone_name: str = None,
+ vpc_id: str = None,
+ vpc_crn: str = None,
+ vpc_name: str = None,
+ routing_table_id: str = None,
+ routing_table_name: str = None,
) -> None:
"""
- Initialize a FloatingIpsPager object.
+ Initialize a SubnetsPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching 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 str target_id: (optional) Filters the collection to resources with a
- `target.id` property matching the specified identifier.
- :param str target_crn: (optional) Filters the collection to resources with
- a `target.crn` property matching the specified CRN.
- :param str target_name: (optional) Filters the collection to resources with
- a `target.name` property matching the exact specified name.
- :param str target_resource_type: (optional) Filters the collection to
- resources with a `target.resource_type` property matching the specified
- value.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
+ :param str vpc_id: (optional) Filters the collection to resources with a
+ `vpc.id` property matching the specified identifier.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param str routing_table_id: (optional) Filters the collection to subnets
+ with a `routing_table.id` property matching the specified identifier.
+ :param str routing_table_name: (optional) Filters the collection to subnets
+ with a `routing_table.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
self._resource_group_id = resource_group_id
- self._sort = sort
- self._target_id = target_id
- self._target_crn = target_crn
- self._target_name = target_name
- self._target_resource_type = target_resource_type
+ self._zone_name = zone_name
+ self._vpc_id = vpc_id
+ self._vpc_crn = vpc_crn
+ self._vpc_name = vpc_name
+ self._routing_table_id = routing_table_id
+ self._routing_table_name = routing_table_name
def has_next(self) -> bool:
"""
@@ -174335,20 +179250,21 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of FloatingIP.
+ :return: A List[dict], where each element is a dict that represents an instance of Subnet.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_floating_ips(
+ result = self._client.list_subnets(
limit=self._limit,
resource_group_id=self._resource_group_id,
- sort=self._sort,
- target_id=self._target_id,
- target_crn=self._target_crn,
- target_name=self._target_name,
- target_resource_type=self._target_resource_type,
+ zone_name=self._zone_name,
+ vpc_id=self._vpc_id,
+ vpc_crn=self._vpc_crn,
+ vpc_name=self._vpc_name,
+ routing_table_id=self._routing_table_id,
+ routing_table_name=self._routing_table_name,
start=self._page_context.get('next'),
).get_result()
@@ -174360,13 +179276,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('floating_ips')
+ return result.get('subnets')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of FloatingIP.
+ :return: A List[dict], where each element is a dict that represents an instance of Subnet.
:rtype: List[dict]
"""
results = []
@@ -174376,30 +179292,52 @@ def get_all(self) -> List[dict]:
return results
-class PublicAddressRangesPager:
+class SubnetReservedIpsPager:
"""
- PublicAddressRangesPager can be used to simplify the use of the "list_public_address_ranges" method.
+ SubnetReservedIpsPager can be used to simplify the use of the "list_subnet_reserved_ips" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ subnet_id: str,
limit: int = None,
- resource_group_id: str = None,
+ sort: str = None,
+ target_id: str = None,
+ target_crn: str = None,
+ target_name: str = None,
+ target_resource_type: str = None,
) -> None:
"""
- Initialize a PublicAddressRangesPager object.
+ Initialize a SubnetReservedIpsPager object.
+ :param str subnet_id: The subnet identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching 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 str target_id: (optional) Filters the collection to resources with a
+ `target.id` property matching the specified identifier.
+ :param str target_crn: (optional) Filters the collection to resources with
+ a `target.crn` property matching the specified CRN.
+ :param str target_name: (optional) Filters the collection to resources with
+ a `target.name` property matching the exact specified name.
+ :param str target_resource_type: (optional) Filters the collection to
+ resources with a `target.resource_type` property matching the specified
+ value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._subnet_id = subnet_id
self._limit = limit
- self._resource_group_id = resource_group_id
+ self._sort = sort
+ self._target_id = target_id
+ self._target_crn = target_crn
+ self._target_name = target_name
+ self._target_resource_type = target_resource_type
def has_next(self) -> bool:
"""
@@ -174410,15 +179348,20 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of PublicAddressRange.
+ :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_public_address_ranges(
+ result = self._client.list_subnet_reserved_ips(
+ subnet_id=self._subnet_id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
+ sort=self._sort,
+ target_id=self._target_id,
+ target_crn=self._target_crn,
+ target_name=self._target_name,
+ target_resource_type=self._target_resource_type,
start=self._page_context.get('next'),
).get_result()
@@ -174430,13 +179373,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('public_address_ranges')
+ return result.get('reserved_ips')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of PublicAddressRange.
+ :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
:rtype: List[dict]
"""
results = []
@@ -174446,9 +179389,9 @@ def get_all(self) -> List[dict]:
return results
-class NetworkAclsPager:
+class VirtualNetworkInterfacesPager:
"""
- NetworkAclsPager can be used to simplify the use of the "list_network_acls" method.
+ VirtualNetworkInterfacesPager can be used to simplify the use of the "list_virtual_network_interfaces" method.
"""
def __init__(
@@ -174459,7 +179402,7 @@ def __init__(
resource_group_id: str = None,
) -> None:
"""
- Initialize a NetworkAclsPager object.
+ Initialize a VirtualNetworkInterfacesPager object.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching the specified
@@ -174480,13 +179423,13 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of NetworkACL.
+ :return: A List[dict], where each element is a dict that represents an instance of VirtualNetworkInterface.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_network_acls(
+ result = self._client.list_virtual_network_interfaces(
limit=self._limit,
resource_group_id=self._resource_group_id,
start=self._page_context.get('next'),
@@ -174500,13 +179443,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('network_acls')
+ return result.get('virtual_network_interfaces')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of NetworkACL.
+ :return: A List[dict], where each element is a dict that represents an instance of VirtualNetworkInterface.
:rtype: List[dict]
"""
results = []
@@ -174516,32 +179459,36 @@ def get_all(self) -> List[dict]:
return results
-class NetworkAclRulesPager:
+class NetworkInterfaceFloatingIpsPager:
"""
- NetworkAclRulesPager can be used to simplify the use of the "list_network_acl_rules" method.
+ NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "list_network_interface_floating_ips" method.
"""
def __init__(
self,
*,
client: VpcV1,
- network_acl_id: str,
+ virtual_network_interface_id: str,
limit: int = None,
- direction: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a NetworkAclRulesPager object.
- :param str network_acl_id: The network ACL identifier.
+ Initialize a NetworkInterfaceFloatingIpsPager object.
+ :param str virtual_network_interface_id: The virtual network interface
+ identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str direction: (optional) Filters the collection to rules with a
- `direction` property matching the specified value.
+ :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
+ `-name` sorts the collection by the `name` property in descending order,
+ and the value `name` sorts it by the `name` property in ascending order.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._network_acl_id = network_acl_id
+ self._virtual_network_interface_id = virtual_network_interface_id
self._limit = limit
- self._direction = direction
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -174552,16 +179499,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of NetworkACLRuleItem.
+ :return: A List[dict], where each element is a dict that represents an instance of FloatingIPReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_network_acl_rules(
- network_acl_id=self._network_acl_id,
+ result = self._client.list_network_interface_floating_ips(
+ virtual_network_interface_id=self._virtual_network_interface_id,
limit=self._limit,
- direction=self._direction,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -174573,13 +179520,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('rules')
+ return result.get('floating_ips')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of NetworkACLRuleItem.
+ :return: A List[dict], where each element is a dict that represents an instance of FloatingIPReference.
:rtype: List[dict]
"""
results = []
@@ -174589,42 +179536,36 @@ def get_all(self) -> List[dict]:
return results
-class SecurityGroupsPager:
+class VirtualNetworkInterfaceIpsPager:
"""
- SecurityGroupsPager can be used to simplify the use of the "list_security_groups" method.
+ VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "list_virtual_network_interface_ips" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ virtual_network_interface_id: str,
limit: int = None,
- resource_group_id: str = None,
- vpc_id: str = None,
- vpc_crn: str = None,
- vpc_name: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a SecurityGroupsPager object.
- :param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
+ Initialize a VirtualNetworkInterfaceIpsPager object.
+ :param str virtual_network_interface_id: The virtual network interface
identifier.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
+ :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
+ `-name` sorts the collection by the `name` property in descending order,
+ and the value `name` sorts it by the `name` property in ascending order.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._virtual_network_interface_id = virtual_network_interface_id
self._limit = limit
- self._resource_group_id = resource_group_id
- self._vpc_id = vpc_id
- self._vpc_crn = vpc_crn
- self._vpc_name = vpc_name
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -174635,18 +179576,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of SecurityGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of ReservedIPReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_security_groups(
+ result = self._client.list_virtual_network_interface_ips(
+ virtual_network_interface_id=self._virtual_network_interface_id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
- vpc_id=self._vpc_id,
- vpc_crn=self._vpc_crn,
- vpc_name=self._vpc_name,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -174658,13 +179597,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('security_groups')
+ return result.get('ips')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of SecurityGroup.
+ :return: A List[dict], where each element is a dict that represents an instance of ReservedIPReference.
:rtype: List[dict]
"""
results = []
@@ -174674,27 +179613,24 @@ def get_all(self) -> List[dict]:
return results
-class SecurityGroupTargetsPager:
+class VolumeProfilesPager:
"""
- SecurityGroupTargetsPager can be used to simplify the use of the "list_security_group_targets" method.
+ VolumeProfilesPager can be used to simplify the use of the "list_volume_profiles" method.
"""
def __init__(
self,
*,
client: VpcV1,
- security_group_id: str,
limit: int = None,
) -> None:
"""
- Initialize a SecurityGroupTargetsPager object.
- :param str security_group_id: The security group identifier.
+ Initialize a VolumeProfilesPager object.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._security_group_id = security_group_id
self._limit = limit
def has_next(self) -> bool:
@@ -174706,14 +179642,13 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of SecurityGroupTargetReference.
+ :return: A List[dict], where each element is a dict that represents an instance of VolumeProfile.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_security_group_targets(
- security_group_id=self._security_group_id,
+ result = self._client.list_volume_profiles(
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -174726,13 +179661,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('targets')
+ return result.get('profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of SecurityGroupTargetReference.
+ :return: A List[dict], where each element is a dict that represents an instance of VolumeProfile.
:rtype: List[dict]
"""
results = []
@@ -174742,9 +179677,9 @@ def get_all(self) -> List[dict]:
return results
-class IkePoliciesPager:
+class VolumesPager:
"""
- IkePoliciesPager can be used to simplify the use of the "list_ike_policies" method.
+ VolumesPager can be used to simplify the use of the "list_volumes" method.
"""
def __init__(
@@ -174752,15 +179687,51 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ attachment_state: str = None,
+ encryption: str = None,
+ name: str = None,
+ operating_system_family: str = None,
+ operating_system_architecture: str = None,
+ tag: str = None,
+ zone_name: str = None,
) -> None:
"""
- Initialize a IkePoliciesPager object.
+ Initialize a VolumesPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str attachment_state: (optional) Filters the collection to volumes
+ with an `attachment_state` property matching the specified value.
+ :param str encryption: (optional) Filters the collection to resources with
+ an `encryption` property matching the specified value.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str operating_system_family: (optional) Filters the collection to
+ resources with an `operating_system.family` property matching the specified
+ operating system family.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no operating system or any operating
+ system, respectively.
+ :param str operating_system_architecture: (optional) Filters the collection
+ to resources with an `operating_system.architecture` property matching the
+ specified operating system architecture.
+ This parameter also supports the values `null` and `not:null` which filter
+ the collection to resources which have no operating system or any operating
+ system, respectively.
+ :param str tag: (optional) Filters the collection to resources with an item
+ in the `tags` property matching the exact specified tag.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
+ self._attachment_state = attachment_state
+ self._encryption = encryption
+ self._name = name
+ self._operating_system_family = operating_system_family
+ self._operating_system_architecture = operating_system_architecture
+ self._tag = tag
+ self._zone_name = zone_name
def has_next(self) -> bool:
"""
@@ -174771,14 +179742,21 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of IKEPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of Volume.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_ike_policies(
+ result = self._client.list_volumes(
limit=self._limit,
+ attachment_state=self._attachment_state,
+ encryption=self._encryption,
+ name=self._name,
+ operating_system_family=self._operating_system_family,
+ operating_system_architecture=self._operating_system_architecture,
+ tag=self._tag,
+ zone_name=self._zone_name,
start=self._page_context.get('next'),
).get_result()
@@ -174790,13 +179768,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('ike_policies')
+ return result.get('volumes')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of IKEPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of Volume.
:rtype: List[dict]
"""
results = []
@@ -174806,9 +179784,9 @@ def get_all(self) -> List[dict]:
return results
-class IkePolicyConnectionsPager:
+class VolumeInstanceProfilesPager:
"""
- IkePolicyConnectionsPager can be used to simplify the use of the "list_ike_policy_connections" method.
+ VolumeInstanceProfilesPager can be used to simplify the use of the "list_volume_instance_profiles" method.
"""
def __init__(
@@ -174819,8 +179797,8 @@ def __init__(
limit: int = None,
) -> None:
"""
- Initialize a IkePolicyConnectionsPager object.
- :param str id: The IKE policy identifier.
+ Initialize a VolumeInstanceProfilesPager object.
+ :param str id: The volume identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
@@ -174838,13 +179816,13 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceProfileReference.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_ike_policy_connections(
+ result = self._client.list_volume_instance_profiles(
id=self._id,
limit=self._limit,
start=self._page_context.get('next'),
@@ -174858,13 +179836,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('connections')
+ return result.get('instance_profiles')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
+ :return: A List[dict], where each element is a dict that represents an instance of InstanceProfileReference.
:rtype: List[dict]
"""
results = []
@@ -174874,9 +179852,9 @@ def get_all(self) -> List[dict]:
return results
-class IpsecPoliciesPager:
+class VpcsPager:
"""
- IpsecPoliciesPager can be used to simplify the use of the "list_ipsec_policies" method.
+ VpcsPager can be used to simplify the use of the "list_vpcs" method.
"""
def __init__(
@@ -174884,15 +179862,24 @@ def __init__(
*,
client: VpcV1,
limit: int = None,
+ resource_group_id: str = None,
+ classic_access: bool = None,
) -> None:
"""
- Initialize a IpsecPoliciesPager object.
+ Initialize a VpcsPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching the specified
+ identifier.
+ :param bool classic_access: (optional) Filters the collection to VPCs with
+ a `classic_access` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
self._limit = limit
+ self._resource_group_id = resource_group_id
+ self._classic_access = classic_access
def has_next(self) -> bool:
"""
@@ -174903,14 +179890,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of IPsecPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of VPC.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_ipsec_policies(
+ result = self._client.list_vpcs(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
+ classic_access=self._classic_access,
start=self._page_context.get('next'),
).get_result()
@@ -174922,13 +179911,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('ipsec_policies')
+ return result.get('vpcs')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of IPsecPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of VPC.
:rtype: List[dict]
"""
results = []
@@ -174938,27 +179927,27 @@ def get_all(self) -> List[dict]:
return results
-class IpsecPolicyConnectionsPager:
+class VpcAddressPrefixesPager:
"""
- IpsecPolicyConnectionsPager can be used to simplify the use of the "list_ipsec_policy_connections" method.
+ VpcAddressPrefixesPager can be used to simplify the use of the "list_vpc_address_prefixes" method.
"""
def __init__(
self,
*,
client: VpcV1,
- id: str,
+ vpc_id: str,
limit: int = None,
) -> None:
"""
- Initialize a IpsecPolicyConnectionsPager object.
- :param str id: The IPsec policy identifier.
+ Initialize a VpcAddressPrefixesPager object.
+ :param str vpc_id: The VPC identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._id = id
+ self._vpc_id = vpc_id
self._limit = limit
def has_next(self) -> bool:
@@ -174970,14 +179959,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
+ :return: A List[dict], where each element is a dict that represents an instance of AddressPrefix.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_ipsec_policy_connections(
- id=self._id,
+ result = self._client.list_vpc_address_prefixes(
+ vpc_id=self._vpc_id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -174990,13 +179979,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('connections')
+ return result.get('address_prefixes')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
+ :return: A List[dict], where each element is a dict that represents an instance of AddressPrefix.
:rtype: List[dict]
"""
results = []
@@ -175006,41 +179995,52 @@ def get_all(self) -> List[dict]:
return results
-class VpnGatewaysPager:
+class VpcDnsResolutionBindingsPager:
"""
- VpnGatewaysPager can be used to simplify the use of the "list_vpn_gateways" method.
+ VpcDnsResolutionBindingsPager can be used to simplify the use of the "list_vpc_dns_resolution_bindings" method.
"""
def __init__(
self,
*,
client: VpcV1,
- limit: int = None,
- resource_group_id: str = None,
+ vpc_id: str,
sort: str = None,
- mode: str = None,
+ limit: int = None,
+ name: str = None,
+ vpc_crn: str = None,
+ vpc_name: str = None,
+ account_id: str = None,
) -> None:
"""
- Initialize a VpnGatewaysPager object.
- :param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
+ Initialize a VpcDnsResolutionBindingsPager object.
+ :param str vpc_id: The VPC 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 str mode: (optional) Filters the collection to VPN gateways with a
- `mode` property matching the specified value.
+ :param int limit: (optional) The number of resources to return on a page.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
+ :param str vpc_crn: (optional) Filters the collection to resources with a
+ `vpc.crn` property matching the specified CRN.
+ :param str vpc_name: (optional) Filters the collection to resources with a
+ `vpc.name` property matching the exact specified name.
+ :param str account_id: (optional) Filters the collection to resources with
+ a `vpc.remote.account.id` property matching the specified account
+ identifier.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._limit = limit
- self._resource_group_id = resource_group_id
+ self._vpc_id = vpc_id
self._sort = sort
- self._mode = mode
+ self._limit = limit
+ self._name = name
+ self._vpc_crn = vpc_crn
+ self._vpc_name = vpc_name
+ self._account_id = account_id
def has_next(self) -> bool:
"""
@@ -175051,17 +180051,20 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of VPCDNSResolutionBinding.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpn_gateways(
- limit=self._limit,
- resource_group_id=self._resource_group_id,
+ result = self._client.list_vpc_dns_resolution_bindings(
+ vpc_id=self._vpc_id,
sort=self._sort,
- mode=self._mode,
+ limit=self._limit,
+ name=self._name,
+ vpc_crn=self._vpc_crn,
+ vpc_name=self._vpc_name,
+ account_id=self._account_id,
start=self._page_context.get('next'),
).get_result()
@@ -175073,13 +180076,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('vpn_gateways')
+ return result.get('dns_resolution_bindings')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of VPCDNSResolutionBinding.
:rtype: List[dict]
"""
results = []
@@ -175089,32 +180092,32 @@ def get_all(self) -> List[dict]:
return results
-class VpnGatewayConnectionsPager:
+class VpcRoutesPager:
"""
- VpnGatewayConnectionsPager can be used to simplify the use of the "list_vpn_gateway_connections" method.
+ VpcRoutesPager can be used to simplify the use of the "list_vpc_routes" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpn_gateway_id: str,
+ vpc_id: str,
+ zone_name: str = None,
limit: int = None,
- status: str = None,
) -> None:
"""
- Initialize a VpnGatewayConnectionsPager object.
- :param str vpn_gateway_id: The VPN gateway identifier.
+ Initialize a VpcRoutesPager object.
+ :param str vpc_id: The VPC identifier.
+ :param str zone_name: (optional) Filters the collection to resources with a
+ `zone.name` property matching the exact specified name.
:param int limit: (optional) The number of resources to return on a page.
- :param str status: (optional) Filters the collection to VPN gateway
- connections with a `status` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpn_gateway_id = vpn_gateway_id
+ self._vpc_id = vpc_id
+ self._zone_name = zone_name
self._limit = limit
- self._status = status
def has_next(self) -> bool:
"""
@@ -175125,16 +180128,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
+ :return: A List[dict], where each element is a dict that represents an instance of Route.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpn_gateway_connections(
- vpn_gateway_id=self._vpn_gateway_id,
+ result = self._client.list_vpc_routes(
+ vpc_id=self._vpc_id,
+ zone_name=self._zone_name,
limit=self._limit,
- status=self._status,
start=self._page_context.get('next'),
).get_result()
@@ -175146,13 +180149,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('connections')
+ return result.get('routes')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
+ :return: A List[dict], where each element is a dict that represents an instance of Route.
:rtype: List[dict]
"""
results = []
@@ -175162,41 +180165,32 @@ def get_all(self) -> List[dict]:
return results
-class VpnServersPager:
+class VpcRoutingTablesPager:
"""
- VpnServersPager can be used to simplify the use of the "list_vpn_servers" method.
+ VpcRoutingTablesPager can be used to simplify the use of the "list_vpc_routing_tables" method.
"""
def __init__(
self,
*,
client: VpcV1,
- name: str = None,
+ vpc_id: str,
limit: int = None,
- resource_group_id: str = None,
- sort: str = None,
+ is_default: bool = None,
) -> None:
"""
- Initialize a VpnServersPager object.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ Initialize a VpcRoutingTablesPager object.
+ :param str vpc_id: The VPC identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching 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 bool is_default: (optional) Filters the collection to routing tables
+ with an `is_default` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._name = name
+ self._vpc_id = vpc_id
self._limit = limit
- self._resource_group_id = resource_group_id
- self._sort = sort
+ self._is_default = is_default
def has_next(self) -> bool:
"""
@@ -175207,17 +180201,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNServer.
+ :return: A List[dict], where each element is a dict that represents an instance of RoutingTable.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpn_servers(
- name=self._name,
+ result = self._client.list_vpc_routing_tables(
+ vpc_id=self._vpc_id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
- sort=self._sort,
+ is_default=self._is_default,
start=self._page_context.get('next'),
).get_result()
@@ -175229,13 +180222,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('vpn_servers')
+ return result.get('routing_tables')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNServer.
+ :return: A List[dict], where each element is a dict that represents an instance of RoutingTable.
:rtype: List[dict]
"""
results = []
@@ -175245,34 +180238,31 @@ def get_all(self) -> List[dict]:
return results
-class VpnServerClientsPager:
+class VpcRoutingTableRoutesPager:
"""
- VpnServerClientsPager can be used to simplify the use of the "list_vpn_server_clients" method.
+ VpcRoutingTableRoutesPager can be used to simplify the use of the "list_vpc_routing_table_routes" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpn_server_id: str,
+ vpc_id: str,
+ routing_table_id: str,
limit: int = None,
- sort: str = None,
) -> None:
"""
- Initialize a VpnServerClientsPager object.
- :param str vpn_server_id: The VPN server identifier.
+ Initialize a VpcRoutingTableRoutesPager object.
+ :param str vpc_id: The VPC identifier.
+ :param str routing_table_id: The routing table identifier.
: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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpn_server_id = vpn_server_id
+ self._vpc_id = vpc_id
+ self._routing_table_id = routing_table_id
self._limit = limit
- self._sort = sort
def has_next(self) -> bool:
"""
@@ -175283,16 +180273,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNServerClient.
+ :return: A List[dict], where each element is a dict that represents an instance of Route.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpn_server_clients(
- vpn_server_id=self._vpn_server_id,
+ result = self._client.list_vpc_routing_table_routes(
+ vpc_id=self._vpc_id,
+ routing_table_id=self._routing_table_id,
limit=self._limit,
- sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -175304,13 +180294,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('clients')
+ return result.get('routes')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNServerClient.
+ :return: A List[dict], where each element is a dict that represents an instance of Route.
:rtype: List[dict]
"""
results = []
@@ -175320,35 +180310,25 @@ def get_all(self) -> List[dict]:
return results
-class VpnServerRoutesPager:
+class IkePoliciesPager:
"""
- VpnServerRoutesPager can be used to simplify the use of the "list_vpn_server_routes" method.
+ IkePoliciesPager can be used to simplify the use of the "list_ike_policies" method.
"""
def __init__(
self,
*,
client: VpcV1,
- vpn_server_id: str,
limit: int = None,
- sort: str = None,
) -> None:
"""
- Initialize a VpnServerRoutesPager object.
- :param str vpn_server_id: The VPN server identifier.
+ Initialize a IkePoliciesPager object.
: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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._vpn_server_id = vpn_server_id
self._limit = limit
- self._sort = sort
def has_next(self) -> bool:
"""
@@ -175359,16 +180339,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of VPNServerRoute.
+ :return: A List[dict], where each element is a dict that represents an instance of IKEPolicy.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_vpn_server_routes(
- vpn_server_id=self._vpn_server_id,
+ result = self._client.list_ike_policies(
limit=self._limit,
- sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -175380,13 +180358,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('routes')
+ return result.get('ike_policies')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of VPNServerRoute.
+ :return: A List[dict], where each element is a dict that represents an instance of IKEPolicy.
:rtype: List[dict]
"""
results = []
@@ -175396,24 +180374,27 @@ def get_all(self) -> List[dict]:
return results
-class LoadBalancerProfilesPager:
+class IkePolicyConnectionsPager:
"""
- LoadBalancerProfilesPager can be used to simplify the use of the "list_load_balancer_profiles" method.
+ IkePolicyConnectionsPager can be used to simplify the use of the "list_ike_policy_connections" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ id: str,
limit: int = None,
) -> None:
"""
- Initialize a LoadBalancerProfilesPager object.
+ Initialize a IkePolicyConnectionsPager object.
+ :param str id: The IKE policy identifier.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._id = id
self._limit = limit
def has_next(self) -> bool:
@@ -175425,13 +180406,14 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of LoadBalancerProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_load_balancer_profiles(
+ result = self._client.list_ike_policy_connections(
+ id=self._id,
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -175444,13 +180426,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('profiles')
+ return result.get('connections')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of LoadBalancerProfile.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
:rtype: List[dict]
"""
results = []
@@ -175460,9 +180442,9 @@ def get_all(self) -> List[dict]:
return results
-class LoadBalancersPager:
+class IpsecPoliciesPager:
"""
- LoadBalancersPager can be used to simplify the use of the "list_load_balancers" method.
+ IpsecPoliciesPager can be used to simplify the use of the "list_ipsec_policies" method.
"""
def __init__(
@@ -175472,7 +180454,7 @@ def __init__(
limit: int = None,
) -> None:
"""
- Initialize a LoadBalancersPager object.
+ Initialize a IpsecPoliciesPager object.
:param int limit: (optional) The number of resources to return on a page.
"""
self._has_next = True
@@ -175489,13 +180471,13 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of LoadBalancer.
+ :return: A List[dict], where each element is a dict that represents an instance of IPsecPolicy.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_load_balancers(
+ result = self._client.list_ipsec_policies(
limit=self._limit,
start=self._page_context.get('next'),
).get_result()
@@ -175508,13 +180490,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('load_balancers')
+ return result.get('ipsec_policies')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of LoadBalancer.
+ :return: A List[dict], where each element is a dict that represents an instance of IPsecPolicy.
:rtype: List[dict]
"""
results = []
@@ -175524,56 +180506,28 @@ def get_all(self) -> List[dict]:
return results
-class EndpointGatewaysPager:
+class IpsecPolicyConnectionsPager:
"""
- EndpointGatewaysPager can be used to simplify the use of the "list_endpoint_gateways" method.
+ IpsecPolicyConnectionsPager can be used to simplify the use of the "list_ipsec_policy_connections" method.
"""
def __init__(
self,
*,
client: VpcV1,
- name: str = None,
+ id: str,
limit: int = None,
- resource_group_id: str = None,
- lifecycle_state: List[str] = None,
- vpc_id: str = None,
- vpc_crn: str = None,
- vpc_name: str = None,
- allow_dns_resolution_binding: bool = None,
) -> None:
"""
- Initialize a EndpointGatewaysPager object.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
+ Initialize a IpsecPolicyConnectionsPager object.
+ :param str id: The IPsec policy identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param List[str] lifecycle_state: (optional) Filters the collection to
- resources with a `lifecycle_state` property matching one of the specified
- comma-separated values.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
- :param bool allow_dns_resolution_binding: (optional) Filters the collection
- to endpoint gateways with an `allow_dns_resolution_binding` property
- matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._name = name
+ self._id = id
self._limit = limit
- self._resource_group_id = resource_group_id
- self._lifecycle_state = lifecycle_state
- self._vpc_id = vpc_id
- self._vpc_crn = vpc_crn
- self._vpc_name = vpc_name
- self._allow_dns_resolution_binding = allow_dns_resolution_binding
def has_next(self) -> bool:
"""
@@ -175584,21 +180538,15 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of EndpointGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_endpoint_gateways(
- name=self._name,
+ result = self._client.list_ipsec_policy_connections(
+ id=self._id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
- lifecycle_state=self._lifecycle_state,
- vpc_id=self._vpc_id,
- vpc_crn=self._vpc_crn,
- vpc_name=self._vpc_name,
- allow_dns_resolution_binding=self._allow_dns_resolution_binding,
start=self._page_context.get('next'),
).get_result()
@@ -175610,13 +180558,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('endpoint_gateways')
+ return result.get('connections')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of EndpointGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
:rtype: List[dict]
"""
results = []
@@ -175626,35 +180574,41 @@ def get_all(self) -> List[dict]:
return results
-class EndpointGatewayIpsPager:
+class VpnGatewaysPager:
"""
- EndpointGatewayIpsPager can be used to simplify the use of the "list_endpoint_gateway_ips" method.
+ VpnGatewaysPager can be used to simplify the use of the "list_vpn_gateways" method.
"""
def __init__(
self,
*,
client: VpcV1,
- endpoint_gateway_id: str,
limit: int = None,
+ resource_group_id: str = None,
sort: str = None,
+ mode: str = None,
) -> None:
"""
- Initialize a EndpointGatewayIpsPager object.
- :param str endpoint_gateway_id: The endpoint gateway identifier.
+ Initialize a VpnGatewaysPager object.
:param int limit: (optional) The number of resources to return on a page.
+ :param str resource_group_id: (optional) Filters the collection to
+ resources with a `resource_group.id` property matching 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 str mode: (optional) Filters the collection to VPN gateways with a
+ `mode` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._endpoint_gateway_id = endpoint_gateway_id
self._limit = limit
+ self._resource_group_id = resource_group_id
self._sort = sort
+ self._mode = mode
def has_next(self) -> bool:
"""
@@ -175665,16 +180619,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGateway.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_endpoint_gateway_ips(
- endpoint_gateway_id=self._endpoint_gateway_id,
+ result = self._client.list_vpn_gateways(
limit=self._limit,
+ resource_group_id=self._resource_group_id,
sort=self._sort,
+ mode=self._mode,
start=self._page_context.get('next'),
).get_result()
@@ -175686,13 +180641,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('ips')
+ return result.get('vpn_gateways')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of ReservedIP.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGateway.
:rtype: List[dict]
"""
results = []
@@ -175702,55 +180657,32 @@ def get_all(self) -> List[dict]:
return results
-class FlowLogCollectorsPager:
+class VpnGatewayConnectionsPager:
"""
- FlowLogCollectorsPager can be used to simplify the use of the "list_flow_log_collectors" method.
+ VpnGatewayConnectionsPager can be used to simplify the use of the "list_vpn_gateway_connections" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ vpn_gateway_id: str,
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,
+ status: str = None,
) -> None:
"""
- Initialize a FlowLogCollectorsPager object.
+ Initialize a VpnGatewayConnectionsPager object.
+ :param str vpn_gateway_id: The VPN gateway identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str resource_group_id: (optional) Filters the collection to
- resources with a `resource_group.id` property matching the specified
- identifier.
- :param str name: (optional) Filters the collection to resources with a
- `name` property matching the exact specified name.
- :param str vpc_id: (optional) Filters the collection to resources with a
- `vpc.id` property matching the specified identifier.
- :param str vpc_crn: (optional) Filters the collection to resources with a
- `vpc.crn` property matching the specified CRN.
- :param str vpc_name: (optional) Filters the collection to resources with a
- `vpc.name` property matching the exact specified name.
- :param str target_id: (optional) Filters the collection to resources with a
- `target.id` property matching the specified identifier.
- :param str target_resource_type: (optional) Filters the collection to
- resources with a `target.resource_type` property matching the specified
- value.
+ :param str status: (optional) Filters the collection to VPN gateway
+ connections with a `status` property matching the specified value.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._vpn_gateway_id = vpn_gateway_id
self._limit = limit
- self._resource_group_id = resource_group_id
- self._name = name
- self._vpc_id = vpc_id
- self._vpc_crn = vpc_crn
- self._vpc_name = vpc_name
- self._target_id = target_id
- self._target_resource_type = target_resource_type
+ self._status = status
def has_next(self) -> bool:
"""
@@ -175761,21 +180693,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of FlowLogCollector.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_flow_log_collectors(
+ result = self._client.list_vpn_gateway_connections(
+ vpn_gateway_id=self._vpn_gateway_id,
limit=self._limit,
- resource_group_id=self._resource_group_id,
- name=self._name,
- vpc_id=self._vpc_id,
- vpc_crn=self._vpc_crn,
- vpc_name=self._vpc_name,
- target_id=self._target_id,
- target_resource_type=self._target_resource_type,
+ status=self._status,
start=self._page_context.get('next'),
).get_result()
@@ -175787,13 +180714,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('flow_log_collectors')
+ return result.get('connections')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of FlowLogCollector.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNGatewayConnection.
:rtype: List[dict]
"""
results = []
@@ -175803,30 +180730,41 @@ def get_all(self) -> List[dict]:
return results
-class PrivatePathServiceGatewaysPager:
+class VpnServersPager:
"""
- PrivatePathServiceGatewaysPager can be used to simplify the use of the "list_private_path_service_gateways" method.
+ VpnServersPager can be used to simplify the use of the "list_vpn_servers" method.
"""
def __init__(
self,
*,
client: VpcV1,
+ name: str = None,
limit: int = None,
resource_group_id: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a PrivatePathServiceGatewaysPager object.
+ Initialize a VpnServersPager object.
+ :param str name: (optional) Filters the collection to resources with a
+ `name` property matching the exact specified name.
:param int limit: (optional) The number of resources to return on a page.
:param str resource_group_id: (optional) Filters the collection to
resources with a `resource_group.id` property matching 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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
+ self._name = name
self._limit = limit
self._resource_group_id = resource_group_id
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -175837,15 +180775,17 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNServer.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_private_path_service_gateways(
+ result = self._client.list_vpn_servers(
+ name=self._name,
limit=self._limit,
resource_group_id=self._resource_group_id,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -175857,13 +180797,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('private_path_service_gateways')
+ return result.get('vpn_servers')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGateway.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNServer.
:rtype: List[dict]
"""
results = []
@@ -175873,33 +180813,34 @@ def get_all(self) -> List[dict]:
return results
-class PrivatePathServiceGatewayAccountPoliciesPager:
+class VpnServerClientsPager:
"""
- PrivatePathServiceGatewayAccountPoliciesPager can be used to simplify the use of the "list_private_path_service_gateway_account_policies" method.
+ VpnServerClientsPager can be used to simplify the use of the "list_vpn_server_clients" method.
"""
def __init__(
self,
*,
client: VpcV1,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
limit: int = None,
- account_id: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a PrivatePathServiceGatewayAccountPoliciesPager object.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
+ Initialize a VpnServerClientsPager object.
+ :param str vpn_server_id: The VPN server identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str account_id: (optional) Filters the collection to resources with
- an `account.id` property matching 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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._private_path_service_gateway_id = private_path_service_gateway_id
+ self._vpn_server_id = vpn_server_id
self._limit = limit
- self._account_id = account_id
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -175910,16 +180851,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayAccountPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNServerClient.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_private_path_service_gateway_account_policies(
- private_path_service_gateway_id=self._private_path_service_gateway_id,
+ result = self._client.list_vpn_server_clients(
+ vpn_server_id=self._vpn_server_id,
limit=self._limit,
- account_id=self._account_id,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -175931,13 +180872,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('account_policies')
+ return result.get('clients')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayAccountPolicy.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNServerClient.
:rtype: List[dict]
"""
results = []
@@ -175947,37 +180888,35 @@ def get_all(self) -> List[dict]:
return results
-class PrivatePathServiceGatewayEndpointGatewayBindingsPager:
+class VpnServerRoutesPager:
"""
- PrivatePathServiceGatewayEndpointGatewayBindingsPager can be used to simplify the use of the "list_private_path_service_gateway_endpoint_gateway_bindings" method.
+ VpnServerRoutesPager can be used to simplify the use of the "list_vpn_server_routes" method.
"""
def __init__(
self,
*,
client: VpcV1,
- private_path_service_gateway_id: str,
+ vpn_server_id: str,
limit: int = None,
- status: str = None,
- account_id: str = None,
+ sort: str = None,
) -> None:
"""
- Initialize a PrivatePathServiceGatewayEndpointGatewayBindingsPager object.
- :param str private_path_service_gateway_id: The private path service
- gateway identifier.
+ Initialize a VpnServerRoutesPager object.
+ :param str vpn_server_id: The VPN server identifier.
:param int limit: (optional) The number of resources to return on a page.
- :param str status: (optional) Filters the collection to endpoint gateway
- bindings with a `status` property matching the specified value.
- :param str account_id: (optional) Filters the collection to resources with
- an `account.id` property matching 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.
"""
self._has_next = True
self._client = client
self._page_context = {'next': None}
- self._private_path_service_gateway_id = private_path_service_gateway_id
+ self._vpn_server_id = vpn_server_id
self._limit = limit
- self._status = status
- self._account_id = account_id
+ self._sort = sort
def has_next(self) -> bool:
"""
@@ -175988,17 +180927,16 @@ def has_next(self) -> bool:
def get_next(self) -> List[dict]:
"""
Returns the next page of results.
- :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayEndpointGatewayBinding.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNServerRoute.
:rtype: List[dict]
"""
if not self.has_next():
raise StopIteration(message='No more results available')
- result = self._client.list_private_path_service_gateway_endpoint_gateway_bindings(
- private_path_service_gateway_id=self._private_path_service_gateway_id,
+ result = self._client.list_vpn_server_routes(
+ vpn_server_id=self._vpn_server_id,
limit=self._limit,
- status=self._status,
- account_id=self._account_id,
+ sort=self._sort,
start=self._page_context.get('next'),
).get_result()
@@ -176010,13 +180948,13 @@ def get_next(self) -> List[dict]:
if next is None:
self._has_next = False
- return result.get('endpoint_gateway_bindings')
+ return result.get('routes')
def get_all(self) -> List[dict]:
"""
Returns all results by invoking get_next() repeatedly
until all pages of results have been retrieved.
- :return: A List[dict], where each element is a dict that represents an instance of PrivatePathServiceGatewayEndpointGatewayBinding.
+ :return: A List[dict], where each element is a dict that represents an instance of VPNServerRoute.
:rtype: List[dict]
"""
results = []
diff --git a/test/unit/test_vpc_v1.py b/test/unit/test_vpc_v1.py
index 0f65601..5598c28 100644
--- a/test/unit/test_vpc_v1.py
+++ b/test/unit/test_vpc_v1.py
@@ -32,7 +32,7 @@
from ibm_vpc.vpc_v1 import *
generation = 2
-version = '2025-07-08'
+version = '2025-09-23'
_service = VpcV1(
authenticator=NoAuthAuthenticator(),
@@ -80,7 +80,7 @@ def test_get_service_url_for_region():
##############################################################################
-# Start of Service: VPCs
+# Start of Service: BackupPolicies
##############################################################################
# region
@@ -131,19 +131,19 @@ def test_new_instance_required_param_none(self):
)
-class TestListVpcs:
+class TestListBackupPolicies:
"""
- Test Class for list_vpcs
+ Test Class for list_backup_policies
"""
@responses.activate
- def test_list_vpcs_all_params(self):
+ def test_list_backup_policies_all_params(self):
"""
- list_vpcs()
+ list_backup_policies()
"""
# Set up mock
- url = preprocess_url('/vpcs')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -156,14 +156,16 @@ def test_list_vpcs_all_params(self):
start = 'testString'
limit = 50
resource_group_id = 'testString'
- classic_access = True
+ name = 'my-name'
+ tag = 'testString'
# Invoke method
- response = _service.list_vpcs(
+ response = _service.list_backup_policies(
start=start,
limit=limit,
resource_group_id=resource_group_id,
- classic_access=classic_access,
+ name=name,
+ tag=tag,
headers={},
)
@@ -176,25 +178,26 @@ def test_list_vpcs_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 'classic_access={}'.format('true' if classic_access else 'false') in query_string
+ assert 'name={}'.format(name) in query_string
+ assert 'tag={}'.format(tag) in query_string
- def test_list_vpcs_all_params_with_retries(self):
- # Enable retries and run test_list_vpcs_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_vpcs_all_params()
+ self.test_list_backup_policies_all_params()
- # Disable retries and run test_list_vpcs_all_params.
+ # Disable retries and run test_list_backup_policies_all_params.
_service.disable_retries()
- self.test_list_vpcs_all_params()
+ self.test_list_backup_policies_all_params()
@responses.activate
- def test_list_vpcs_required_params(self):
+ def test_list_backup_policies_required_params(self):
"""
- test_list_vpcs_required_params()
+ test_list_backup_policies_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -204,29 +207,29 @@ def test_list_vpcs_required_params(self):
)
# Invoke method
- response = _service.list_vpcs()
+ response = _service.list_backup_policies()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpcs_required_params_with_retries(self):
- # Enable retries and run test_list_vpcs_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_vpcs_required_params()
+ self.test_list_backup_policies_required_params()
- # Disable retries and run test_list_vpcs_required_params.
+ # Disable retries and run test_list_backup_policies_required_params.
_service.disable_retries()
- self.test_list_vpcs_required_params()
+ self.test_list_backup_policies_required_params()
@responses.activate
- def test_list_vpcs_value_error(self):
+ def test_list_backup_policies_value_error(self):
"""
- test_list_vpcs_value_error()
+ test_list_backup_policies_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -241,26 +244,26 @@ def test_list_vpcs_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_vpcs(**req_copy)
+ _service.list_backup_policies(**req_copy)
- def test_list_vpcs_value_error_with_retries(self):
- # Enable retries and run test_list_vpcs_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_vpcs_value_error()
+ self.test_list_backup_policies_value_error()
- # Disable retries and run test_list_vpcs_value_error.
+ # Disable retries and run test_list_backup_policies_value_error.
_service.disable_retries()
- self.test_list_vpcs_value_error()
+ self.test_list_backup_policies_value_error()
@responses.activate
- def test_list_vpcs_with_pager_get_next(self):
+ def test_list_backup_policies_with_pager_get_next(self):
"""
- test_list_vpcs_with_pager_get_next()
+ test_list_backup_policies_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
+ url = preprocess_url('/backup_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -278,11 +281,12 @@ def test_list_vpcs_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpcsPager(
+ pager = BackupPoliciesPager(
client=_service,
limit=10,
resource_group_id='testString',
- classic_access=True,
+ name='my-name',
+ tag='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -291,14 +295,14 @@ def test_list_vpcs_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpcs_with_pager_get_all(self):
+ def test_list_backup_policies_with_pager_get_all(self):
"""
- test_list_vpcs_with_pager_get_all()
+ test_list_backup_policies_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
+ url = preprocess_url('/backup_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -315,30 +319,31 @@ def test_list_vpcs_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpcsPager(
+ pager = BackupPoliciesPager(
client=_service,
limit=10,
resource_group_id='testString',
- classic_access=True,
+ name='my-name',
+ tag='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVpc:
+class TestCreateBackupPolicy:
"""
- Test Class for create_vpc
+ Test Class for create_backup_policy
"""
@responses.activate
- def test_create_vpc_all_params(self):
+ def test_create_backup_policy_all_params(self):
"""
- create_vpc()
+ create_backup_policy()
"""
# Set up mock
- url = preprocess_url('/vpcs')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ url = preprocess_url('/backup_policies')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
responses.add(
responses.POST,
url,
@@ -351,39 +356,64 @@ def test_create_vpc_all_params(self):
zone_identity_model = {}
zone_identity_model['name'] = 'us-south-1'
- # Construct a dict representation of a DNSServerPrototype model
- dns_server_prototype_model = {}
- dns_server_prototype_model['address'] = '192.168.3.4'
- dns_server_prototype_model['zone_affinity'] = zone_identity_model
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
+ backup_policy_plan_clone_policy_prototype_model = {}
+ backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
+ backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
- # Construct a dict representation of a VPCDNSResolverPrototypeVPCDNSResolverTypeManualPrototype model
- vpcdns_resolver_prototype_model = {}
- vpcdns_resolver_prototype_model['manual_servers'] = [dns_server_prototype_model]
- vpcdns_resolver_prototype_model['type'] = 'manual'
+ # 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 VPCDNSPrototype model
- vpcdns_prototype_model = {}
- vpcdns_prototype_model['enable_hub'] = False
- vpcdns_prototype_model['resolver'] = vpcdns_resolver_prototype_model
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
+
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+
+ # 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['clone_policy'] = backup_policy_plan_clone_policy_prototype_model
+ backup_policy_plan_prototype_model['copy_user_tags'] = True
+ backup_policy_plan_prototype_model['cron_spec'] = '30 */2 * * 1-5'
+ backup_policy_plan_prototype_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_prototype_model
+ backup_policy_plan_prototype_model['name'] = 'my-policy-plan'
+ backup_policy_plan_prototype_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model
+ backup_policy_scope_prototype_model = {}
+ backup_policy_scope_prototype_model['crn'] = 'crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce'
+
+ # Construct a dict representation of a BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model
+ backup_policy_prototype_model = {}
+ backup_policy_prototype_model['match_user_tags'] = ['my-daily-backup-policy']
+ backup_policy_prototype_model['name'] = 'my-backup-policy'
+ backup_policy_prototype_model['plans'] = [backup_policy_plan_prototype_model]
+ backup_policy_prototype_model['resource_group'] = resource_group_identity_model
+ backup_policy_prototype_model['scope'] = backup_policy_scope_prototype_model
+ backup_policy_prototype_model['match_resource_type'] = 'volume'
+
# Set up parameter values
- address_prefix_management = 'auto'
- classic_access = False
- dns = vpcdns_prototype_model
- name = 'my-vpc'
- resource_group = resource_group_identity_model
+ backup_policy_prototype = backup_policy_prototype_model
# Invoke method
- response = _service.create_vpc(
- address_prefix_management=address_prefix_management,
- classic_access=classic_access,
- dns=dns,
- name=name,
- resource_group=resource_group,
+ response = _service.create_backup_policy(
+ backup_policy_prototype,
headers={},
)
@@ -392,29 +422,25 @@ def test_create_vpc_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['address_prefix_management'] == 'auto'
- assert req_body['classic_access'] == False
- assert req_body['dns'] == vpcdns_prototype_model
- assert req_body['name'] == 'my-vpc'
- assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body == backup_policy_prototype
- def test_create_vpc_all_params_with_retries(self):
- # Enable retries and run test_create_vpc_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_vpc_all_params()
+ self.test_create_backup_policy_all_params()
- # Disable retries and run test_create_vpc_all_params.
+ # Disable retries and run test_create_backup_policy_all_params.
_service.disable_retries()
- self.test_create_vpc_all_params()
+ self.test_create_backup_policy_all_params()
@responses.activate
- def test_create_vpc_required_params(self):
+ def test_create_backup_policy_value_error(self):
"""
- test_create_vpc_required_params()
+ test_create_backup_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ url = preprocess_url('/backup_policies')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
responses.add(
responses.POST,
url,
@@ -423,482 +449,455 @@ def test_create_vpc_required_params(self):
status=201,
)
- # Invoke method
- response = _service.create_vpc()
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 201
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
+ backup_policy_plan_clone_policy_prototype_model = {}
+ backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
+ backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
- def test_create_vpc_required_params_with_retries(self):
- # Enable retries and run test_create_vpc_required_params.
- _service.enable_retries()
- self.test_create_vpc_required_params()
+ # 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
- # Disable retries and run test_create_vpc_required_params.
- _service.disable_retries()
- self.test_create_vpc_required_params()
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
- @responses.activate
- def test_create_vpc_value_error(self):
- """
- test_create_vpc_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpcs')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
- responses.add(
- responses.POST,
- url,
- body=mock_response,
- content_type='application/json',
- status=201,
- )
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
+
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+
+ # 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['clone_policy'] = backup_policy_plan_clone_policy_prototype_model
+ backup_policy_plan_prototype_model['copy_user_tags'] = True
+ backup_policy_plan_prototype_model['cron_spec'] = '30 */2 * * 1-5'
+ backup_policy_plan_prototype_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_prototype_model
+ backup_policy_plan_prototype_model['name'] = 'my-policy-plan'
+ backup_policy_plan_prototype_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Construct a dict representation of a BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model
+ backup_policy_scope_prototype_model = {}
+ backup_policy_scope_prototype_model['crn'] = 'crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce'
+
+ # Construct a dict representation of a BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model
+ backup_policy_prototype_model = {}
+ backup_policy_prototype_model['match_user_tags'] = ['my-daily-backup-policy']
+ backup_policy_prototype_model['name'] = 'my-backup-policy'
+ backup_policy_prototype_model['plans'] = [backup_policy_plan_prototype_model]
+ backup_policy_prototype_model['resource_group'] = resource_group_identity_model
+ backup_policy_prototype_model['scope'] = backup_policy_scope_prototype_model
+ backup_policy_prototype_model['match_resource_type'] = 'volume'
+
+ # Set up parameter values
+ backup_policy_prototype = backup_policy_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "backup_policy_prototype": backup_policy_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_vpc(**req_copy)
+ _service.create_backup_policy(**req_copy)
- def test_create_vpc_value_error_with_retries(self):
- # Enable retries and run test_create_vpc_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_vpc_value_error()
+ self.test_create_backup_policy_value_error()
- # Disable retries and run test_create_vpc_value_error.
+ # Disable retries and run test_create_backup_policy_value_error.
_service.disable_retries()
- self.test_create_vpc_value_error()
+ self.test_create_backup_policy_value_error()
-class TestDeleteVpc:
+class TestListBackupPolicyJobs:
"""
- Test Class for delete_vpc
+ Test Class for list_backup_policy_jobs
"""
@responses.activate
- def test_delete_vpc_all_params(self):
+ def test_list_backup_policy_jobs_all_params(self):
"""
- delete_vpc()
+ list_backup_policy_jobs()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString')
+ url = preprocess_url('/backup_policies/testString/jobs')
+ mock_response = '{"first": {"href": "href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ backup_policy_id = 'testString'
+ status = 'failed'
+ backup_policy_plan_id = 'testString'
+ start = 'testString'
+ limit = 50
+ sort = 'name'
+ source_id = 'testString'
+ target_snapshots_id = 'testString'
+ target_snapshots_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
# Invoke method
- response = _service.delete_vpc(
- id,
- if_match=if_match,
+ response = _service.list_backup_policy_jobs(
+ backup_policy_id,
+ status=status,
+ backup_policy_plan_id=backup_policy_plan_id,
+ start=start,
+ limit=limit,
+ sort=sort,
+ source_id=source_id,
+ target_snapshots_id=target_snapshots_id,
+ target_snapshots_crn=target_snapshots_crn,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ 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
+ assert 'backup_policy_plan.id={}'.format(backup_policy_plan_id) in query_string
+ assert 'start={}'.format(start) in query_string
+ assert 'limit={}'.format(limit) in query_string
+ assert 'sort={}'.format(sort) in query_string
+ assert 'source.id={}'.format(source_id) in query_string
+ assert 'target_snapshots[].id={}'.format(target_snapshots_id) in query_string
+ assert 'target_snapshots[].crn={}'.format(target_snapshots_crn) in query_string
- def test_delete_vpc_all_params_with_retries(self):
- # Enable retries and run test_delete_vpc_all_params.
+ def test_list_backup_policy_jobs_all_params_with_retries(self):
+ # Enable retries and run test_list_backup_policy_jobs_all_params.
_service.enable_retries()
- self.test_delete_vpc_all_params()
+ self.test_list_backup_policy_jobs_all_params()
- # Disable retries and run test_delete_vpc_all_params.
+ # Disable retries and run test_list_backup_policy_jobs_all_params.
_service.disable_retries()
- self.test_delete_vpc_all_params()
+ self.test_list_backup_policy_jobs_all_params()
@responses.activate
- def test_delete_vpc_required_params(self):
+ def test_list_backup_policy_jobs_required_params(self):
"""
- test_delete_vpc_required_params()
+ test_list_backup_policy_jobs_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString')
+ url = preprocess_url('/backup_policies/testString/jobs')
+ mock_response = '{"first": {"href": "href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ backup_policy_id = 'testString'
# Invoke method
- response = _service.delete_vpc(
- id,
+ response = _service.list_backup_policy_jobs(
+ backup_policy_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_vpc_required_params_with_retries(self):
- # Enable retries and run test_delete_vpc_required_params.
+ def test_list_backup_policy_jobs_required_params_with_retries(self):
+ # Enable retries and run test_list_backup_policy_jobs_required_params.
_service.enable_retries()
- self.test_delete_vpc_required_params()
+ self.test_list_backup_policy_jobs_required_params()
- # Disable retries and run test_delete_vpc_required_params.
+ # Disable retries and run test_list_backup_policy_jobs_required_params.
_service.disable_retries()
- self.test_delete_vpc_required_params()
+ self.test_list_backup_policy_jobs_required_params()
@responses.activate
- def test_delete_vpc_value_error(self):
+ def test_list_backup_policy_jobs_value_error(self):
"""
- test_delete_vpc_value_error()
+ test_list_backup_policy_jobs_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString')
+ url = preprocess_url('/backup_policies/testString/jobs')
+ mock_response = '{"first": {"href": "href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ 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.delete_vpc(**req_copy)
+ _service.list_backup_policy_jobs(**req_copy)
- def test_delete_vpc_value_error_with_retries(self):
- # Enable retries and run test_delete_vpc_value_error.
+ def test_list_backup_policy_jobs_value_error_with_retries(self):
+ # Enable retries and run test_list_backup_policy_jobs_value_error.
_service.enable_retries()
- self.test_delete_vpc_value_error()
+ self.test_list_backup_policy_jobs_value_error()
- # Disable retries and run test_delete_vpc_value_error.
+ # Disable retries and run test_list_backup_policy_jobs_value_error.
_service.disable_retries()
- self.test_delete_vpc_value_error()
-
-
-class TestGetVpc:
- """
- Test Class for get_vpc
- """
+ self.test_list_backup_policy_jobs_value_error()
@responses.activate
- def test_get_vpc_all_params(self):
+ def test_list_backup_policy_jobs_with_pager_get_next(self):
"""
- get_vpc()
+ test_list_backup_policy_jobs_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/vpcs/testString')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ # Set up a two-page mock response
+ url = preprocess_url('/backup_policies/testString/jobs')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
+ mock_response2 = '{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
content_type='application/json',
status=200,
)
-
- # Set up parameter values
- id = 'testString'
-
- # Invoke method
- response = _service.get_vpc(
- id,
- headers={},
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_vpc_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_all_params.
- _service.enable_retries()
- self.test_get_vpc_all_params()
-
- # Disable retries and run test_get_vpc_all_params.
- _service.disable_retries()
- self.test_get_vpc_all_params()
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = BackupPolicyJobsPager(
+ client=_service,
+ backup_policy_id='testString',
+ status='failed',
+ backup_policy_plan_id='testString',
+ limit=10,
+ sort='name',
+ source_id='testString',
+ target_snapshots_id='testString',
+ target_snapshots_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_get_vpc_value_error(self):
+ def test_list_backup_policy_jobs_with_pager_get_all(self):
"""
- test_get_vpc_value_error()
+ test_list_backup_policy_jobs_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/vpcs/testString')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ # Set up a two-page mock response
+ url = preprocess_url('/backup_policies/testString/jobs')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
+ mock_response2 = '{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
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_vpc(**req_copy)
-
- def test_get_vpc_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_value_error.
- _service.enable_retries()
- self.test_get_vpc_value_error()
-
- # Disable retries and run test_get_vpc_value_error.
- _service.disable_retries()
- self.test_get_vpc_value_error()
+ # Exercise the pager class for this operation
+ pager = BackupPolicyJobsPager(
+ client=_service,
+ backup_policy_id='testString',
+ status='failed',
+ backup_policy_plan_id='testString',
+ limit=10,
+ sort='name',
+ source_id='testString',
+ target_snapshots_id='testString',
+ target_snapshots_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestUpdateVpc:
+class TestGetBackupPolicyJob:
"""
- Test Class for update_vpc
+ Test Class for get_backup_policy_job
"""
@responses.activate
- def test_update_vpc_all_params(self):
+ def test_get_backup_policy_job_all_params(self):
"""
- update_vpc()
+ get_backup_policy_job()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ url = preprocess_url('/backup_policies/testString/jobs/testString')
+ mock_response = '{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a DNSServerPrototype model
- dns_server_prototype_model = {}
- dns_server_prototype_model['address'] = '192.168.3.4'
- dns_server_prototype_model['zone_affinity'] = zone_identity_model
-
- # Construct a dict representation of a VPCDNSResolverVPCPatchVPCIdentityById model
- vpcdns_resolver_vpc_patch_model = {}
- vpcdns_resolver_vpc_patch_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a VPCDNSResolverPatch model
- vpcdns_resolver_patch_model = {}
- vpcdns_resolver_patch_model['manual_servers'] = [dns_server_prototype_model]
- vpcdns_resolver_patch_model['type'] = 'delegated'
- vpcdns_resolver_patch_model['vpc'] = vpcdns_resolver_vpc_patch_model
-
- # Construct a dict representation of a VPCDNSPatch model
- vpcdns_patch_model = {}
- vpcdns_patch_model['enable_hub'] = True
- vpcdns_patch_model['resolver'] = vpcdns_resolver_patch_model
-
- # Construct a dict representation of a VPCPatch model
- vpc_patch_model = {}
- vpc_patch_model['dns'] = vpcdns_patch_model
- vpc_patch_model['name'] = 'my-vpc'
-
# Set up parameter values
+ backup_policy_id = 'testString'
id = 'testString'
- vpc_patch = vpc_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_vpc(
+ response = _service.get_backup_policy_job(
+ backup_policy_id,
id,
- vpc_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 == vpc_patch
- def test_update_vpc_all_params_with_retries(self):
- # Enable retries and run test_update_vpc_all_params.
+ def test_get_backup_policy_job_all_params_with_retries(self):
+ # Enable retries and run test_get_backup_policy_job_all_params.
_service.enable_retries()
- self.test_update_vpc_all_params()
+ self.test_get_backup_policy_job_all_params()
- # Disable retries and run test_update_vpc_all_params.
+ # Disable retries and run test_get_backup_policy_job_all_params.
_service.disable_retries()
- self.test_update_vpc_all_params()
+ self.test_get_backup_policy_job_all_params()
@responses.activate
- def test_update_vpc_required_params(self):
+ def test_get_backup_policy_job_value_error(self):
"""
- test_update_vpc_required_params()
+ test_get_backup_policy_job_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ url = preprocess_url('/backup_policies/testString/jobs/testString')
+ mock_response = '{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a DNSServerPrototype model
- dns_server_prototype_model = {}
- dns_server_prototype_model['address'] = '192.168.3.4'
- dns_server_prototype_model['zone_affinity'] = zone_identity_model
-
- # Construct a dict representation of a VPCDNSResolverVPCPatchVPCIdentityById model
- vpcdns_resolver_vpc_patch_model = {}
- vpcdns_resolver_vpc_patch_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a VPCDNSResolverPatch model
- vpcdns_resolver_patch_model = {}
- vpcdns_resolver_patch_model['manual_servers'] = [dns_server_prototype_model]
- vpcdns_resolver_patch_model['type'] = 'delegated'
- vpcdns_resolver_patch_model['vpc'] = vpcdns_resolver_vpc_patch_model
-
- # Construct a dict representation of a VPCDNSPatch model
- vpcdns_patch_model = {}
- vpcdns_patch_model['enable_hub'] = True
- vpcdns_patch_model['resolver'] = vpcdns_resolver_patch_model
-
- # Construct a dict representation of a VPCPatch model
- vpc_patch_model = {}
- vpc_patch_model['dns'] = vpcdns_patch_model
- vpc_patch_model['name'] = 'my-vpc'
-
# Set up parameter values
+ backup_policy_id = 'testString'
id = 'testString'
- vpc_patch = vpc_patch_model
-
- # Invoke method
- response = _service.update_vpc(
- id,
- vpc_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 == vpc_patch
+ # 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.get_backup_policy_job(**req_copy)
- def test_update_vpc_required_params_with_retries(self):
- # Enable retries and run test_update_vpc_required_params.
+ def test_get_backup_policy_job_value_error_with_retries(self):
+ # Enable retries and run test_get_backup_policy_job_value_error.
_service.enable_retries()
- self.test_update_vpc_required_params()
+ self.test_get_backup_policy_job_value_error()
- # Disable retries and run test_update_vpc_required_params.
+ # Disable retries and run test_get_backup_policy_job_value_error.
_service.disable_retries()
- self.test_update_vpc_required_params()
+ self.test_get_backup_policy_job_value_error()
+
+
+class TestListBackupPolicyPlans:
+ """
+ Test Class for list_backup_policy_plans
+ """
@responses.activate
- def test_update_vpc_value_error(self):
+ def test_list_backup_policy_plans_all_params(self):
"""
- test_update_vpc_value_error()
+ list_backup_policy_plans()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString')
- mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ url = preprocess_url('/backup_policies/testString/plans')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a DNSServerPrototype model
- dns_server_prototype_model = {}
- dns_server_prototype_model['address'] = '192.168.3.4'
- dns_server_prototype_model['zone_affinity'] = zone_identity_model
-
- # Construct a dict representation of a VPCDNSResolverVPCPatchVPCIdentityById model
- vpcdns_resolver_vpc_patch_model = {}
- vpcdns_resolver_vpc_patch_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a VPCDNSResolverPatch model
- vpcdns_resolver_patch_model = {}
- vpcdns_resolver_patch_model['manual_servers'] = [dns_server_prototype_model]
- vpcdns_resolver_patch_model['type'] = 'delegated'
- vpcdns_resolver_patch_model['vpc'] = vpcdns_resolver_vpc_patch_model
-
- # Construct a dict representation of a VPCDNSPatch model
- vpcdns_patch_model = {}
- vpcdns_patch_model['enable_hub'] = True
- vpcdns_patch_model['resolver'] = vpcdns_resolver_patch_model
-
- # Construct a dict representation of a VPCPatch model
- vpc_patch_model = {}
- vpc_patch_model['dns'] = vpcdns_patch_model
- vpc_patch_model['name'] = 'my-vpc'
-
# Set up parameter values
- id = 'testString'
- vpc_patch = vpc_patch_model
+ backup_policy_id = 'testString'
+ name = 'my-name'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "vpc_patch": vpc_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_vpc(**req_copy)
+ # Invoke method
+ response = _service.list_backup_policy_plans(
+ backup_policy_id,
+ name=name,
+ headers={},
+ )
- def test_update_vpc_value_error_with_retries(self):
- # Enable retries and run test_update_vpc_value_error.
+ # 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 'name={}'.format(name) in query_string
+
+ 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_update_vpc_value_error()
+ self.test_list_backup_policy_plans_all_params()
- # Disable retries and run test_update_vpc_value_error.
+ # Disable retries and run test_list_backup_policy_plans_all_params.
_service.disable_retries()
- self.test_update_vpc_value_error()
-
-
-class TestGetVpcDefaultNetworkAcl:
- """
- Test Class for get_vpc_default_network_acl
- """
+ self.test_list_backup_policy_plans_all_params()
@responses.activate
- def test_get_vpc_default_network_acl_all_params(self):
+ def test_list_backup_policy_plans_required_params(self):
"""
- get_vpc_default_network_acl()
+ test_list_backup_policy_plans_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/default_network_acl')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/backup_policies/testString/plans')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -908,11 +907,11 @@ def test_get_vpc_default_network_acl_all_params(self):
)
# Set up parameter values
- id = 'testString'
+ backup_policy_id = 'testString'
# Invoke method
- response = _service.get_vpc_default_network_acl(
- id,
+ response = _service.list_backup_policy_plans(
+ backup_policy_id,
headers={},
)
@@ -920,23 +919,23 @@ def test_get_vpc_default_network_acl_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_vpc_default_network_acl_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_default_network_acl_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_vpc_default_network_acl_all_params()
+ self.test_list_backup_policy_plans_required_params()
- # Disable retries and run test_get_vpc_default_network_acl_all_params.
+ # Disable retries and run test_list_backup_policy_plans_required_params.
_service.disable_retries()
- self.test_get_vpc_default_network_acl_all_params()
+ self.test_list_backup_policy_plans_required_params()
@responses.activate
- def test_get_vpc_default_network_acl_value_error(self):
+ def test_list_backup_policy_plans_value_error(self):
"""
- test_get_vpc_default_network_acl_value_error()
+ test_list_backup_policy_plans_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/default_network_acl')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/backup_policies/testString/plans')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -946,249 +945,339 @@ def test_get_vpc_default_network_acl_value_error(self):
)
# 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_vpc_default_network_acl(**req_copy)
+ _service.list_backup_policy_plans(**req_copy)
- def test_get_vpc_default_network_acl_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_default_network_acl_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_vpc_default_network_acl_value_error()
+ self.test_list_backup_policy_plans_value_error()
- # Disable retries and run test_get_vpc_default_network_acl_value_error.
+ # Disable retries and run test_list_backup_policy_plans_value_error.
_service.disable_retries()
- self.test_get_vpc_default_network_acl_value_error()
+ self.test_list_backup_policy_plans_value_error()
-class TestGetVpcDefaultRoutingTable:
+class TestCreateBackupPolicyPlan:
"""
- Test Class for get_vpc_default_routing_table
+ Test Class for create_backup_policy_plan
"""
@responses.activate
- def test_get_vpc_default_routing_table_all_params(self):
+ def test_create_backup_policy_plan_all_params(self):
"""
- get_vpc_default_routing_table()
+ create_backup_policy_plan()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/default_routing_table')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/backup_policies/testString/plans')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
+ backup_policy_plan_clone_policy_prototype_model = {}
+ backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
+ backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
+
+ # 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 EncryptionKeyIdentityByCRN model
+ encryption_key_identity_model = {}
+ encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
+
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+
# Set up parameter values
- id = 'testString'
+ backup_policy_id = 'testString'
+ cron_spec = '30 */2 * * 1-5'
+ active = True
+ attach_user_tags = ['my-daily-backup-plan']
+ clone_policy = backup_policy_plan_clone_policy_prototype_model
+ copy_user_tags = True
+ deletion_trigger = backup_policy_plan_deletion_trigger_prototype_model
+ name = 'my-policy-plan'
+ remote_region_policies = [backup_policy_plan_remote_region_policy_prototype_model]
# Invoke method
- response = _service.get_vpc_default_routing_table(
- id,
+ response = _service.create_backup_policy_plan(
+ backup_policy_id,
+ cron_spec,
+ active=active,
+ attach_user_tags=attach_user_tags,
+ clone_policy=clone_policy,
+ copy_user_tags=copy_user_tags,
+ deletion_trigger=deletion_trigger,
+ name=name,
+ remote_region_policies=remote_region_policies,
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['cron_spec'] == '30 */2 * * 1-5'
+ assert req_body['active'] == True
+ assert req_body['attach_user_tags'] == ['my-daily-backup-plan']
+ assert req_body['clone_policy'] == backup_policy_plan_clone_policy_prototype_model
+ 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'
+ assert req_body['remote_region_policies'] == [backup_policy_plan_remote_region_policy_prototype_model]
- def test_get_vpc_default_routing_table_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_default_routing_table_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_get_vpc_default_routing_table_all_params()
+ self.test_create_backup_policy_plan_all_params()
- # Disable retries and run test_get_vpc_default_routing_table_all_params.
+ # Disable retries and run test_create_backup_policy_plan_all_params.
_service.disable_retries()
- self.test_get_vpc_default_routing_table_all_params()
+ self.test_create_backup_policy_plan_all_params()
@responses.activate
- def test_get_vpc_default_routing_table_value_error(self):
+ def test_create_backup_policy_plan_value_error(self):
"""
- test_get_vpc_default_routing_table_value_error()
+ test_create_backup_policy_plan_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/default_routing_table')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/backup_policies/testString/plans')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
+ backup_policy_plan_clone_policy_prototype_model = {}
+ backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
+ backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
+
+ # 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 EncryptionKeyIdentityByCRN model
+ encryption_key_identity_model = {}
+ encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
+
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+
# Set up parameter values
- id = 'testString'
+ backup_policy_id = 'testString'
+ cron_spec = '30 */2 * * 1-5'
+ active = True
+ attach_user_tags = ['my-daily-backup-plan']
+ clone_policy = backup_policy_plan_clone_policy_prototype_model
+ copy_user_tags = True
+ deletion_trigger = backup_policy_plan_deletion_trigger_prototype_model
+ name = 'my-policy-plan'
+ remote_region_policies = [backup_policy_plan_remote_region_policy_prototype_model]
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "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.get_vpc_default_routing_table(**req_copy)
+ _service.create_backup_policy_plan(**req_copy)
- def test_get_vpc_default_routing_table_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_default_routing_table_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_get_vpc_default_routing_table_value_error()
+ self.test_create_backup_policy_plan_value_error()
- # Disable retries and run test_get_vpc_default_routing_table_value_error.
+ # Disable retries and run test_create_backup_policy_plan_value_error.
_service.disable_retries()
- self.test_get_vpc_default_routing_table_value_error()
+ self.test_create_backup_policy_plan_value_error()
-class TestGetVpcDefaultSecurityGroup:
+class TestDeleteBackupPolicyPlan:
"""
- Test Class for get_vpc_default_security_group
+ Test Class for delete_backup_policy_plan
"""
@responses.activate
- def test_get_vpc_default_security_group_all_params(self):
+ def test_delete_backup_policy_plan_all_params(self):
"""
- get_vpc_default_security_group()
+ delete_backup_policy_plan()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/default_security_group')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
+ backup_policy_id = 'testString'
id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.get_vpc_default_security_group(
+ 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
+ assert response.status_code == 202
- def test_get_vpc_default_security_group_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_default_security_group_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_get_vpc_default_security_group_all_params()
+ self.test_delete_backup_policy_plan_all_params()
- # Disable retries and run test_get_vpc_default_security_group_all_params.
+ # Disable retries and run test_delete_backup_policy_plan_all_params.
_service.disable_retries()
- self.test_get_vpc_default_security_group_all_params()
+ self.test_delete_backup_policy_plan_all_params()
@responses.activate
- def test_get_vpc_default_security_group_value_error(self):
+ def test_delete_backup_policy_plan_required_params(self):
"""
- test_get_vpc_default_security_group_value_error()
+ test_delete_backup_policy_plan_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/default_security_group')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.GET,
+ 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 = {
- "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_vpc_default_security_group(**req_copy)
+ # Invoke method
+ response = _service.delete_backup_policy_plan(
+ backup_policy_id,
+ id,
+ headers={},
+ )
- def test_get_vpc_default_security_group_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_default_security_group_value_error.
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ 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_get_vpc_default_security_group_value_error()
+ self.test_delete_backup_policy_plan_required_params()
- # Disable retries and run test_get_vpc_default_security_group_value_error.
+ # Disable retries and run test_delete_backup_policy_plan_required_params.
_service.disable_retries()
- self.test_get_vpc_default_security_group_value_error()
-
-
-class TestListVpcAddressPrefixes:
- """
- Test Class for list_vpc_address_prefixes
- """
+ self.test_delete_backup_policy_plan_required_params()
@responses.activate
- def test_list_vpc_address_prefixes_all_params(self):
+ def test_delete_backup_policy_plan_value_error(self):
"""
- list_vpc_address_prefixes()
+ test_delete_backup_policy_plan_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response = '{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- vpc_id = 'testString'
- start = 'testString'
- limit = 50
-
- # Invoke method
- response = _service.list_vpc_address_prefixes(
- vpc_id,
- start=start,
- limit=limit,
- headers={},
- )
+ backup_policy_id = 'testString'
+ id = 'testString'
- # 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
+ # 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.delete_backup_policy_plan(**req_copy)
- def test_list_vpc_address_prefixes_all_params_with_retries(self):
- # Enable retries and run test_list_vpc_address_prefixes_all_params.
+ 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_vpc_address_prefixes_all_params()
+ self.test_delete_backup_policy_plan_value_error()
- # Disable retries and run test_list_vpc_address_prefixes_all_params.
+ # Disable retries and run test_delete_backup_policy_plan_value_error.
_service.disable_retries()
- self.test_list_vpc_address_prefixes_all_params()
+ self.test_delete_backup_policy_plan_value_error()
+
+
+class TestGetBackupPolicyPlan:
+ """
+ Test Class for get_backup_policy_plan
+ """
@responses.activate
- def test_list_vpc_address_prefixes_required_params(self):
+ def test_get_backup_policy_plan_all_params(self):
"""
- test_list_vpc_address_prefixes_required_params()
+ get_backup_policy_plan()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response = '{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
responses.GET,
url,
@@ -1198,11 +1287,13 @@ def test_list_vpc_address_prefixes_required_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
+ backup_policy_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_vpc_address_prefixes(
- vpc_id,
+ response = _service.get_backup_policy_plan(
+ backup_policy_id,
+ id,
headers={},
)
@@ -1210,23 +1301,23 @@ def test_list_vpc_address_prefixes_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpc_address_prefixes_required_params_with_retries(self):
- # Enable retries and run test_list_vpc_address_prefixes_required_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_list_vpc_address_prefixes_required_params()
+ self.test_get_backup_policy_plan_all_params()
- # Disable retries and run test_list_vpc_address_prefixes_required_params.
+ # Disable retries and run test_get_backup_policy_plan_all_params.
_service.disable_retries()
- self.test_list_vpc_address_prefixes_required_params()
+ self.test_get_backup_policy_plan_all_params()
@responses.activate
- def test_list_vpc_address_prefixes_value_error(self):
+ def test_get_backup_policy_plan_value_error(self):
"""
- test_list_vpc_address_prefixes_value_error()
+ test_get_backup_policy_plan_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response = '{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
responses.GET,
url,
@@ -1236,339 +1327,457 @@ def test_list_vpc_address_prefixes_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
+ backup_policy_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
+ "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_vpc_address_prefixes(**req_copy)
+ _service.get_backup_policy_plan(**req_copy)
- def test_list_vpc_address_prefixes_value_error_with_retries(self):
- # Enable retries and run test_list_vpc_address_prefixes_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_list_vpc_address_prefixes_value_error()
+ self.test_get_backup_policy_plan_value_error()
- # Disable retries and run test_list_vpc_address_prefixes_value_error.
+ # Disable retries and run test_get_backup_policy_plan_value_error.
_service.disable_retries()
- self.test_list_vpc_address_prefixes_value_error()
-
- @responses.activate
- def test_list_vpc_address_prefixes_with_pager_get_next(self):
- """
- test_list_vpc_address_prefixes_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = VpcAddressPrefixesPager(
- client=_service,
- vpc_id='testString',
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_vpc_address_prefixes_with_pager_get_all(self):
- """
- test_list_vpc_address_prefixes_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = VpcAddressPrefixesPager(
- client=_service,
- vpc_id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_get_backup_policy_plan_value_error()
-class TestCreateVpcAddressPrefix:
+class TestUpdateBackupPolicyPlan:
"""
- Test Class for create_vpc_address_prefix
+ Test Class for update_backup_policy_plan
"""
@responses.activate
- def test_create_vpc_address_prefix_all_params(self):
+ def test_update_backup_policy_plan_all_params(self):
"""
- create_vpc_address_prefix()
+ update_backup_policy_plan()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
# Construct a dict representation of a ZoneIdentityByName model
zone_identity_model = {}
zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPatch model
+ backup_policy_plan_clone_policy_patch_model = {}
+ backup_policy_plan_clone_policy_patch_model['max_snapshots'] = 1
+ backup_policy_plan_clone_policy_patch_model['zones'] = [zone_identity_model]
+
+ # 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'] = 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
+
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+
+ # 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['clone_policy'] = backup_policy_plan_clone_policy_patch_model
+ backup_policy_plan_patch_model['copy_user_tags'] = False
+ backup_policy_plan_patch_model['cron_spec'] = '30 */2 * * 1-5'
+ backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model
+ backup_policy_plan_patch_model['name'] = 'my-policy-plan'
+ backup_policy_plan_patch_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
+
# Set up parameter values
- vpc_id = 'testString'
- cidr = '10.240.0.0/18'
- zone = zone_identity_model
- is_default = True
- name = 'my-vpc-address-prefix-zone-1'
+ 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.create_vpc_address_prefix(
- vpc_id,
- cidr,
- zone,
- is_default=is_default,
- name=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 == 201
+ assert response.status_code == 200
# Validate body params
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body['cidr'] == '10.240.0.0/18'
- assert req_body['zone'] == zone_identity_model
- assert req_body['is_default'] == True
- assert req_body['name'] == 'my-vpc-address-prefix-zone-1'
+ assert req_body == backup_policy_plan_patch
- def test_create_vpc_address_prefix_all_params_with_retries(self):
- # Enable retries and run test_create_vpc_address_prefix_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_create_vpc_address_prefix_all_params()
+ self.test_update_backup_policy_plan_all_params()
- # Disable retries and run test_create_vpc_address_prefix_all_params.
+ # Disable retries and run test_update_backup_policy_plan_all_params.
_service.disable_retries()
- self.test_create_vpc_address_prefix_all_params()
+ self.test_update_backup_policy_plan_all_params()
@responses.activate
- def test_create_vpc_address_prefix_value_error(self):
+ def test_update_backup_policy_plan_required_params(self):
"""
- test_create_vpc_address_prefix_value_error()
+ test_update_backup_policy_plan_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
# Construct a dict representation of a ZoneIdentityByName model
zone_identity_model = {}
zone_identity_model['name'] = 'us-south-1'
- # Set up parameter values
- vpc_id = 'testString'
- cidr = '10.240.0.0/18'
- zone = zone_identity_model
- is_default = True
- name = 'my-vpc-address-prefix-zone-1'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "vpc_id": vpc_id,
- "cidr": cidr,
- "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_vpc_address_prefix(**req_copy)
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPatch model
+ backup_policy_plan_clone_policy_patch_model = {}
+ backup_policy_plan_clone_policy_patch_model['max_snapshots'] = 1
+ backup_policy_plan_clone_policy_patch_model['zones'] = [zone_identity_model]
- def test_create_vpc_address_prefix_value_error_with_retries(self):
- # Enable retries and run test_create_vpc_address_prefix_value_error.
- _service.enable_retries()
- self.test_create_vpc_address_prefix_value_error()
+ # 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'] = 1
- # Disable retries and run test_create_vpc_address_prefix_value_error.
- _service.disable_retries()
- self.test_create_vpc_address_prefix_value_error()
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
-class TestDeleteVpcAddressPrefix:
- """
- Test Class for delete_vpc_address_prefix
- """
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
- @responses.activate
- def test_delete_vpc_address_prefix_all_params(self):
- """
- delete_vpc_address_prefix()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes/testString')
- responses.add(
- responses.DELETE,
- url,
- status=204,
- )
+ # 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['clone_policy'] = backup_policy_plan_clone_policy_patch_model
+ backup_policy_plan_patch_model['copy_user_tags'] = False
+ backup_policy_plan_patch_model['cron_spec'] = '30 */2 * * 1-5'
+ backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model
+ backup_policy_plan_patch_model['name'] = 'my-policy-plan'
+ backup_policy_plan_patch_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
# Set up parameter values
- vpc_id = 'testString'
+ backup_policy_id = 'testString'
id = 'testString'
+ backup_policy_plan_patch = backup_policy_plan_patch_model
# Invoke method
- response = _service.delete_vpc_address_prefix(
- vpc_id,
+ 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 == 204
+ 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_delete_vpc_address_prefix_all_params_with_retries(self):
- # Enable retries and run test_delete_vpc_address_prefix_all_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_delete_vpc_address_prefix_all_params()
+ self.test_update_backup_policy_plan_required_params()
- # Disable retries and run test_delete_vpc_address_prefix_all_params.
+ # Disable retries and run test_update_backup_policy_plan_required_params.
_service.disable_retries()
- self.test_delete_vpc_address_prefix_all_params()
+ self.test_update_backup_policy_plan_required_params()
@responses.activate
- def test_delete_vpc_address_prefix_value_error(self):
+ def test_update_backup_policy_plan_value_error(self):
"""
- test_delete_vpc_address_prefix_value_error()
+ test_update_backup_policy_plan_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes/testString')
+ url = preprocess_url('/backup_policies/testString/plans/testString')
+ mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
responses.add(
- responses.DELETE,
+ responses.PATCH,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a BackupPolicyPlanClonePolicyPatch model
+ backup_policy_plan_clone_policy_patch_model = {}
+ backup_policy_plan_clone_policy_patch_model['max_snapshots'] = 1
+ backup_policy_plan_clone_policy_patch_model['zones'] = [zone_identity_model]
+
+ # 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'] = 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a RegionIdentityByName model
+ region_identity_model = {}
+ region_identity_model['name'] = 'us-south'
+
+ # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
+ backup_policy_plan_remote_region_policy_prototype_model = {}
+ backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
+ backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
+ backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+
+ # 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['clone_policy'] = backup_policy_plan_clone_policy_patch_model
+ backup_policy_plan_patch_model['copy_user_tags'] = False
+ backup_policy_plan_patch_model['cron_spec'] = '30 */2 * * 1-5'
+ backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model
+ backup_policy_plan_patch_model['name'] = 'my-policy-plan'
+ backup_policy_plan_patch_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
+
# Set up parameter values
- vpc_id = 'testString'
+ 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 = {
- "vpc_id": vpc_id,
+ "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.delete_vpc_address_prefix(**req_copy)
+ _service.update_backup_policy_plan(**req_copy)
- def test_delete_vpc_address_prefix_value_error_with_retries(self):
- # Enable retries and run test_delete_vpc_address_prefix_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_delete_vpc_address_prefix_value_error()
+ self.test_update_backup_policy_plan_value_error()
- # Disable retries and run test_delete_vpc_address_prefix_value_error.
+ # Disable retries and run test_update_backup_policy_plan_value_error.
_service.disable_retries()
- self.test_delete_vpc_address_prefix_value_error()
+ self.test_update_backup_policy_plan_value_error()
-class TestGetVpcAddressPrefix:
+class TestDeleteBackupPolicy:
"""
- Test Class for get_vpc_address_prefix
+ Test Class for delete_backup_policy
"""
@responses.activate
- def test_get_vpc_address_prefix_all_params(self):
+ def test_delete_backup_policy_all_params(self):
"""
- get_vpc_address_prefix()
+ delete_backup_policy()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- vpc_id = 'testString'
id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.get_vpc_address_prefix(
- vpc_id,
+ response = _service.delete_backup_policy(
id,
+ if_match=if_match,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 202
- def test_get_vpc_address_prefix_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_address_prefix_all_params.
+ 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_get_vpc_address_prefix_all_params()
+ self.test_delete_backup_policy_all_params()
- # Disable retries and run test_get_vpc_address_prefix_all_params.
+ # Disable retries and run test_delete_backup_policy_all_params.
_service.disable_retries()
- self.test_get_vpc_address_prefix_all_params()
+ self.test_delete_backup_policy_all_params()
@responses.activate
- def test_get_vpc_address_prefix_value_error(self):
+ def test_delete_backup_policy_required_params(self):
"""
- test_get_vpc_address_prefix_value_error()
+ test_delete_backup_policy_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ responses.add(
+ responses.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_backup_policy(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ 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_delete_backup_policy_required_params()
+
+ # Disable retries and run test_delete_backup_policy_required_params.
+ _service.disable_retries()
+ self.test_delete_backup_policy_required_params()
+
+ @responses.activate
+ def test_delete_backup_policy_value_error(self):
+ """
+ test_delete_backup_policy_value_error()
+ """
+ # Set up mock
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ responses.add(
+ responses.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ 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_backup_policy(**req_copy)
+
+ 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_delete_backup_policy_value_error()
+
+ # Disable retries and run test_delete_backup_policy_value_error.
+ _service.disable_retries()
+ self.test_delete_backup_policy_value_error()
+
+
+class TestGetBackupPolicy:
+ """
+ Test Class for get_backup_policy
+ """
+
+ @responses.activate
+ def test_get_backup_policy_all_params(self):
+ """
+ get_backup_policy()
+ """
+ # Set up mock
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ 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_backup_policy(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ 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_get_backup_policy_all_params()
+
+ # Disable retries and run test_get_backup_policy_all_params.
+ _service.disable_retries()
+ self.test_get_backup_policy_all_params()
+
+ @responses.activate
+ def test_get_backup_policy_value_error(self):
+ """
+ test_get_backup_policy_value_error()
+ """
+ # Set up mock
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
responses.add(
responses.GET,
url,
@@ -1578,42 +1787,40 @@ def test_get_vpc_address_prefix_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_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_vpc_address_prefix(**req_copy)
+ _service.get_backup_policy(**req_copy)
- def test_get_vpc_address_prefix_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_address_prefix_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_get_vpc_address_prefix_value_error()
+ self.test_get_backup_policy_value_error()
- # Disable retries and run test_get_vpc_address_prefix_value_error.
+ # Disable retries and run test_get_backup_policy_value_error.
_service.disable_retries()
- self.test_get_vpc_address_prefix_value_error()
+ self.test_get_backup_policy_value_error()
-class TestUpdateVpcAddressPrefix:
+class TestUpdateBackupPolicy:
"""
- Test Class for update_vpc_address_prefix
+ Test Class for update_backup_policy
"""
@responses.activate
- def test_update_vpc_address_prefix_all_params(self):
+ def test_update_backup_policy_all_params(self):
"""
- update_vpc_address_prefix()
+ update_backup_policy()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
responses.add(
responses.PATCH,
url,
@@ -1622,21 +1829,22 @@ def test_update_vpc_address_prefix_all_params(self):
status=200,
)
- # Construct a dict representation of a AddressPrefixPatch model
- address_prefix_patch_model = {}
- address_prefix_patch_model['is_default'] = False
- address_prefix_patch_model['name'] = 'my-vpc-address-prefix-updated'
+ # Construct a dict representation of a BackupPolicyPatch model
+ backup_policy_patch_model = {}
+ backup_policy_patch_model['included_content'] = ['data_volumes']
+ backup_policy_patch_model['match_user_tags'] = ['my-tag-1', 'my-tag-2', 'my-tag-3']
+ backup_policy_patch_model['name'] = 'my-backup-policy'
# Set up parameter values
- vpc_id = 'testString'
id = 'testString'
- address_prefix_patch = address_prefix_patch_model
+ backup_policy_patch = backup_policy_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_vpc_address_prefix(
- vpc_id,
+ response = _service.update_backup_policy(
id,
- address_prefix_patch,
+ backup_policy_patch,
+ if_match=if_match,
headers={},
)
@@ -1645,25 +1853,25 @@ def test_update_vpc_address_prefix_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 == address_prefix_patch
+ assert req_body == backup_policy_patch
- def test_update_vpc_address_prefix_all_params_with_retries(self):
- # Enable retries and run test_update_vpc_address_prefix_all_params.
+ 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_update_vpc_address_prefix_all_params()
+ self.test_update_backup_policy_all_params()
- # Disable retries and run test_update_vpc_address_prefix_all_params.
+ # Disable retries and run test_update_backup_policy_all_params.
_service.disable_retries()
- self.test_update_vpc_address_prefix_all_params()
+ self.test_update_backup_policy_all_params()
@responses.activate
- def test_update_vpc_address_prefix_value_error(self):
+ def test_update_backup_policy_required_params(self):
"""
- test_update_vpc_address_prefix_value_error()
+ test_update_backup_policy_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/address_prefixes/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
responses.add(
responses.PATCH,
url,
@@ -1672,50 +1880,155 @@ def test_update_vpc_address_prefix_value_error(self):
status=200,
)
- # Construct a dict representation of a AddressPrefixPatch model
- address_prefix_patch_model = {}
- address_prefix_patch_model['is_default'] = False
- address_prefix_patch_model['name'] = 'my-vpc-address-prefix-updated'
+ # Construct a dict representation of a BackupPolicyPatch model
+ backup_policy_patch_model = {}
+ backup_policy_patch_model['included_content'] = ['data_volumes']
+ backup_policy_patch_model['match_user_tags'] = ['my-tag-1', 'my-tag-2', 'my-tag-3']
+ backup_policy_patch_model['name'] = 'my-backup-policy'
# Set up parameter values
- vpc_id = 'testString'
id = 'testString'
- address_prefix_patch = address_prefix_patch_model
+ backup_policy_patch = backup_policy_patch_model
+
+ # Invoke method
+ response = _service.update_backup_policy(
+ id,
+ backup_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 == backup_policy_patch
+
+ 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_backup_policy_required_params()
+
+ # Disable retries and run test_update_backup_policy_required_params.
+ _service.disable_retries()
+ self.test_update_backup_policy_required_params()
+
+ @responses.activate
+ def test_update_backup_policy_value_error(self):
+ """
+ test_update_backup_policy_value_error()
+ """
+ # Set up mock
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ 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['included_content'] = ['data_volumes']
+ backup_policy_patch_model['match_user_tags'] = ['my-tag-1', 'my-tag-2', 'my-tag-3']
+ backup_policy_patch_model['name'] = 'my-backup-policy'
+
+ # Set up parameter values
+ id = 'testString'
+ backup_policy_patch = backup_policy_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
"id": id,
- "address_prefix_patch": address_prefix_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_vpc_address_prefix(**req_copy)
+ _service.update_backup_policy(**req_copy)
- def test_update_vpc_address_prefix_value_error_with_retries(self):
- # Enable retries and run test_update_vpc_address_prefix_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_vpc_address_prefix_value_error()
+ self.test_update_backup_policy_value_error()
- # Disable retries and run test_update_vpc_address_prefix_value_error.
+ # Disable retries and run test_update_backup_policy_value_error.
_service.disable_retries()
- self.test_update_vpc_address_prefix_value_error()
+ self.test_update_backup_policy_value_error()
-class TestListVpcDnsResolutionBindings:
+# endregion
+##############################################################################
+# End of Service: BackupPolicies
+##############################################################################
+
+##############################################################################
+# Start of Service: BareMetalServers
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_vpc_dns_resolution_bindings
+ 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_vpc_dns_resolution_bindings_all_params(self):
+ def test_list_bare_metal_server_profiles_all_params(self):
"""
- list_vpc_dns_resolution_bindings()
+ list_bare_metal_server_profiles()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response = '{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/bare_metal_server/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -1725,25 +2038,13 @@ def test_list_vpc_dns_resolution_bindings_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- sort = 'name'
start = 'testString'
limit = 50
- name = 'my-name'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
- account_id = 'bb1b52262f7441a586f49068482f1e60'
# Invoke method
- response = _service.list_vpc_dns_resolution_bindings(
- vpc_id,
- sort=sort,
+ response = _service.list_bare_metal_server_profiles(
start=start,
limit=limit,
- name=name,
- vpc_crn=vpc_crn,
- vpc_name=vpc_name,
- account_id=account_id,
headers={},
)
@@ -1753,31 +2054,26 @@ def test_list_vpc_dns_resolution_bindings_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 'sort={}'.format(sort) in query_string
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- assert 'name={}'.format(name) in query_string
- assert 'vpc.crn={}'.format(vpc_crn) in query_string
- assert 'vpc.name={}'.format(vpc_name) in query_string
- assert 'account.id={}'.format(account_id) in query_string
- def test_list_vpc_dns_resolution_bindings_all_params_with_retries(self):
- # Enable retries and run test_list_vpc_dns_resolution_bindings_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_vpc_dns_resolution_bindings_all_params()
+ self.test_list_bare_metal_server_profiles_all_params()
- # Disable retries and run test_list_vpc_dns_resolution_bindings_all_params.
+ # Disable retries and run test_list_bare_metal_server_profiles_all_params.
_service.disable_retries()
- self.test_list_vpc_dns_resolution_bindings_all_params()
+ self.test_list_bare_metal_server_profiles_all_params()
@responses.activate
- def test_list_vpc_dns_resolution_bindings_required_params(self):
+ def test_list_bare_metal_server_profiles_required_params(self):
"""
- test_list_vpc_dns_resolution_bindings_required_params()
+ test_list_bare_metal_server_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response = '{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/bare_metal_server/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -1786,36 +2082,30 @@ def test_list_vpc_dns_resolution_bindings_required_params(self):
status=200,
)
- # Set up parameter values
- vpc_id = 'testString'
-
# Invoke method
- response = _service.list_vpc_dns_resolution_bindings(
- vpc_id,
- headers={},
- )
+ response = _service.list_bare_metal_server_profiles()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpc_dns_resolution_bindings_required_params_with_retries(self):
- # Enable retries and run test_list_vpc_dns_resolution_bindings_required_params.
+ 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_vpc_dns_resolution_bindings_required_params()
+ self.test_list_bare_metal_server_profiles_required_params()
- # Disable retries and run test_list_vpc_dns_resolution_bindings_required_params.
+ # Disable retries and run test_list_bare_metal_server_profiles_required_params.
_service.disable_retries()
- self.test_list_vpc_dns_resolution_bindings_required_params()
+ self.test_list_bare_metal_server_profiles_required_params()
@responses.activate
- def test_list_vpc_dns_resolution_bindings_value_error(self):
+ def test_list_bare_metal_server_profiles_value_error(self):
"""
- test_list_vpc_dns_resolution_bindings_value_error()
+ test_list_bare_metal_server_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response = '{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/bare_metal_server/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -1824,36 +2114,32 @@ def test_list_vpc_dns_resolution_bindings_value_error(self):
status=200,
)
- # Set up parameter values
- vpc_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_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_vpc_dns_resolution_bindings(**req_copy)
+ _service.list_bare_metal_server_profiles(**req_copy)
- def test_list_vpc_dns_resolution_bindings_value_error_with_retries(self):
- # Enable retries and run test_list_vpc_dns_resolution_bindings_value_error.
+ 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_vpc_dns_resolution_bindings_value_error()
+ self.test_list_bare_metal_server_profiles_value_error()
- # Disable retries and run test_list_vpc_dns_resolution_bindings_value_error.
+ # Disable retries and run test_list_bare_metal_server_profiles_value_error.
_service.disable_retries()
- self.test_list_vpc_dns_resolution_bindings_value_error()
+ self.test_list_bare_metal_server_profiles_value_error()
@responses.activate
- def test_list_vpc_dns_resolution_bindings_with_pager_get_next(self):
+ def test_list_bare_metal_server_profiles_with_pager_get_next(self):
"""
- test_list_vpc_dns_resolution_bindings_with_pager_get_next()
+ test_list_bare_metal_server_profiles_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
+ url = preprocess_url('/bare_metal_server/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
responses.add(
responses.GET,
url,
@@ -1871,15 +2157,9 @@ def test_list_vpc_dns_resolution_bindings_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpcDnsResolutionBindingsPager(
+ pager = BareMetalServerProfilesPager(
client=_service,
- vpc_id='testString',
- sort='name',
limit=10,
- name='my-name',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- account_id='bb1b52262f7441a586f49068482f1e60',
)
while pager.has_next():
next_page = pager.get_next()
@@ -1888,14 +2168,14 @@ def test_list_vpc_dns_resolution_bindings_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpc_dns_resolution_bindings_with_pager_get_all(self):
+ def test_list_bare_metal_server_profiles_with_pager_get_all(self):
"""
- test_list_vpc_dns_resolution_bindings_with_pager_get_all()
+ test_list_bare_metal_server_profiles_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
+ url = preprocess_url('/bare_metal_server/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
responses.add(
responses.GET,
url,
@@ -1912,404 +2192,109 @@ def test_list_vpc_dns_resolution_bindings_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpcDnsResolutionBindingsPager(
+ pager = BareMetalServerProfilesPager(
client=_service,
- vpc_id='testString',
- sort='name',
limit=10,
- name='my-name',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- account_id='bb1b52262f7441a586f49068482f1e60',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVpcDnsResolutionBinding:
+class TestGetBareMetalServerProfile:
"""
- Test Class for create_vpc_dns_resolution_binding
+ Test Class for get_bare_metal_server_profile
"""
@responses.activate
- def test_create_vpc_dns_resolution_binding_all_params(self):
+ def test_get_bare_metal_server_profile_all_params(self):
"""
- create_vpc_dns_resolution_binding()
+ get_bare_metal_server_profile()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
+ url = preprocess_url('/bare_metal_server/profiles/bx2-metal-192x768')
+ mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
# Set up parameter values
- vpc_id = 'testString'
- vpc = vpc_identity_model
- name = 'my-dns-resolution-binding'
+ name = 'bx2-metal-192x768'
# Invoke method
- response = _service.create_vpc_dns_resolution_binding(
- vpc_id,
- vpc,
- name=name,
+ response = _service.get_bare_metal_server_profile(
+ name,
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['vpc'] == vpc_identity_model
- assert req_body['name'] == 'my-dns-resolution-binding'
+ assert response.status_code == 200
- def test_create_vpc_dns_resolution_binding_all_params_with_retries(self):
- # Enable retries and run test_create_vpc_dns_resolution_binding_all_params.
+ 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_create_vpc_dns_resolution_binding_all_params()
+ self.test_get_bare_metal_server_profile_all_params()
- # Disable retries and run test_create_vpc_dns_resolution_binding_all_params.
+ # Disable retries and run test_get_bare_metal_server_profile_all_params.
_service.disable_retries()
- self.test_create_vpc_dns_resolution_binding_all_params()
+ self.test_get_bare_metal_server_profile_all_params()
@responses.activate
- def test_create_vpc_dns_resolution_binding_value_error(self):
+ def test_get_bare_metal_server_profile_value_error(self):
"""
- test_create_vpc_dns_resolution_binding_value_error()
+ test_get_bare_metal_server_profile_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
+ url = preprocess_url('/bare_metal_server/profiles/bx2-metal-192x768')
+ mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
# Set up parameter values
- vpc_id = 'testString'
- vpc = vpc_identity_model
- name = 'my-dns-resolution-binding'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "vpc_id": vpc_id,
- "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_vpc_dns_resolution_binding(**req_copy)
-
- def test_create_vpc_dns_resolution_binding_value_error_with_retries(self):
- # Enable retries and run test_create_vpc_dns_resolution_binding_value_error.
- _service.enable_retries()
- self.test_create_vpc_dns_resolution_binding_value_error()
-
- # Disable retries and run test_create_vpc_dns_resolution_binding_value_error.
- _service.disable_retries()
- self.test_create_vpc_dns_resolution_binding_value_error()
-
-
-class TestDeleteVpcDnsResolutionBinding:
- """
- Test Class for delete_vpc_dns_resolution_binding
- """
-
- @responses.activate
- def test_delete_vpc_dns_resolution_binding_all_params(self):
- """
- delete_vpc_dns_resolution_binding()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
- responses.add(
- responses.DELETE,
- url,
- body=mock_response,
- content_type='application/json',
- status=202,
- )
-
- # Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
-
- # Invoke method
- response = _service.delete_vpc_dns_resolution_binding(
- vpc_id,
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- def test_delete_vpc_dns_resolution_binding_all_params_with_retries(self):
- # Enable retries and run test_delete_vpc_dns_resolution_binding_all_params.
- _service.enable_retries()
- self.test_delete_vpc_dns_resolution_binding_all_params()
-
- # Disable retries and run test_delete_vpc_dns_resolution_binding_all_params.
- _service.disable_retries()
- self.test_delete_vpc_dns_resolution_binding_all_params()
-
- @responses.activate
- def test_delete_vpc_dns_resolution_binding_value_error(self):
- """
- test_delete_vpc_dns_resolution_binding_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
- responses.add(
- responses.DELETE,
- url,
- body=mock_response,
- content_type='application/json',
- status=202,
- )
-
- # Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "vpc_id": vpc_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_vpc_dns_resolution_binding(**req_copy)
-
- def test_delete_vpc_dns_resolution_binding_value_error_with_retries(self):
- # Enable retries and run test_delete_vpc_dns_resolution_binding_value_error.
- _service.enable_retries()
- self.test_delete_vpc_dns_resolution_binding_value_error()
-
- # Disable retries and run test_delete_vpc_dns_resolution_binding_value_error.
- _service.disable_retries()
- self.test_delete_vpc_dns_resolution_binding_value_error()
-
-
-class TestGetVpcDnsResolutionBinding:
- """
- Test Class for get_vpc_dns_resolution_binding
- """
-
- @responses.activate
- def test_get_vpc_dns_resolution_binding_all_params(self):
- """
- get_vpc_dns_resolution_binding()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
-
- # Invoke method
- response = _service.get_vpc_dns_resolution_binding(
- vpc_id,
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_vpc_dns_resolution_binding_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_dns_resolution_binding_all_params.
- _service.enable_retries()
- self.test_get_vpc_dns_resolution_binding_all_params()
-
- # Disable retries and run test_get_vpc_dns_resolution_binding_all_params.
- _service.disable_retries()
- self.test_get_vpc_dns_resolution_binding_all_params()
-
- @responses.activate
- def test_get_vpc_dns_resolution_binding_value_error(self):
- """
- test_get_vpc_dns_resolution_binding_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "vpc_id": vpc_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_vpc_dns_resolution_binding(**req_copy)
-
- def test_get_vpc_dns_resolution_binding_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_dns_resolution_binding_value_error.
- _service.enable_retries()
- self.test_get_vpc_dns_resolution_binding_value_error()
-
- # Disable retries and run test_get_vpc_dns_resolution_binding_value_error.
- _service.disable_retries()
- self.test_get_vpc_dns_resolution_binding_value_error()
-
-
-class TestUpdateVpcDnsResolutionBinding:
- """
- Test Class for update_vpc_dns_resolution_binding
- """
-
- @responses.activate
- def test_update_vpc_dns_resolution_binding_all_params(self):
- """
- update_vpc_dns_resolution_binding()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Construct a dict representation of a VPCDNSResolutionBindingPatch model
- vpcdns_resolution_binding_patch_model = {}
- vpcdns_resolution_binding_patch_model['name'] = 'my-dns-resolution-binding-updated'
-
- # Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
- vpcdns_resolution_binding_patch = vpcdns_resolution_binding_patch_model
-
- # Invoke method
- response = _service.update_vpc_dns_resolution_binding(
- vpc_id,
- id,
- vpcdns_resolution_binding_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 == vpcdns_resolution_binding_patch
-
- def test_update_vpc_dns_resolution_binding_all_params_with_retries(self):
- # Enable retries and run test_update_vpc_dns_resolution_binding_all_params.
- _service.enable_retries()
- self.test_update_vpc_dns_resolution_binding_all_params()
-
- # Disable retries and run test_update_vpc_dns_resolution_binding_all_params.
- _service.disable_retries()
- self.test_update_vpc_dns_resolution_binding_all_params()
-
- @responses.activate
- def test_update_vpc_dns_resolution_binding_value_error(self):
- """
- test_update_vpc_dns_resolution_binding_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Construct a dict representation of a VPCDNSResolutionBindingPatch model
- vpcdns_resolution_binding_patch_model = {}
- vpcdns_resolution_binding_patch_model['name'] = 'my-dns-resolution-binding-updated'
-
- # Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
- vpcdns_resolution_binding_patch = vpcdns_resolution_binding_patch_model
+ name = 'bx2-metal-192x768'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
- "id": id,
- "vpcdns_resolution_binding_patch": vpcdns_resolution_binding_patch,
+ "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.update_vpc_dns_resolution_binding(**req_copy)
+ _service.get_bare_metal_server_profile(**req_copy)
- def test_update_vpc_dns_resolution_binding_value_error_with_retries(self):
- # Enable retries and run test_update_vpc_dns_resolution_binding_value_error.
+ 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_update_vpc_dns_resolution_binding_value_error()
+ self.test_get_bare_metal_server_profile_value_error()
- # Disable retries and run test_update_vpc_dns_resolution_binding_value_error.
+ # Disable retries and run test_get_bare_metal_server_profile_value_error.
_service.disable_retries()
- self.test_update_vpc_dns_resolution_binding_value_error()
+ self.test_get_bare_metal_server_profile_value_error()
-class TestListVpcRoutes:
+class TestListBareMetalServers:
"""
- Test Class for list_vpc_routes
+ Test Class for list_bare_metal_servers
"""
@responses.activate
- def test_list_vpc_routes_all_params(self):
+ def test_list_bare_metal_servers_all_params(self):
"""
- list_vpc_routes()
+ list_bare_metal_servers()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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('/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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -2319,17 +2304,29 @@ def test_list_vpc_routes_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- zone_name = 'us-south-1'
start = 'testString'
limit = 50
+ resource_group_id = 'testString'
+ name = 'my-name'
+ reservation_id = 'testString'
+ reservation_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+ reservation_name = 'my-reservation'
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
# Invoke method
- response = _service.list_vpc_routes(
- vpc_id,
- zone_name=zone_name,
+ response = _service.list_bare_metal_servers(
start=start,
limit=limit,
+ resource_group_id=resource_group_id,
+ name=name,
+ reservation_id=reservation_id,
+ reservation_crn=reservation_crn,
+ reservation_name=reservation_name,
+ vpc_id=vpc_id,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
headers={},
)
@@ -2339,27 +2336,34 @@ def test_list_vpc_routes_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 'zone.name={}'.format(zone_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 'name={}'.format(name) in query_string
+ assert 'reservation.id={}'.format(reservation_id) in query_string
+ assert 'reservation.crn={}'.format(reservation_crn) in query_string
+ assert 'reservation.name={}'.format(reservation_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
- def test_list_vpc_routes_all_params_with_retries(self):
- # Enable retries and run test_list_vpc_routes_all_params.
+ 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_vpc_routes_all_params()
+ self.test_list_bare_metal_servers_all_params()
- # Disable retries and run test_list_vpc_routes_all_params.
+ # Disable retries and run test_list_bare_metal_servers_all_params.
_service.disable_retries()
- self.test_list_vpc_routes_all_params()
+ self.test_list_bare_metal_servers_all_params()
@responses.activate
- def test_list_vpc_routes_required_params(self):
+ def test_list_bare_metal_servers_required_params(self):
"""
- test_list_vpc_routes_required_params()
+ test_list_bare_metal_servers_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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('/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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -2368,36 +2372,30 @@ def test_list_vpc_routes_required_params(self):
status=200,
)
- # Set up parameter values
- vpc_id = 'testString'
-
# Invoke method
- response = _service.list_vpc_routes(
- vpc_id,
- headers={},
- )
+ response = _service.list_bare_metal_servers()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpc_routes_required_params_with_retries(self):
- # Enable retries and run test_list_vpc_routes_required_params.
+ 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_vpc_routes_required_params()
+ self.test_list_bare_metal_servers_required_params()
- # Disable retries and run test_list_vpc_routes_required_params.
+ # Disable retries and run test_list_bare_metal_servers_required_params.
_service.disable_retries()
- self.test_list_vpc_routes_required_params()
+ self.test_list_bare_metal_servers_required_params()
@responses.activate
- def test_list_vpc_routes_value_error(self):
+ def test_list_bare_metal_servers_value_error(self):
"""
- test_list_vpc_routes_value_error()
+ test_list_bare_metal_servers_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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('/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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -2406,36 +2404,32 @@ def test_list_vpc_routes_value_error(self):
status=200,
)
- # Set up parameter values
- vpc_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_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_vpc_routes(**req_copy)
+ _service.list_bare_metal_servers(**req_copy)
- def test_list_vpc_routes_value_error_with_retries(self):
- # Enable retries and run test_list_vpc_routes_value_error.
+ 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_vpc_routes_value_error()
+ self.test_list_bare_metal_servers_value_error()
- # Disable retries and run test_list_vpc_routes_value_error.
+ # Disable retries and run test_list_bare_metal_servers_value_error.
_service.disable_retries()
- self.test_list_vpc_routes_value_error()
+ self.test_list_bare_metal_servers_value_error()
@responses.activate
- def test_list_vpc_routes_with_pager_get_next(self):
+ def test_list_bare_metal_servers_with_pager_get_next(self):
"""
- test_list_vpc_routes_with_pager_get_next()
+ test_list_bare_metal_servers_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/routes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/bare_metal_servers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"metadata_service":{"enabled":false,"protocol":"http"},"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"metadata_service":{"enabled":false,"protocol":"http"},"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -2453,11 +2447,17 @@ def test_list_vpc_routes_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpcRoutesPager(
+ pager = BareMetalServersPager(
client=_service,
- vpc_id='testString',
- zone_name='us-south-1',
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ reservation_id='testString',
+ reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
+ reservation_name='my-reservation',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
)
while pager.has_next():
next_page = pager.get_next()
@@ -2466,14 +2466,14 @@ def test_list_vpc_routes_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpc_routes_with_pager_get_all(self):
+ def test_list_bare_metal_servers_with_pager_get_all(self):
"""
- test_list_vpc_routes_with_pager_get_all()
+ test_list_bare_metal_servers_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/routes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/bare_metal_servers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"metadata_service":{"enabled":false,"protocol":"http"},"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"metadata_service":{"enabled":false,"protocol":"http"},"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -2490,30 +2490,36 @@ def test_list_vpc_routes_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpcRoutesPager(
+ pager = BareMetalServersPager(
client=_service,
- vpc_id='testString',
- zone_name='us-south-1',
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ reservation_id='testString',
+ reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
+ reservation_name='my-reservation',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVpcRoute:
+class TestCreateBareMetalServer:
"""
- Test Class for create_vpc_route
+ Test Class for create_bare_metal_server
"""
@responses.activate
- def test_create_vpc_route_all_params(self):
+ def test_create_bare_metal_server_all_params(self):
"""
- create_vpc_route()
+ create_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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')
+ 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -2522,206 +2528,416 @@ def test_create_vpc_route_all_params(self):
status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
- # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_prototype_model = {}
- route_next_hop_prototype_model['address'] = '0.0.0.0'
+ # Construct a dict representation of a BareMetalServerInitializationDefaultTrustedProfilePrototype model
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {}
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
- # Set up parameter values
- vpc_id = 'testString'
- destination = '192.168.3.0/24'
- zone = zone_identity_model
- action = 'deliver'
- advertise = False
- name = 'my-vpc-routing-table-route'
- next_hop = route_next_hop_prototype_model
- priority = 1
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
- # Invoke method
- response = _service.create_vpc_route(
- vpc_id,
- destination,
- zone,
- action=action,
- advertise=advertise,
- name=name,
- next_hop=next_hop,
- priority=priority,
- headers={},
- )
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
- # 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['destination'] == '192.168.3.0/24'
- assert req_body['zone'] == zone_identity_model
- assert req_body['action'] == 'deliver'
- assert req_body['advertise'] == False
- assert req_body['name'] == 'my-vpc-routing-table-route'
- assert req_body['next_hop'] == route_next_hop_prototype_model
- assert req_body['priority'] == 1
+ # Construct a dict representation of a BareMetalServerInitializationPrototype model
+ bare_metal_server_initialization_prototype_model = {}
+ bare_metal_server_initialization_prototype_model['default_trusted_profile'] = bare_metal_server_initialization_default_trusted_profile_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'
- def test_create_vpc_route_all_params_with_retries(self):
- # Enable retries and run test_create_vpc_route_all_params.
- _service.enable_retries()
- self.test_create_vpc_route_all_params()
+ # Construct a dict representation of a BareMetalServerMetadataServicePrototype model
+ bare_metal_server_metadata_service_prototype_model = {}
+ bare_metal_server_metadata_service_prototype_model['enabled'] = True
+ bare_metal_server_metadata_service_prototype_model['protocol'] = 'https'
- # Disable retries and run test_create_vpc_route_all_params.
- _service.disable_retries()
- self.test_create_vpc_route_all_params()
+ # Construct a dict representation of a BareMetalServerProfileIdentityByName model
+ bare_metal_server_profile_identity_model = {}
+ bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768'
- @responses.activate
- def test_create_vpc_route_value_error(self):
- """
- test_create_vpc_route_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/routes')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a BareMetalServerReservationAffinityPrototype model
+ bare_metal_server_reservation_affinity_prototype_model = {}
+ bare_metal_server_reservation_affinity_prototype_model['policy'] = 'automatic'
+ bare_metal_server_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Construct a dict representation of a BareMetalServerTrustedPlatformModulePrototype model
+ bare_metal_server_trusted_platform_module_prototype_model = {}
+ bare_metal_server_trusted_platform_module_prototype_model['mode'] = 'disabled'
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
+ bare_metal_server_network_attachment_prototype_model = {}
+ bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
+ bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
+ bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
+
+ # Construct a dict representation of a BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPCIPrototype model
+ bare_metal_server_primary_network_attachment_prototype_model = {}
+ bare_metal_server_primary_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_primary_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
+ bare_metal_server_primary_network_attachment_prototype_model['allowed_vlans'] = []
+ bare_metal_server_primary_network_attachment_prototype_model['interface_type'] = 'pci'
+
+ # Construct a dict representation of a BareMetalServerPrototypeBareMetalServerByNetworkAttachment model
+ bare_metal_server_prototype_model = {}
+ bare_metal_server_prototype_model['bandwidth'] = 20000
+ bare_metal_server_prototype_model['enable_secure_boot'] = False
+ bare_metal_server_prototype_model['initialization'] = bare_metal_server_initialization_prototype_model
+ bare_metal_server_prototype_model['metadata_service'] = bare_metal_server_metadata_service_prototype_model
+ bare_metal_server_prototype_model['name'] = 'my-bare-metal-server'
+ bare_metal_server_prototype_model['profile'] = bare_metal_server_profile_identity_model
+ bare_metal_server_prototype_model['reservation_affinity'] = bare_metal_server_reservation_affinity_prototype_model
+ bare_metal_server_prototype_model['resource_group'] = resource_group_identity_model
+ bare_metal_server_prototype_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_prototype_model
+ bare_metal_server_prototype_model['vpc'] = vpc_identity_model
+ bare_metal_server_prototype_model['zone'] = zone_identity_model
+ bare_metal_server_prototype_model['network_attachments'] = [bare_metal_server_network_attachment_prototype_model]
+ bare_metal_server_prototype_model['primary_network_attachment'] = bare_metal_server_primary_network_attachment_prototype_model
+
+ # Set up parameter values
+ bare_metal_server_prototype = bare_metal_server_prototype_model
+
+ # Invoke method
+ response = _service.create_bare_metal_server(
+ bare_metal_server_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_prototype
+
+ 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ # Construct a dict representation of a BareMetalServerInitializationDefaultTrustedProfilePrototype model
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {}
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+
+ # Construct a dict representation of a BareMetalServerInitializationPrototype model
+ bare_metal_server_initialization_prototype_model = {}
+ bare_metal_server_initialization_prototype_model['default_trusted_profile'] = bare_metal_server_initialization_default_trusted_profile_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 BareMetalServerMetadataServicePrototype model
+ bare_metal_server_metadata_service_prototype_model = {}
+ bare_metal_server_metadata_service_prototype_model['enabled'] = True
+ bare_metal_server_metadata_service_prototype_model['protocol'] = 'https'
+
+ # 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 ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a BareMetalServerReservationAffinityPrototype model
+ bare_metal_server_reservation_affinity_prototype_model = {}
+ bare_metal_server_reservation_affinity_prototype_model['policy'] = 'automatic'
+ bare_metal_server_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Construct a dict representation of a BareMetalServerTrustedPlatformModulePrototype model
+ bare_metal_server_trusted_platform_module_prototype_model = {}
+ bare_metal_server_trusted_platform_module_prototype_model['mode'] = 'disabled'
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_prototype_model = {}
- route_next_hop_prototype_model['address'] = '0.0.0.0'
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
+ bare_metal_server_network_attachment_prototype_model = {}
+ bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
+ bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
+ bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
+
+ # Construct a dict representation of a BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPCIPrototype model
+ bare_metal_server_primary_network_attachment_prototype_model = {}
+ bare_metal_server_primary_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_primary_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
+ bare_metal_server_primary_network_attachment_prototype_model['allowed_vlans'] = []
+ bare_metal_server_primary_network_attachment_prototype_model['interface_type'] = 'pci'
+
+ # Construct a dict representation of a BareMetalServerPrototypeBareMetalServerByNetworkAttachment model
+ bare_metal_server_prototype_model = {}
+ bare_metal_server_prototype_model['bandwidth'] = 20000
+ bare_metal_server_prototype_model['enable_secure_boot'] = False
+ bare_metal_server_prototype_model['initialization'] = bare_metal_server_initialization_prototype_model
+ bare_metal_server_prototype_model['metadata_service'] = bare_metal_server_metadata_service_prototype_model
+ bare_metal_server_prototype_model['name'] = 'my-bare-metal-server'
+ bare_metal_server_prototype_model['profile'] = bare_metal_server_profile_identity_model
+ bare_metal_server_prototype_model['reservation_affinity'] = bare_metal_server_reservation_affinity_prototype_model
+ bare_metal_server_prototype_model['resource_group'] = resource_group_identity_model
+ bare_metal_server_prototype_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_prototype_model
+ bare_metal_server_prototype_model['vpc'] = vpc_identity_model
+ bare_metal_server_prototype_model['zone'] = zone_identity_model
+ bare_metal_server_prototype_model['network_attachments'] = [bare_metal_server_network_attachment_prototype_model]
+ bare_metal_server_prototype_model['primary_network_attachment'] = bare_metal_server_primary_network_attachment_prototype_model
# Set up parameter values
- vpc_id = 'testString'
- destination = '192.168.3.0/24'
- zone = zone_identity_model
- action = 'deliver'
- advertise = False
- name = 'my-vpc-routing-table-route'
- next_hop = route_next_hop_prototype_model
- priority = 1
+ bare_metal_server_prototype = bare_metal_server_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
- "destination": destination,
- "zone": zone,
+ "bare_metal_server_prototype": bare_metal_server_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_vpc_route(**req_copy)
+ _service.create_bare_metal_server(**req_copy)
- def test_create_vpc_route_value_error_with_retries(self):
- # Enable retries and run test_create_vpc_route_value_error.
+ 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_vpc_route_value_error()
+ self.test_create_bare_metal_server_value_error()
- # Disable retries and run test_create_vpc_route_value_error.
+ # Disable retries and run test_create_bare_metal_server_value_error.
_service.disable_retries()
- self.test_create_vpc_route_value_error()
+ self.test_create_bare_metal_server_value_error()
-class TestDeleteVpcRoute:
+class TestCreateBareMetalServerConsoleAccessToken:
"""
- Test Class for delete_vpc_route
+ Test Class for create_bare_metal_server_console_access_token
"""
@responses.activate
- def test_delete_vpc_route_all_params(self):
+ def test_create_bare_metal_server_console_access_token_all_params(self):
"""
- delete_vpc_route()
+ create_bare_metal_server_console_access_token()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes/testString')
+ url = preprocess_url('/bare_metal_servers/testString/console_access_token')
+ mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
+ bare_metal_server_id = 'testString'
+ console_type = 'serial'
+ force = False
# Invoke method
- response = _service.delete_vpc_route(
- vpc_id,
- id,
+ 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 == 204
+ 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_delete_vpc_route_all_params_with_retries(self):
- # Enable retries and run test_delete_vpc_route_all_params.
+ 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_delete_vpc_route_all_params()
+ self.test_create_bare_metal_server_console_access_token_all_params()
- # Disable retries and run test_delete_vpc_route_all_params.
+ # Disable retries and run test_create_bare_metal_server_console_access_token_all_params.
_service.disable_retries()
- self.test_delete_vpc_route_all_params()
+ self.test_create_bare_metal_server_console_access_token_all_params()
@responses.activate
- def test_delete_vpc_route_value_error(self):
+ def test_create_bare_metal_server_console_access_token_value_error(self):
"""
- test_delete_vpc_route_value_error()
+ test_create_bare_metal_server_console_access_token_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes/testString')
+ url = preprocess_url('/bare_metal_servers/testString/console_access_token')
+ mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
+ 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 = {
- "vpc_id": vpc_id,
- "id": id,
+ "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.delete_vpc_route(**req_copy)
+ _service.create_bare_metal_server_console_access_token(**req_copy)
- def test_delete_vpc_route_value_error_with_retries(self):
- # Enable retries and run test_delete_vpc_route_value_error.
+ 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_delete_vpc_route_value_error()
+ self.test_create_bare_metal_server_console_access_token_value_error()
- # Disable retries and run test_delete_vpc_route_value_error.
+ # Disable retries and run test_create_bare_metal_server_console_access_token_value_error.
_service.disable_retries()
- self.test_delete_vpc_route_value_error()
+ self.test_create_bare_metal_server_console_access_token_value_error()
-class TestGetVpcRoute:
+class TestListBareMetalServerDisks:
"""
- Test Class for get_vpc_route
+ Test Class for list_bare_metal_server_disks
"""
@responses.activate
- def test_get_vpc_route_all_params(self):
+ def test_list_bare_metal_server_disks_all_params(self):
"""
- get_vpc_route()
+ list_bare_metal_server_disks()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/disks')
+ mock_response = '{"disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}'
responses.add(
responses.GET,
url,
@@ -2731,13 +2947,11 @@ def test_get_vpc_route_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
+ bare_metal_server_id = 'testString'
# Invoke method
- response = _service.get_vpc_route(
- vpc_id,
- id,
+ response = _service.list_bare_metal_server_disks(
+ bare_metal_server_id,
headers={},
)
@@ -2745,23 +2959,23 @@ def test_get_vpc_route_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_vpc_route_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_route_all_params.
+ 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_get_vpc_route_all_params()
+ self.test_list_bare_metal_server_disks_all_params()
- # Disable retries and run test_get_vpc_route_all_params.
+ # Disable retries and run test_list_bare_metal_server_disks_all_params.
_service.disable_retries()
- self.test_get_vpc_route_all_params()
+ self.test_list_bare_metal_server_disks_all_params()
@responses.activate
- def test_get_vpc_route_value_error(self):
+ def test_list_bare_metal_server_disks_value_error(self):
"""
- test_get_vpc_route_value_error()
+ test_list_bare_metal_server_disks_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/disks')
+ mock_response = '{"disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}'
responses.add(
responses.GET,
url,
@@ -2771,206 +2985,225 @@ def test_get_vpc_route_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
- id = 'testString'
+ bare_metal_server_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
- "id": id,
+ "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.get_vpc_route(**req_copy)
+ _service.list_bare_metal_server_disks(**req_copy)
- def test_get_vpc_route_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_route_value_error.
+ 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_get_vpc_route_value_error()
+ self.test_list_bare_metal_server_disks_value_error()
- # Disable retries and run test_get_vpc_route_value_error.
+ # Disable retries and run test_list_bare_metal_server_disks_value_error.
_service.disable_retries()
- self.test_get_vpc_route_value_error()
+ self.test_list_bare_metal_server_disks_value_error()
-class TestUpdateVpcRoute:
+class TestGetBareMetalServerDisk:
"""
- Test Class for update_vpc_route
+ Test Class for get_bare_metal_server_disk
"""
@responses.activate
- def test_update_vpc_route_all_params(self):
+ def test_get_bare_metal_server_disk_all_params(self):
"""
- update_vpc_route()
+ get_bare_metal_server_disk()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/disks/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_patch_model = {}
- route_next_hop_patch_model['address'] = '10.240.0.12'
-
- # Construct a dict representation of a RoutePatch model
- route_patch_model = {}
- route_patch_model['advertise'] = True
- route_patch_model['name'] = 'my-vpc-routing-table-route'
- route_patch_model['next_hop'] = route_next_hop_patch_model
- route_patch_model['priority'] = 1
-
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
- route_patch = route_patch_model
# Invoke method
- response = _service.update_vpc_route(
- vpc_id,
+ response = _service.get_bare_metal_server_disk(
+ bare_metal_server_id,
id,
- route_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 == route_patch
- def test_update_vpc_route_all_params_with_retries(self):
- # Enable retries and run test_update_vpc_route_all_params.
+ 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_update_vpc_route_all_params()
+ self.test_get_bare_metal_server_disk_all_params()
- # Disable retries and run test_update_vpc_route_all_params.
+ # Disable retries and run test_get_bare_metal_server_disk_all_params.
_service.disable_retries()
- self.test_update_vpc_route_all_params()
+ self.test_get_bare_metal_server_disk_all_params()
@responses.activate
- def test_update_vpc_route_value_error(self):
+ def test_get_bare_metal_server_disk_value_error(self):
"""
- test_update_vpc_route_value_error()
+ test_get_bare_metal_server_disk_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/disks/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_patch_model = {}
- route_next_hop_patch_model['address'] = '10.240.0.12'
-
- # Construct a dict representation of a RoutePatch model
- route_patch_model = {}
- route_patch_model['advertise'] = True
- route_patch_model['name'] = 'my-vpc-routing-table-route'
- route_patch_model['next_hop'] = route_next_hop_patch_model
- route_patch_model['priority'] = 1
-
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
- route_patch = route_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
+ "bare_metal_server_id": bare_metal_server_id,
"id": id,
- "route_patch": 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.update_vpc_route(**req_copy)
+ _service.get_bare_metal_server_disk(**req_copy)
- def test_update_vpc_route_value_error_with_retries(self):
- # Enable retries and run test_update_vpc_route_value_error.
+ 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_update_vpc_route_value_error()
+ self.test_get_bare_metal_server_disk_value_error()
- # Disable retries and run test_update_vpc_route_value_error.
+ # Disable retries and run test_get_bare_metal_server_disk_value_error.
_service.disable_retries()
- self.test_update_vpc_route_value_error()
+ self.test_get_bare_metal_server_disk_value_error()
-class TestListVpcRoutingTables:
+class TestUpdateBareMetalServerDisk:
"""
- Test Class for list_vpc_routing_tables
+ Test Class for update_bare_metal_server_disk
"""
@responses.activate
- def test_list_vpc_routing_tables_all_params(self):
+ def test_update_bare_metal_server_disk_all_params(self):
"""
- list_vpc_routing_tables()
+ update_bare_metal_server_disk()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}'
+ url = preprocess_url('/bare_metal_servers/testString/disks/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
responses.add(
- responses.GET,
+ 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
- vpc_id = 'testString'
- start = 'testString'
- limit = 50
- is_default = True
+ bare_metal_server_id = 'testString'
+ id = 'testString'
+ bare_metal_server_disk_patch = bare_metal_server_disk_patch_model
# Invoke method
- response = _service.list_vpc_routing_tables(
- vpc_id,
- start=start,
- limit=limit,
- is_default=is_default,
+ 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 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 'is_default={}'.format('true' if is_default else 'false') in query_string
-
- def test_list_vpc_routing_tables_all_params_with_retries(self):
- # Enable retries and run test_list_vpc_routing_tables_all_params.
+ # 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_list_vpc_routing_tables_all_params()
+ self.test_update_bare_metal_server_disk_all_params()
- # Disable retries and run test_list_vpc_routing_tables_all_params.
+ # Disable retries and run test_update_bare_metal_server_disk_all_params.
_service.disable_retries()
- self.test_list_vpc_routing_tables_all_params()
+ self.test_update_bare_metal_server_disk_all_params()
@responses.activate
- def test_list_vpc_routing_tables_required_params(self):
+ def test_update_bare_metal_server_disk_value_error(self):
"""
- test_list_vpc_routing_tables_required_params()
+ test_update_bare_metal_server_disk_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}'
+ url = preprocess_url('/bare_metal_servers/testString/disks/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-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 TestListBareMetalServerNetworkAttachments:
+ """
+ Test Class for list_bare_metal_server_network_attachments
+ """
+
+ @responses.activate
+ def test_list_bare_metal_server_network_attachments_all_params(self):
+ """
+ list_bare_metal_server_network_attachments()
+ """
+ # Set up mock
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -2980,35 +3213,44 @@ def test_list_vpc_routing_tables_required_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.list_vpc_routing_tables(
- vpc_id,
+ response = _service.list_bare_metal_server_network_attachments(
+ 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_vpc_routing_tables_required_params_with_retries(self):
- # Enable retries and run test_list_vpc_routing_tables_required_params.
+ def test_list_bare_metal_server_network_attachments_all_params_with_retries(self):
+ # Enable retries and run test_list_bare_metal_server_network_attachments_all_params.
_service.enable_retries()
- self.test_list_vpc_routing_tables_required_params()
+ self.test_list_bare_metal_server_network_attachments_all_params()
- # Disable retries and run test_list_vpc_routing_tables_required_params.
+ # Disable retries and run test_list_bare_metal_server_network_attachments_all_params.
_service.disable_retries()
- self.test_list_vpc_routing_tables_required_params()
+ self.test_list_bare_metal_server_network_attachments_all_params()
@responses.activate
- def test_list_vpc_routing_tables_value_error(self):
+ def test_list_bare_metal_server_network_attachments_required_params(self):
"""
- test_list_vpc_routing_tables_value_error()
+ test_list_bare_metal_server_network_attachments_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -3018,35 +3260,73 @@ def test_list_vpc_routing_tables_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
+
+ # Invoke method
+ response = _service.list_bare_metal_server_network_attachments(
+ 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_attachments_required_params_with_retries(self):
+ # Enable retries and run test_list_bare_metal_server_network_attachments_required_params.
+ _service.enable_retries()
+ self.test_list_bare_metal_server_network_attachments_required_params()
+
+ # Disable retries and run test_list_bare_metal_server_network_attachments_required_params.
+ _service.disable_retries()
+ self.test_list_bare_metal_server_network_attachments_required_params()
+
+ @responses.activate
+ def test_list_bare_metal_server_network_attachments_value_error(self):
+ """
+ test_list_bare_metal_server_network_attachments_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "href"}, "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 = {
- "vpc_id": vpc_id,
+ "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_vpc_routing_tables(**req_copy)
+ _service.list_bare_metal_server_network_attachments(**req_copy)
- def test_list_vpc_routing_tables_value_error_with_retries(self):
- # Enable retries and run test_list_vpc_routing_tables_value_error.
+ def test_list_bare_metal_server_network_attachments_value_error_with_retries(self):
+ # Enable retries and run test_list_bare_metal_server_network_attachments_value_error.
_service.enable_retries()
- self.test_list_vpc_routing_tables_value_error()
+ self.test_list_bare_metal_server_network_attachments_value_error()
- # Disable retries and run test_list_vpc_routing_tables_value_error.
+ # Disable retries and run test_list_bare_metal_server_network_attachments_value_error.
_service.disable_retries()
- self.test_list_vpc_routing_tables_value_error()
+ self.test_list_bare_metal_server_network_attachments_value_error()
@responses.activate
- def test_list_vpc_routing_tables_with_pager_get_next(self):
+ def test_list_bare_metal_server_network_attachments_with_pager_get_next(self):
"""
- test_list_vpc_routing_tables_with_pager_get_next()
+ test_list_bare_metal_server_network_attachments_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
- mock_response2 = '{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
responses.add(
responses.GET,
url,
@@ -3064,11 +3344,10 @@ def test_list_vpc_routing_tables_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpcRoutingTablesPager(
+ pager = BareMetalServerNetworkAttachmentsPager(
client=_service,
- vpc_id='testString',
+ bare_metal_server_id='testString',
limit=10,
- is_default=True,
)
while pager.has_next():
next_page = pager.get_next()
@@ -3077,14 +3356,14 @@ def test_list_vpc_routing_tables_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpc_routing_tables_with_pager_get_all(self):
+ def test_list_bare_metal_server_network_attachments_with_pager_get_all(self):
"""
- test_list_vpc_routing_tables_with_pager_get_all()
+ test_list_bare_metal_server_network_attachments_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
- mock_response2 = '{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
responses.add(
responses.GET,
url,
@@ -3101,30 +3380,29 @@ def test_list_vpc_routing_tables_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpcRoutingTablesPager(
+ pager = BareMetalServerNetworkAttachmentsPager(
client=_service,
- vpc_id='testString',
+ bare_metal_server_id='testString',
limit=10,
- is_default=True,
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVpcRoutingTable:
+class TestCreateBareMetalServerNetworkAttachment:
"""
- Test Class for create_vpc_routing_table
+ Test Class for create_bare_metal_server_network_attachment
"""
@responses.activate
- def test_create_vpc_routing_table_all_params(self):
+ def test_create_bare_metal_server_network_attachment_all_params(self):
"""
- create_vpc_routing_table()
+ create_bare_metal_server_network_attachment()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
responses.add(
responses.POST,
url,
@@ -3133,50 +3411,58 @@ def test_create_vpc_routing_table_all_params(self):
status=201,
)
- # Construct a dict representation of a ResourceFilter model
- resource_filter_model = {}
- resource_filter_model['resource_type'] = 'vpn_server'
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
- # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_prototype_model = {}
- route_next_hop_prototype_model['address'] = '0.0.0.0'
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a RoutePrototype model
- route_prototype_model = {}
- route_prototype_model['action'] = 'deliver'
- route_prototype_model['advertise'] = False
- route_prototype_model['destination'] = '192.168.3.0/24'
- route_prototype_model['name'] = 'my-vpc-routing-table-route'
- route_prototype_model['next_hop'] = route_next_hop_prototype_model
- route_prototype_model['priority'] = 1
- route_prototype_model['zone'] = zone_identity_model
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
+ bare_metal_server_network_attachment_prototype_model = {}
+ bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
+ bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
+ bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
# Set up parameter values
- vpc_id = 'testString'
- accept_routes_from = [resource_filter_model]
- advertise_routes_to = []
- name = 'my-routing-table-1'
- route_direct_link_ingress = False
- route_internet_ingress = False
- route_transit_gateway_ingress = False
- route_vpc_zone_ingress = False
- routes = [route_prototype_model]
+ bare_metal_server_id = 'testString'
+ bare_metal_server_network_attachment_prototype = bare_metal_server_network_attachment_prototype_model
# Invoke method
- response = _service.create_vpc_routing_table(
- vpc_id,
- accept_routes_from=accept_routes_from,
- advertise_routes_to=advertise_routes_to,
- name=name,
- route_direct_link_ingress=route_direct_link_ingress,
- route_internet_ingress=route_internet_ingress,
- route_transit_gateway_ingress=route_transit_gateway_ingress,
- route_vpc_zone_ingress=route_vpc_zone_ingress,
- routes=routes,
+ response = _service.create_bare_metal_server_network_attachment(
+ bare_metal_server_id,
+ bare_metal_server_network_attachment_prototype,
headers={},
)
@@ -3185,32 +3471,25 @@ 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['advertise_routes_to'] == []
- assert req_body['name'] == 'my-routing-table-1'
- assert req_body['route_direct_link_ingress'] == False
- assert req_body['route_internet_ingress'] == False
- assert req_body['route_transit_gateway_ingress'] == False
- assert req_body['route_vpc_zone_ingress'] == False
- assert req_body['routes'] == [route_prototype_model]
+ assert req_body == bare_metal_server_network_attachment_prototype
- def test_create_vpc_routing_table_all_params_with_retries(self):
- # Enable retries and run test_create_vpc_routing_table_all_params.
+ def test_create_bare_metal_server_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_create_bare_metal_server_network_attachment_all_params.
_service.enable_retries()
- self.test_create_vpc_routing_table_all_params()
+ self.test_create_bare_metal_server_network_attachment_all_params()
- # Disable retries and run test_create_vpc_routing_table_all_params.
+ # Disable retries and run test_create_bare_metal_server_network_attachment_all_params.
_service.disable_retries()
- self.test_create_vpc_routing_table_all_params()
+ self.test_create_bare_metal_server_network_attachment_all_params()
@responses.activate
- def test_create_vpc_routing_table_value_error(self):
+ def test_create_bare_metal_server_network_attachment_value_error(self):
"""
- test_create_vpc_routing_table_value_error()
+ test_create_bare_metal_server_network_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
responses.add(
responses.POST,
url,
@@ -3219,189 +3498,166 @@ def test_create_vpc_routing_table_value_error(self):
status=201,
)
- # Construct a dict representation of a ResourceFilter model
- resource_filter_model = {}
- resource_filter_model['resource_type'] = 'vpn_server'
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
- # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_prototype_model = {}
- route_next_hop_prototype_model['address'] = '0.0.0.0'
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a RoutePrototype model
- route_prototype_model = {}
- route_prototype_model['action'] = 'deliver'
- route_prototype_model['advertise'] = False
- route_prototype_model['destination'] = '192.168.3.0/24'
- route_prototype_model['name'] = 'my-vpc-routing-table-route'
- route_prototype_model['next_hop'] = route_next_hop_prototype_model
- route_prototype_model['priority'] = 1
- route_prototype_model['zone'] = zone_identity_model
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
+ bare_metal_server_network_attachment_prototype_model = {}
+ bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
+ bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
+ bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
# Set up parameter values
- vpc_id = 'testString'
- accept_routes_from = [resource_filter_model]
- advertise_routes_to = []
- name = 'my-routing-table-1'
- route_direct_link_ingress = False
- route_internet_ingress = False
- route_transit_gateway_ingress = False
- route_vpc_zone_ingress = False
- routes = [route_prototype_model]
+ bare_metal_server_id = 'testString'
+ bare_metal_server_network_attachment_prototype = bare_metal_server_network_attachment_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
+ "bare_metal_server_id": bare_metal_server_id,
+ "bare_metal_server_network_attachment_prototype": bare_metal_server_network_attachment_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_vpc_routing_table(**req_copy)
+ _service.create_bare_metal_server_network_attachment(**req_copy)
- def test_create_vpc_routing_table_value_error_with_retries(self):
- # Enable retries and run test_create_vpc_routing_table_value_error.
+ def test_create_bare_metal_server_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_create_bare_metal_server_network_attachment_value_error.
_service.enable_retries()
- self.test_create_vpc_routing_table_value_error()
+ self.test_create_bare_metal_server_network_attachment_value_error()
- # Disable retries and run test_create_vpc_routing_table_value_error.
+ # Disable retries and run test_create_bare_metal_server_network_attachment_value_error.
_service.disable_retries()
- self.test_create_vpc_routing_table_value_error()
+ self.test_create_bare_metal_server_network_attachment_value_error()
-class TestDeleteVpcRoutingTable:
+class TestDeleteBareMetalServerNetworkAttachment:
"""
- Test Class for delete_vpc_routing_table
+ Test Class for delete_bare_metal_server_network_attachment
"""
@responses.activate
- def test_delete_vpc_routing_table_all_params(self):
- """
- delete_vpc_routing_table()
- """
- # 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'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
-
- # Invoke method
- response = _service.delete_vpc_routing_table(
- vpc_id,
- id,
- if_match=if_match,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_delete_vpc_routing_table_all_params_with_retries(self):
- # Enable retries and run test_delete_vpc_routing_table_all_params.
- _service.enable_retries()
- self.test_delete_vpc_routing_table_all_params()
-
- # Disable retries and run test_delete_vpc_routing_table_all_params.
- _service.disable_retries()
- self.test_delete_vpc_routing_table_all_params()
-
- @responses.activate
- def test_delete_vpc_routing_table_required_params(self):
+ def test_delete_bare_metal_server_network_attachment_all_params(self):
"""
- test_delete_vpc_routing_table_required_params()
+ delete_bare_metal_server_network_attachment()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_vpc_routing_table(
- vpc_id,
+ response = _service.delete_bare_metal_server_network_attachment(
+ bare_metal_server_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_vpc_routing_table_required_params_with_retries(self):
- # Enable retries and run test_delete_vpc_routing_table_required_params.
+ def test_delete_bare_metal_server_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_delete_bare_metal_server_network_attachment_all_params.
_service.enable_retries()
- self.test_delete_vpc_routing_table_required_params()
+ self.test_delete_bare_metal_server_network_attachment_all_params()
- # Disable retries and run test_delete_vpc_routing_table_required_params.
+ # Disable retries and run test_delete_bare_metal_server_network_attachment_all_params.
_service.disable_retries()
- self.test_delete_vpc_routing_table_required_params()
+ self.test_delete_bare_metal_server_network_attachment_all_params()
@responses.activate
- def test_delete_vpc_routing_table_value_error(self):
+ def test_delete_bare_metal_server_network_attachment_value_error(self):
"""
- test_delete_vpc_routing_table_value_error()
+ test_delete_bare_metal_server_network_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
+ "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_vpc_routing_table(**req_copy)
+ _service.delete_bare_metal_server_network_attachment(**req_copy)
- def test_delete_vpc_routing_table_value_error_with_retries(self):
- # Enable retries and run test_delete_vpc_routing_table_value_error.
+ def test_delete_bare_metal_server_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_delete_bare_metal_server_network_attachment_value_error.
_service.enable_retries()
- self.test_delete_vpc_routing_table_value_error()
+ self.test_delete_bare_metal_server_network_attachment_value_error()
- # Disable retries and run test_delete_vpc_routing_table_value_error.
+ # Disable retries and run test_delete_bare_metal_server_network_attachment_value_error.
_service.disable_retries()
- self.test_delete_vpc_routing_table_value_error()
+ self.test_delete_bare_metal_server_network_attachment_value_error()
-class TestGetVpcRoutingTable:
+class TestGetBareMetalServerNetworkAttachment:
"""
- Test Class for get_vpc_routing_table
+ Test Class for get_bare_metal_server_network_attachment
"""
@responses.activate
- def test_get_vpc_routing_table_all_params(self):
+ def test_get_bare_metal_server_network_attachment_all_params(self):
"""
- get_vpc_routing_table()
+ get_bare_metal_server_network_attachment()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
responses.add(
responses.GET,
url,
@@ -3411,12 +3667,12 @@ def test_get_vpc_routing_table_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_vpc_routing_table(
- vpc_id,
+ response = _service.get_bare_metal_server_network_attachment(
+ bare_metal_server_id,
id,
headers={},
)
@@ -3425,23 +3681,23 @@ def test_get_vpc_routing_table_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_vpc_routing_table_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_routing_table_all_params.
+ def test_get_bare_metal_server_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_get_bare_metal_server_network_attachment_all_params.
_service.enable_retries()
- self.test_get_vpc_routing_table_all_params()
+ self.test_get_bare_metal_server_network_attachment_all_params()
- # Disable retries and run test_get_vpc_routing_table_all_params.
+ # Disable retries and run test_get_bare_metal_server_network_attachment_all_params.
_service.disable_retries()
- self.test_get_vpc_routing_table_all_params()
+ self.test_get_bare_metal_server_network_attachment_all_params()
@responses.activate
- def test_get_vpc_routing_table_value_error(self):
+ def test_get_bare_metal_server_network_attachment_value_error(self):
"""
- test_get_vpc_routing_table_value_error()
+ test_get_bare_metal_server_network_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
responses.add(
responses.GET,
url,
@@ -3451,103 +3707,42 @@ def test_get_vpc_routing_table_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
+ "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_vpc_routing_table(**req_copy)
+ _service.get_bare_metal_server_network_attachment(**req_copy)
- def test_get_vpc_routing_table_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_routing_table_value_error.
+ def test_get_bare_metal_server_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_get_bare_metal_server_network_attachment_value_error.
_service.enable_retries()
- self.test_get_vpc_routing_table_value_error()
+ self.test_get_bare_metal_server_network_attachment_value_error()
- # Disable retries and run test_get_vpc_routing_table_value_error.
+ # Disable retries and run test_get_bare_metal_server_network_attachment_value_error.
_service.disable_retries()
- self.test_get_vpc_routing_table_value_error()
+ self.test_get_bare_metal_server_network_attachment_value_error()
-class TestUpdateVpcRoutingTable:
+class TestUpdateBareMetalServerNetworkAttachment:
"""
- Test Class for update_vpc_routing_table
+ Test Class for update_bare_metal_server_network_attachment
"""
@responses.activate
- def test_update_vpc_routing_table_all_params(self):
- """
- update_vpc_routing_table()
- """
- # Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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['advertise_routes_to'] = ['transit_gateway']
- routing_table_patch_model['name'] = 'my-routing-table-2'
- routing_table_patch_model['route_direct_link_ingress'] = True
- routing_table_patch_model['route_internet_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
- 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={},
- )
-
- # 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_all_params_with_retries(self):
- # Enable retries and run test_update_vpc_routing_table_all_params.
- _service.enable_retries()
- self.test_update_vpc_routing_table_all_params()
-
- # Disable retries and run test_update_vpc_routing_table_all_params.
- _service.disable_retries()
- self.test_update_vpc_routing_table_all_params()
-
- @responses.activate
- def test_update_vpc_routing_table_required_params(self):
+ def test_update_bare_metal_server_network_attachment_all_params(self):
"""
- test_update_vpc_routing_table_required_params()
+ update_bare_metal_server_network_attachment()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
responses.add(
responses.PATCH,
url,
@@ -3556,30 +3751,21 @@ def test_update_vpc_routing_table_required_params(self):
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['advertise_routes_to'] = ['transit_gateway']
- routing_table_patch_model['name'] = 'my-routing-table-2'
- routing_table_patch_model['route_direct_link_ingress'] = True
- routing_table_patch_model['route_internet_ingress'] = True
- routing_table_patch_model['route_transit_gateway_ingress'] = True
- routing_table_patch_model['route_vpc_zone_ingress'] = True
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPatch model
+ bare_metal_server_network_attachment_patch_model = {}
+ bare_metal_server_network_attachment_patch_model['allowed_vlans'] = [4]
+ bare_metal_server_network_attachment_patch_model['name'] = 'my-bare-metal-server-network-attachment-updated'
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
- routing_table_patch = routing_table_patch_model
+ bare_metal_server_network_attachment_patch = bare_metal_server_network_attachment_patch_model
# Invoke method
- response = _service.update_vpc_routing_table(
- vpc_id,
+ response = _service.update_bare_metal_server_network_attachment(
+ bare_metal_server_id,
id,
- routing_table_patch,
+ bare_metal_server_network_attachment_patch,
headers={},
)
@@ -3588,25 +3774,25 @@ def test_update_vpc_routing_table_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 == routing_table_patch
+ assert req_body == bare_metal_server_network_attachment_patch
- def test_update_vpc_routing_table_required_params_with_retries(self):
- # Enable retries and run test_update_vpc_routing_table_required_params.
+ def test_update_bare_metal_server_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_update_bare_metal_server_network_attachment_all_params.
_service.enable_retries()
- self.test_update_vpc_routing_table_required_params()
+ self.test_update_bare_metal_server_network_attachment_all_params()
- # Disable retries and run test_update_vpc_routing_table_required_params.
+ # Disable retries and run test_update_bare_metal_server_network_attachment_all_params.
_service.disable_retries()
- self.test_update_vpc_routing_table_required_params()
+ self.test_update_bare_metal_server_network_attachment_all_params()
@responses.activate
- def test_update_vpc_routing_table_value_error(self):
+ def test_update_bare_metal_server_network_attachment_value_error(self):
"""
- test_update_vpc_routing_table_value_error()
+ test_update_bare_metal_server_network_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
responses.add(
responses.PATCH,
url,
@@ -3615,59 +3801,50 @@ def test_update_vpc_routing_table_value_error(self):
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['advertise_routes_to'] = ['transit_gateway']
- routing_table_patch_model['name'] = 'my-routing-table-2'
- routing_table_patch_model['route_direct_link_ingress'] = True
- routing_table_patch_model['route_internet_ingress'] = True
- routing_table_patch_model['route_transit_gateway_ingress'] = True
- routing_table_patch_model['route_vpc_zone_ingress'] = True
+ # Construct a dict representation of a BareMetalServerNetworkAttachmentPatch model
+ bare_metal_server_network_attachment_patch_model = {}
+ bare_metal_server_network_attachment_patch_model['allowed_vlans'] = [4]
+ bare_metal_server_network_attachment_patch_model['name'] = 'my-bare-metal-server-network-attachment-updated'
# Set up parameter values
- vpc_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
- routing_table_patch = routing_table_patch_model
+ bare_metal_server_network_attachment_patch = bare_metal_server_network_attachment_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
+ "bare_metal_server_id": bare_metal_server_id,
"id": id,
- "routing_table_patch": routing_table_patch,
+ "bare_metal_server_network_attachment_patch": bare_metal_server_network_attachment_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_vpc_routing_table(**req_copy)
+ _service.update_bare_metal_server_network_attachment(**req_copy)
- def test_update_vpc_routing_table_value_error_with_retries(self):
- # Enable retries and run test_update_vpc_routing_table_value_error.
+ def test_update_bare_metal_server_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_update_bare_metal_server_network_attachment_value_error.
_service.enable_retries()
- self.test_update_vpc_routing_table_value_error()
+ self.test_update_bare_metal_server_network_attachment_value_error()
- # Disable retries and run test_update_vpc_routing_table_value_error.
+ # Disable retries and run test_update_bare_metal_server_network_attachment_value_error.
_service.disable_retries()
- self.test_update_vpc_routing_table_value_error()
+ self.test_update_bare_metal_server_network_attachment_value_error()
-class TestListVpcRoutingTableRoutes:
+class TestListBareMetalServerNetworkInterfaces:
"""
- Test Class for list_vpc_routing_table_routes
+ Test Class for list_bare_metal_server_network_interfaces
"""
@responses.activate
- def test_list_vpc_routing_table_routes_all_params(self):
+ def test_list_bare_metal_server_network_interfaces_all_params(self):
"""
- list_vpc_routing_table_routes()
+ list_bare_metal_server_network_interfaces()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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('/bare_metal_servers/testString/network_interfaces')
+ mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -3677,15 +3854,13 @@ def test_list_vpc_routing_table_routes_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
start = 'testString'
limit = 50
# Invoke method
- response = _service.list_vpc_routing_table_routes(
- vpc_id,
- routing_table_id,
+ response = _service.list_bare_metal_server_network_interfaces(
+ bare_metal_server_id,
start=start,
limit=limit,
headers={},
@@ -3700,23 +3875,23 @@ def test_list_vpc_routing_table_routes_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- def test_list_vpc_routing_table_routes_all_params_with_retries(self):
- # Enable retries and run test_list_vpc_routing_table_routes_all_params.
+ 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_vpc_routing_table_routes_all_params()
+ self.test_list_bare_metal_server_network_interfaces_all_params()
- # Disable retries and run test_list_vpc_routing_table_routes_all_params.
+ # Disable retries and run test_list_bare_metal_server_network_interfaces_all_params.
_service.disable_retries()
- self.test_list_vpc_routing_table_routes_all_params()
+ self.test_list_bare_metal_server_network_interfaces_all_params()
@responses.activate
- def test_list_vpc_routing_table_routes_required_params(self):
+ def test_list_bare_metal_server_network_interfaces_required_params(self):
"""
- test_list_vpc_routing_table_routes_required_params()
+ test_list_bare_metal_server_network_interfaces_required_params()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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('/bare_metal_servers/testString/network_interfaces')
+ mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -3726,13 +3901,11 @@ def test_list_vpc_routing_table_routes_required_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
# Invoke method
- response = _service.list_vpc_routing_table_routes(
- vpc_id,
- routing_table_id,
+ response = _service.list_bare_metal_server_network_interfaces(
+ bare_metal_server_id,
headers={},
)
@@ -3740,23 +3913,23 @@ def test_list_vpc_routing_table_routes_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpc_routing_table_routes_required_params_with_retries(self):
- # Enable retries and run test_list_vpc_routing_table_routes_required_params.
+ 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_vpc_routing_table_routes_required_params()
+ self.test_list_bare_metal_server_network_interfaces_required_params()
- # Disable retries and run test_list_vpc_routing_table_routes_required_params.
+ # Disable retries and run test_list_bare_metal_server_network_interfaces_required_params.
_service.disable_retries()
- self.test_list_vpc_routing_table_routes_required_params()
+ self.test_list_bare_metal_server_network_interfaces_required_params()
@responses.activate
- def test_list_vpc_routing_table_routes_value_error(self):
+ def test_list_bare_metal_server_network_interfaces_value_error(self):
"""
- test_list_vpc_routing_table_routes_value_error()
+ test_list_bare_metal_server_network_interfaces_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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('/bare_metal_servers/testString/network_interfaces')
+ mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -3766,37 +3939,35 @@ def test_list_vpc_routing_table_routes_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
- "routing_table_id": routing_table_id,
+ "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_vpc_routing_table_routes(**req_copy)
+ _service.list_bare_metal_server_network_interfaces(**req_copy)
- def test_list_vpc_routing_table_routes_value_error_with_retries(self):
- # Enable retries and run test_list_vpc_routing_table_routes_value_error.
+ 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_vpc_routing_table_routes_value_error()
+ self.test_list_bare_metal_server_network_interfaces_value_error()
- # Disable retries and run test_list_vpc_routing_table_routes_value_error.
+ # Disable retries and run test_list_bare_metal_server_network_interfaces_value_error.
_service.disable_retries()
- self.test_list_vpc_routing_table_routes_value_error()
+ self.test_list_bare_metal_server_network_interfaces_value_error()
@responses.activate
- def test_list_vpc_routing_table_routes_with_pager_get_next(self):
+ def test_list_bare_metal_server_network_interfaces_with_pager_get_next(self):
"""
- test_list_vpc_routing_table_routes_with_pager_get_next()
+ test_list_bare_metal_server_network_interfaces_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/bare_metal_servers/testString/network_interfaces')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
responses.add(
responses.GET,
url,
@@ -3814,10 +3985,9 @@ def test_list_vpc_routing_table_routes_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpcRoutingTableRoutesPager(
+ pager = BareMetalServerNetworkInterfacesPager(
client=_service,
- vpc_id='testString',
- routing_table_id='testString',
+ bare_metal_server_id='testString',
limit=10,
)
while pager.has_next():
@@ -3827,14 +3997,14 @@ def test_list_vpc_routing_table_routes_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpc_routing_table_routes_with_pager_get_all(self):
+ def test_list_bare_metal_server_network_interfaces_with_pager_get_all(self):
"""
- test_list_vpc_routing_table_routes_with_pager_get_all()
+ test_list_bare_metal_server_network_interfaces_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/bare_metal_servers/testString/network_interfaces')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
responses.add(
responses.GET,
url,
@@ -3851,10 +4021,9 @@ def test_list_vpc_routing_table_routes_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpcRoutingTableRoutesPager(
+ pager = BareMetalServerNetworkInterfacesPager(
client=_service,
- vpc_id='testString',
- routing_table_id='testString',
+ bare_metal_server_id='testString',
limit=10,
)
all_results = pager.get_all()
@@ -3862,19 +4031,19 @@ def test_list_vpc_routing_table_routes_with_pager_get_all(self):
assert len(all_results) == 2
-class TestCreateVpcRoutingTableRoute:
+class TestCreateBareMetalServerNetworkInterface:
"""
- Test Class for create_vpc_routing_table_route
+ Test Class for create_bare_metal_server_network_interface
"""
@responses.activate
- def test_create_vpc_routing_table_route_all_params(self):
+ def test_create_bare_metal_server_network_interface_all_params(self):
"""
- create_vpc_routing_table_route()
+ create_bare_metal_server_network_interface()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
responses.add(
responses.POST,
url,
@@ -3883,36 +4052,38 @@ def test_create_vpc_routing_table_route_all_params(self):
status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # 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 RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_prototype_model = {}
- route_next_hop_prototype_model['address'] = '0.0.0.0'
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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-bare-metal-server-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['interface_type'] = 'hipersocket'
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
- destination = '192.168.3.0/24'
- zone = zone_identity_model
- action = 'deliver'
- advertise = False
- name = 'my-vpc-routing-table-route'
- next_hop = route_next_hop_prototype_model
- priority = 1
+ bare_metal_server_id = 'testString'
+ bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model
# Invoke method
- response = _service.create_vpc_routing_table_route(
- vpc_id,
- routing_table_id,
- destination,
- zone,
- action=action,
- advertise=advertise,
- name=name,
- next_hop=next_hop,
- priority=priority,
+ response = _service.create_bare_metal_server_network_interface(
+ bare_metal_server_id,
+ bare_metal_server_network_interface_prototype,
headers={},
)
@@ -3921,31 +4092,25 @@ def test_create_vpc_routing_table_route_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['destination'] == '192.168.3.0/24'
- assert req_body['zone'] == zone_identity_model
- assert req_body['action'] == 'deliver'
- assert req_body['advertise'] == False
- assert req_body['name'] == 'my-vpc-routing-table-route'
- assert req_body['next_hop'] == route_next_hop_prototype_model
- assert req_body['priority'] == 1
+ assert req_body == bare_metal_server_network_interface_prototype
- def test_create_vpc_routing_table_route_all_params_with_retries(self):
- # Enable retries and run test_create_vpc_routing_table_route_all_params.
+ 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_vpc_routing_table_route_all_params()
+ self.test_create_bare_metal_server_network_interface_all_params()
- # Disable retries and run test_create_vpc_routing_table_route_all_params.
+ # Disable retries and run test_create_bare_metal_server_network_interface_all_params.
_service.disable_retries()
- self.test_create_vpc_routing_table_route_all_params()
+ self.test_create_bare_metal_server_network_interface_all_params()
@responses.activate
- def test_create_vpc_routing_table_route_value_error(self):
+ def test_create_bare_metal_server_network_interface_value_error(self):
"""
- test_create_vpc_routing_table_route_value_error()
+ test_create_bare_metal_server_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
responses.add(
responses.POST,
url,
@@ -3954,59 +4119,66 @@ def test_create_vpc_routing_table_route_value_error(self):
status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # 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 RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_prototype_model = {}
- route_next_hop_prototype_model['address'] = '0.0.0.0'
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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-bare-metal-server-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['interface_type'] = 'hipersocket'
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
- destination = '192.168.3.0/24'
- zone = zone_identity_model
- action = 'deliver'
- advertise = False
- name = 'my-vpc-routing-table-route'
- next_hop = route_next_hop_prototype_model
- priority = 1
+ 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 = {
- "vpc_id": vpc_id,
- "routing_table_id": routing_table_id,
- "destination": destination,
- "zone": zone,
+ "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_vpc_routing_table_route(**req_copy)
+ _service.create_bare_metal_server_network_interface(**req_copy)
- def test_create_vpc_routing_table_route_value_error_with_retries(self):
- # Enable retries and run test_create_vpc_routing_table_route_value_error.
+ 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_vpc_routing_table_route_value_error()
+ self.test_create_bare_metal_server_network_interface_value_error()
- # Disable retries and run test_create_vpc_routing_table_route_value_error.
+ # Disable retries and run test_create_bare_metal_server_network_interface_value_error.
_service.disable_retries()
- self.test_create_vpc_routing_table_route_value_error()
+ self.test_create_bare_metal_server_network_interface_value_error()
-class TestDeleteVpcRoutingTableRoute:
+class TestDeleteBareMetalServerNetworkInterface:
"""
- Test Class for delete_vpc_routing_table_route
+ Test Class for delete_bare_metal_server_network_interface
"""
@responses.activate
- def test_delete_vpc_routing_table_route_all_params(self):
+ def test_delete_bare_metal_server_network_interface_all_params(self):
"""
- delete_vpc_routing_table_route()
+ delete_bare_metal_server_network_interface()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
+ url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString')
responses.add(
responses.DELETE,
url,
@@ -4014,14 +4186,12 @@ def test_delete_vpc_routing_table_route_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_vpc_routing_table_route(
- vpc_id,
- routing_table_id,
+ response = _service.delete_bare_metal_server_network_interface(
+ bare_metal_server_id,
id,
headers={},
)
@@ -4030,22 +4200,22 @@ def test_delete_vpc_routing_table_route_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_vpc_routing_table_route_all_params_with_retries(self):
- # Enable retries and run test_delete_vpc_routing_table_route_all_params.
+ 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_vpc_routing_table_route_all_params()
+ self.test_delete_bare_metal_server_network_interface_all_params()
- # Disable retries and run test_delete_vpc_routing_table_route_all_params.
+ # Disable retries and run test_delete_bare_metal_server_network_interface_all_params.
_service.disable_retries()
- self.test_delete_vpc_routing_table_route_all_params()
+ self.test_delete_bare_metal_server_network_interface_all_params()
@responses.activate
- def test_delete_vpc_routing_table_route_value_error(self):
+ def test_delete_bare_metal_server_network_interface_value_error(self):
"""
- test_delete_vpc_routing_table_route_value_error()
+ test_delete_bare_metal_server_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
+ url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString')
responses.add(
responses.DELETE,
url,
@@ -4053,44 +4223,42 @@ def test_delete_vpc_routing_table_route_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
- "routing_table_id": routing_table_id,
+ "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_vpc_routing_table_route(**req_copy)
+ _service.delete_bare_metal_server_network_interface(**req_copy)
- def test_delete_vpc_routing_table_route_value_error_with_retries(self):
- # Enable retries and run test_delete_vpc_routing_table_route_value_error.
+ 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_vpc_routing_table_route_value_error()
+ self.test_delete_bare_metal_server_network_interface_value_error()
- # Disable retries and run test_delete_vpc_routing_table_route_value_error.
+ # Disable retries and run test_delete_bare_metal_server_network_interface_value_error.
_service.disable_retries()
- self.test_delete_vpc_routing_table_route_value_error()
+ self.test_delete_bare_metal_server_network_interface_value_error()
-class TestGetVpcRoutingTableRoute:
+class TestGetBareMetalServerNetworkInterface:
"""
- Test Class for get_vpc_routing_table_route
+ Test Class for get_bare_metal_server_network_interface
"""
@responses.activate
- def test_get_vpc_routing_table_route_all_params(self):
+ def test_get_bare_metal_server_network_interface_all_params(self):
"""
- get_vpc_routing_table_route()
+ get_bare_metal_server_network_interface()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
responses.add(
responses.GET,
url,
@@ -4100,14 +4268,12 @@ def test_get_vpc_routing_table_route_all_params(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_vpc_routing_table_route(
- vpc_id,
- routing_table_id,
+ response = _service.get_bare_metal_server_network_interface(
+ bare_metal_server_id,
id,
headers={},
)
@@ -4116,23 +4282,23 @@ def test_get_vpc_routing_table_route_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_vpc_routing_table_route_all_params_with_retries(self):
- # Enable retries and run test_get_vpc_routing_table_route_all_params.
+ 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_vpc_routing_table_route_all_params()
+ self.test_get_bare_metal_server_network_interface_all_params()
- # Disable retries and run test_get_vpc_routing_table_route_all_params.
+ # Disable retries and run test_get_bare_metal_server_network_interface_all_params.
_service.disable_retries()
- self.test_get_vpc_routing_table_route_all_params()
+ self.test_get_bare_metal_server_network_interface_all_params()
@responses.activate
- def test_get_vpc_routing_table_route_value_error(self):
+ def test_get_bare_metal_server_network_interface_value_error(self):
"""
- test_get_vpc_routing_table_route_value_error()
+ test_get_bare_metal_server_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
responses.add(
responses.GET,
url,
@@ -4142,44 +4308,42 @@ def test_get_vpc_routing_table_route_value_error(self):
)
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc_id": vpc_id,
- "routing_table_id": routing_table_id,
+ "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_vpc_routing_table_route(**req_copy)
+ _service.get_bare_metal_server_network_interface(**req_copy)
- def test_get_vpc_routing_table_route_value_error_with_retries(self):
- # Enable retries and run test_get_vpc_routing_table_route_value_error.
+ 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_vpc_routing_table_route_value_error()
+ self.test_get_bare_metal_server_network_interface_value_error()
- # Disable retries and run test_get_vpc_routing_table_route_value_error.
+ # Disable retries and run test_get_bare_metal_server_network_interface_value_error.
_service.disable_retries()
- self.test_get_vpc_routing_table_route_value_error()
+ self.test_get_bare_metal_server_network_interface_value_error()
-class TestUpdateVpcRoutingTableRoute:
+class TestUpdateBareMetalServerNetworkInterface:
"""
- Test Class for update_vpc_routing_table_route
+ Test Class for update_bare_metal_server_network_interface
"""
@responses.activate
- def test_update_vpc_routing_table_route_all_params(self):
+ def test_update_bare_metal_server_network_interface_all_params(self):
"""
- update_vpc_routing_table_route()
+ update_bare_metal_server_network_interface()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
responses.add(
responses.PATCH,
url,
@@ -4188,29 +4352,23 @@ def test_update_vpc_routing_table_route_all_params(self):
status=200,
)
- # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_patch_model = {}
- route_next_hop_patch_model['address'] = '0.0.0.0'
-
- # Construct a dict representation of a RoutePatch model
- route_patch_model = {}
- route_patch_model['advertise'] = False
- route_patch_model['name'] = 'my-vpc-routing-table-route'
- route_patch_model['next_hop'] = route_next_hop_patch_model
- route_patch_model['priority'] = 1
+ # 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-bare-metal-server-network-interface'
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
- route_patch = route_patch_model
+ bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model
# Invoke method
- response = _service.update_vpc_routing_table_route(
- vpc_id,
- routing_table_id,
+ response = _service.update_bare_metal_server_network_interface(
+ bare_metal_server_id,
id,
- route_patch,
+ bare_metal_server_network_interface_patch,
headers={},
)
@@ -4219,25 +4377,25 @@ def test_update_vpc_routing_table_route_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 == route_patch
+ assert req_body == bare_metal_server_network_interface_patch
- def test_update_vpc_routing_table_route_all_params_with_retries(self):
- # Enable retries and run test_update_vpc_routing_table_route_all_params.
+ 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_vpc_routing_table_route_all_params()
+ self.test_update_bare_metal_server_network_interface_all_params()
- # Disable retries and run test_update_vpc_routing_table_route_all_params.
+ # Disable retries and run test_update_bare_metal_server_network_interface_all_params.
_service.disable_retries()
- self.test_update_vpc_routing_table_route_all_params()
+ self.test_update_bare_metal_server_network_interface_all_params()
@responses.activate
- def test_update_vpc_routing_table_route_value_error(self):
+ def test_update_bare_metal_server_network_interface_value_error(self):
"""
- test_update_vpc_routing_table_route_value_error()
+ test_update_bare_metal_server_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
- mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
responses.add(
responses.PATCH,
url,
@@ -4246,115 +4404,52 @@ def test_update_vpc_routing_table_route_value_error(self):
status=200,
)
- # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
- route_next_hop_patch_model = {}
- route_next_hop_patch_model['address'] = '0.0.0.0'
-
- # Construct a dict representation of a RoutePatch model
- route_patch_model = {}
- route_patch_model['advertise'] = False
- route_patch_model['name'] = 'my-vpc-routing-table-route'
- route_patch_model['next_hop'] = route_next_hop_patch_model
- route_patch_model['priority'] = 1
+ # 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-bare-metal-server-network-interface'
# Set up parameter values
- vpc_id = 'testString'
- routing_table_id = 'testString'
+ bare_metal_server_id = 'testString'
id = 'testString'
- route_patch = route_patch_model
+ 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 = {
- "vpc_id": vpc_id,
- "routing_table_id": routing_table_id,
+ "bare_metal_server_id": bare_metal_server_id,
"id": id,
- "route_patch": route_patch,
+ "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_vpc_routing_table_route(**req_copy)
+ _service.update_bare_metal_server_network_interface(**req_copy)
- def test_update_vpc_routing_table_route_value_error_with_retries(self):
- # Enable retries and run test_update_vpc_routing_table_route_value_error.
+ 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_vpc_routing_table_route_value_error()
+ self.test_update_bare_metal_server_network_interface_value_error()
- # Disable retries and run test_update_vpc_routing_table_route_value_error.
+ # Disable retries and run test_update_bare_metal_server_network_interface_value_error.
_service.disable_retries()
- self.test_update_vpc_routing_table_route_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: VPCs
-##############################################################################
-
-##############################################################################
-# Start of Service: Subnets
-##############################################################################
-# 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,
- )
+ self.test_update_bare_metal_server_network_interface_value_error()
-class TestListSubnets:
+class TestListBareMetalServerNetworkInterfaceFloatingIps:
"""
- Test Class for list_subnets
+ Test Class for list_bare_metal_server_network_interface_floating_ips
"""
@responses.activate
- def test_list_subnets_all_params(self):
+ def test_list_bare_metal_server_network_interface_floating_ips_all_params(self):
"""
- list_subnets()
+ list_bare_metal_server_network_interface_floating_ips()
"""
# Set up mock
- url = preprocess_url('/subnets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -4364,63 +4459,37 @@ def test_list_subnets_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- zone_name = 'us-south-1'
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
- routing_table_id = 'testString'
- routing_table_name = 'my-routing-table'
+ bare_metal_server_id = 'testString'
+ network_interface_id = 'testString'
# Invoke method
- response = _service.list_subnets(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
- zone_name=zone_name,
- vpc_id=vpc_id,
- vpc_crn=vpc_crn,
- vpc_name=vpc_name,
- routing_table_id=routing_table_id,
- routing_table_name=routing_table_name,
+ 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
- # 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 'zone.name={}'.format(zone_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 'routing_table.id={}'.format(routing_table_id) in query_string
- assert 'routing_table.name={}'.format(routing_table_name) in query_string
- def test_list_subnets_all_params_with_retries(self):
- # Enable retries and run test_list_subnets_all_params.
+ 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_subnets_all_params()
+ self.test_list_bare_metal_server_network_interface_floating_ips_all_params()
- # Disable retries and run test_list_subnets_all_params.
+ # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_all_params.
_service.disable_retries()
- self.test_list_subnets_all_params()
+ self.test_list_bare_metal_server_network_interface_floating_ips_all_params()
@responses.activate
- def test_list_subnets_required_params(self):
+ def test_list_bare_metal_server_network_interface_floating_ips_value_error(self):
"""
- test_list_subnets_required_params()
+ test_list_bare_metal_server_network_interface_floating_ips_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -4429,383 +4498,389 @@ def test_list_subnets_required_params(self):
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.list_subnets()
+ 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 == 200
+ assert response.status_code == 204
- def test_list_subnets_required_params_with_retries(self):
- # Enable retries and run test_list_subnets_required_params.
+ 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_list_subnets_required_params()
+ self.test_remove_bare_metal_server_network_interface_floating_ip_all_params()
- # Disable retries and run test_list_subnets_required_params.
+ # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_list_subnets_required_params()
+ self.test_remove_bare_metal_server_network_interface_floating_ip_all_params()
@responses.activate
- def test_list_subnets_value_error(self):
+ def test_remove_bare_metal_server_network_interface_floating_ip_value_error(self):
"""
- test_list_subnets_value_error()
+ test_remove_bare_metal_server_network_interface_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString')
responses.add(
- responses.GET,
+ 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.list_subnets(**req_copy)
+ _service.remove_bare_metal_server_network_interface_floating_ip(**req_copy)
- def test_list_subnets_value_error_with_retries(self):
- # Enable retries and run test_list_subnets_value_error.
+ 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_list_subnets_value_error()
+ self.test_remove_bare_metal_server_network_interface_floating_ip_value_error()
- # Disable retries and run test_list_subnets_value_error.
+ # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_list_subnets_value_error()
+ 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_list_subnets_with_pager_get_next(self):
+ def test_get_bare_metal_server_network_interface_floating_ip_all_params(self):
"""
- test_list_subnets_with_pager_get_next()
+ get_bare_metal_server_network_interface_floating_ip()
"""
- # Set up a two-page mock response
- url = preprocess_url('/subnets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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_response1,
- content_type='application/json',
- status=200,
- )
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = SubnetsPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- zone_name='us-south-1',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- routing_table_id='testString',
- routing_table_name='my-routing-table',
+ # 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={},
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+
+ # 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_list_subnets_with_pager_get_all(self):
+ def test_get_bare_metal_server_network_interface_floating_ip_value_error(self):
"""
- test_list_subnets_with_pager_get_all()
+ test_get_bare_metal_server_network_interface_floating_ip_value_error()
"""
- # Set up a two-page mock response
- url = preprocess_url('/subnets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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_response1,
- content_type='application/json',
- status=200,
- )
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- pager = SubnetsPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- zone_name='us-south-1',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- routing_table_id='testString',
- routing_table_name='my-routing-table',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # 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)
-class TestCreateSubnet:
+ 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 create_subnet
+ Test Class for add_bare_metal_server_network_interface_floating_ip
"""
@responses.activate
- def test_create_subnet_all_params(self):
+ def test_add_bare_metal_server_network_interface_floating_ip_all_params(self):
"""
- create_subnet()
+ add_bare_metal_server_network_interface_floating_ip()
"""
# Set up mock
- url = preprocess_url('/subnets')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
status=201,
)
- # Construct a dict representation of a NetworkACLIdentityById model
- network_acl_identity_model = {}
- network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
-
- # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
- public_gateway_identity_model = {}
- public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # Construct a dict representation of a RoutingTableIdentityByCRN model
- routing_table_identity_model = {}
- routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-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 SubnetPrototypeSubnetByTotalCount model
- subnet_prototype_model = {}
- subnet_prototype_model['ip_version'] = 'ipv4'
- subnet_prototype_model['name'] = 'my-subnet'
- subnet_prototype_model['network_acl'] = network_acl_identity_model
- subnet_prototype_model['public_gateway'] = public_gateway_identity_model
- subnet_prototype_model['resource_group'] = resource_group_identity_model
- subnet_prototype_model['routing_table'] = routing_table_identity_model
- subnet_prototype_model['vpc'] = vpc_identity_model
- subnet_prototype_model['total_ipv4_address_count'] = 256
- subnet_prototype_model['zone'] = zone_identity_model
-
- # Set up parameter values
- subnet_prototype = subnet_prototype_model
+ # Set up parameter values
+ bare_metal_server_id = 'testString'
+ network_interface_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.create_subnet(
- subnet_prototype,
+ 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
- # Validate body params
- req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body == subnet_prototype
- def test_create_subnet_all_params_with_retries(self):
- # Enable retries and run test_create_subnet_all_params.
+ 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_create_subnet_all_params()
+ self.test_add_bare_metal_server_network_interface_floating_ip_all_params()
- # Disable retries and run test_create_subnet_all_params.
+ # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_create_subnet_all_params()
+ self.test_add_bare_metal_server_network_interface_floating_ip_all_params()
@responses.activate
- def test_create_subnet_value_error(self):
+ def test_add_bare_metal_server_network_interface_floating_ip_value_error(self):
"""
- test_create_subnet_value_error()
+ test_add_bare_metal_server_network_interface_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
status=201,
)
- # Construct a dict representation of a NetworkACLIdentityById model
- network_acl_identity_model = {}
- network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
-
- # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
- public_gateway_identity_model = {}
- public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # Construct a dict representation of a RoutingTableIdentityByCRN model
- routing_table_identity_model = {}
- routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-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 SubnetPrototypeSubnetByTotalCount model
- subnet_prototype_model = {}
- subnet_prototype_model['ip_version'] = 'ipv4'
- subnet_prototype_model['name'] = 'my-subnet'
- subnet_prototype_model['network_acl'] = network_acl_identity_model
- subnet_prototype_model['public_gateway'] = public_gateway_identity_model
- subnet_prototype_model['resource_group'] = resource_group_identity_model
- subnet_prototype_model['routing_table'] = routing_table_identity_model
- subnet_prototype_model['vpc'] = vpc_identity_model
- subnet_prototype_model['total_ipv4_address_count'] = 256
- subnet_prototype_model['zone'] = zone_identity_model
-
# Set up parameter values
- subnet_prototype = subnet_prototype_model
+ 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 = {
- "subnet_prototype": subnet_prototype,
+ "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.create_subnet(**req_copy)
+ _service.add_bare_metal_server_network_interface_floating_ip(**req_copy)
- def test_create_subnet_value_error_with_retries(self):
- # Enable retries and run test_create_subnet_value_error.
+ 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_create_subnet_value_error()
+ self.test_add_bare_metal_server_network_interface_floating_ip_value_error()
- # Disable retries and run test_create_subnet_value_error.
+ # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_create_subnet_value_error()
+ self.test_add_bare_metal_server_network_interface_floating_ip_value_error()
-class TestDeleteSubnet:
+class TestListBareMetalServerNetworkInterfaceIps:
"""
- Test Class for delete_subnet
+ Test Class for list_bare_metal_server_network_interface_ips
"""
@responses.activate
- def test_delete_subnet_all_params(self):
+ def test_list_bare_metal_server_network_interface_ips_all_params(self):
"""
- delete_subnet()
+ list_bare_metal_server_network_interface_ips()
"""
# Set up mock
- url = preprocess_url('/subnets/testString')
+ url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ bare_metal_server_id = 'testString'
+ network_interface_id = 'testString'
# Invoke method
- response = _service.delete_subnet(
- id,
+ response = _service.list_bare_metal_server_network_interface_ips(
+ bare_metal_server_id,
+ network_interface_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_subnet_all_params_with_retries(self):
- # Enable retries and run test_delete_subnet_all_params.
+ 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.
_service.enable_retries()
- self.test_delete_subnet_all_params()
+ self.test_list_bare_metal_server_network_interface_ips_all_params()
- # Disable retries and run test_delete_subnet_all_params.
+ # Disable retries and run test_list_bare_metal_server_network_interface_ips_all_params.
_service.disable_retries()
- self.test_delete_subnet_all_params()
+ self.test_list_bare_metal_server_network_interface_ips_all_params()
@responses.activate
- def test_delete_subnet_value_error(self):
+ def test_list_bare_metal_server_network_interface_ips_value_error(self):
"""
- test_delete_subnet_value_error()
+ test_list_bare_metal_server_network_interface_ips_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString')
+ url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ bare_metal_server_id = 'testString'
+ network_interface_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "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.delete_subnet(**req_copy)
+ _service.list_bare_metal_server_network_interface_ips(**req_copy)
- def test_delete_subnet_value_error_with_retries(self):
- # Enable retries and run test_delete_subnet_value_error.
+ 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_delete_subnet_value_error()
+ self.test_list_bare_metal_server_network_interface_ips_value_error()
- # Disable retries and run test_delete_subnet_value_error.
+ # Disable retries and run test_list_bare_metal_server_network_interface_ips_value_error.
_service.disable_retries()
- self.test_delete_subnet_value_error()
+ self.test_list_bare_metal_server_network_interface_ips_value_error()
-class TestGetSubnet:
+class TestGetBareMetalServerNetworkInterfaceIp:
"""
- Test Class for get_subnet
+ Test Class for get_bare_metal_server_network_interface_ip
"""
@responses.activate
- def test_get_subnet_all_params(self):
+ def test_get_bare_metal_server_network_interface_ip_all_params(self):
"""
- get_subnet()
+ get_bare_metal_server_network_interface_ip()
"""
# Set up mock
- url = preprocess_url('/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
responses.GET,
url,
@@ -4815,10 +4890,14 @@ def test_get_subnet_all_params(self):
)
# Set up parameter values
+ bare_metal_server_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_subnet(
+ response = _service.get_bare_metal_server_network_interface_ip(
+ bare_metal_server_id,
+ network_interface_id,
id,
headers={},
)
@@ -4827,23 +4906,23 @@ def test_get_subnet_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_subnet_all_params_with_retries(self):
- # Enable retries and run test_get_subnet_all_params.
+ 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.
_service.enable_retries()
- self.test_get_subnet_all_params()
+ self.test_get_bare_metal_server_network_interface_ip_all_params()
- # Disable retries and run test_get_subnet_all_params.
+ # Disable retries and run test_get_bare_metal_server_network_interface_ip_all_params.
_service.disable_retries()
- self.test_get_subnet_all_params()
+ self.test_get_bare_metal_server_network_interface_ip_all_params()
@responses.activate
- def test_get_subnet_value_error(self):
+ def test_get_bare_metal_server_network_interface_ip_value_error(self):
"""
- test_get_subnet_value_error()
+ test_get_bare_metal_server_network_interface_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
responses.GET,
url,
@@ -4853,166 +4932,119 @@ def test_get_subnet_value_error(self):
)
# 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_subnet(**req_copy)
+ _service.get_bare_metal_server_network_interface_ip(**req_copy)
- def test_get_subnet_value_error_with_retries(self):
- # Enable retries and run test_get_subnet_value_error.
+ 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.
_service.enable_retries()
- self.test_get_subnet_value_error()
+ self.test_get_bare_metal_server_network_interface_ip_value_error()
- # Disable retries and run test_get_subnet_value_error.
+ # Disable retries and run test_get_bare_metal_server_network_interface_ip_value_error.
_service.disable_retries()
- self.test_get_subnet_value_error()
+ self.test_get_bare_metal_server_network_interface_ip_value_error()
-class TestUpdateSubnet:
+class TestDeleteBareMetalServer:
"""
- Test Class for update_subnet
+ Test Class for delete_bare_metal_server
"""
@responses.activate
- def test_update_subnet_all_params(self):
+ def test_delete_bare_metal_server_all_params(self):
"""
- update_subnet()
+ delete_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Construct a dict representation of a NetworkACLIdentityById model
- network_acl_identity_model = {}
- network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
-
- # Construct a dict representation of a SubnetPublicGatewayPatchPublicGatewayIdentityById model
- subnet_public_gateway_patch_model = {}
- subnet_public_gateway_patch_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
-
- # Construct a dict representation of a RoutingTableIdentityByCRN model
- routing_table_identity_model = {}
- routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
-
- # Construct a dict representation of a SubnetPatch model
- subnet_patch_model = {}
- subnet_patch_model['name'] = 'my-subnet'
- subnet_patch_model['network_acl'] = network_acl_identity_model
- subnet_patch_model['public_gateway'] = subnet_public_gateway_patch_model
- subnet_patch_model['routing_table'] = routing_table_identity_model
-
# Set up parameter values
id = 'testString'
- subnet_patch = subnet_patch_model
# Invoke method
- response = _service.update_subnet(
+ response = _service.delete_bare_metal_server(
id,
- subnet_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 == subnet_patch
+ assert response.status_code == 202
- def test_update_subnet_all_params_with_retries(self):
- # Enable retries and run test_update_subnet_all_params.
+ 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_update_subnet_all_params()
+ self.test_delete_bare_metal_server_all_params()
- # Disable retries and run test_update_subnet_all_params.
+ # Disable retries and run test_delete_bare_metal_server_all_params.
_service.disable_retries()
- self.test_update_subnet_all_params()
+ self.test_delete_bare_metal_server_all_params()
@responses.activate
- def test_update_subnet_value_error(self):
+ def test_delete_bare_metal_server_value_error(self):
"""
- test_update_subnet_value_error()
+ test_delete_bare_metal_server_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Construct a dict representation of a NetworkACLIdentityById model
- network_acl_identity_model = {}
- network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
-
- # Construct a dict representation of a SubnetPublicGatewayPatchPublicGatewayIdentityById model
- subnet_public_gateway_patch_model = {}
- subnet_public_gateway_patch_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
-
- # Construct a dict representation of a RoutingTableIdentityByCRN model
- routing_table_identity_model = {}
- routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
-
- # Construct a dict representation of a SubnetPatch model
- subnet_patch_model = {}
- subnet_patch_model['name'] = 'my-subnet'
- subnet_patch_model['network_acl'] = network_acl_identity_model
- subnet_patch_model['public_gateway'] = subnet_public_gateway_patch_model
- subnet_patch_model['routing_table'] = routing_table_identity_model
-
# Set up parameter values
id = 'testString'
- subnet_patch = subnet_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "subnet_patch": subnet_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_subnet(**req_copy)
+ _service.delete_bare_metal_server(**req_copy)
- def test_update_subnet_value_error_with_retries(self):
- # Enable retries and run test_update_subnet_value_error.
+ 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_update_subnet_value_error()
+ self.test_delete_bare_metal_server_value_error()
- # Disable retries and run test_update_subnet_value_error.
+ # Disable retries and run test_delete_bare_metal_server_value_error.
_service.disable_retries()
- self.test_update_subnet_value_error()
+ self.test_delete_bare_metal_server_value_error()
-class TestGetSubnetNetworkAcl:
+class TestGetBareMetalServer:
"""
- Test Class for get_subnet_network_acl
+ Test Class for get_bare_metal_server
"""
@responses.activate
- def test_get_subnet_network_acl_all_params(self):
+ def test_get_bare_metal_server_all_params(self):
"""
- get_subnet_network_acl()
+ get_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/network_acl')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -5025,7 +5057,7 @@ def test_get_subnet_network_acl_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_subnet_network_acl(
+ response = _service.get_bare_metal_server(
id,
headers={},
)
@@ -5034,23 +5066,23 @@ def test_get_subnet_network_acl_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_subnet_network_acl_all_params_with_retries(self):
- # Enable retries and run test_get_subnet_network_acl_all_params.
+ 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_subnet_network_acl_all_params()
+ self.test_get_bare_metal_server_all_params()
- # Disable retries and run test_get_subnet_network_acl_all_params.
+ # Disable retries and run test_get_bare_metal_server_all_params.
_service.disable_retries()
- self.test_get_subnet_network_acl_all_params()
+ self.test_get_bare_metal_server_all_params()
@responses.activate
- def test_get_subnet_network_acl_value_error(self):
+ def test_get_bare_metal_server_value_error(self):
"""
- test_get_subnet_network_acl_value_error()
+ test_get_bare_metal_server_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/network_acl')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -5069,163 +5101,249 @@ def test_get_subnet_network_acl_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_subnet_network_acl(**req_copy)
+ _service.get_bare_metal_server(**req_copy)
- def test_get_subnet_network_acl_value_error_with_retries(self):
- # Enable retries and run test_get_subnet_network_acl_value_error.
+ 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_subnet_network_acl_value_error()
+ self.test_get_bare_metal_server_value_error()
- # Disable retries and run test_get_subnet_network_acl_value_error.
+ # Disable retries and run test_get_bare_metal_server_value_error.
_service.disable_retries()
- self.test_get_subnet_network_acl_value_error()
+ self.test_get_bare_metal_server_value_error()
-class TestReplaceSubnetNetworkAcl:
+class TestUpdateBareMetalServer:
"""
- Test Class for replace_subnet_network_acl
+ Test Class for update_bare_metal_server
"""
@responses.activate
- def test_replace_subnet_network_acl_all_params(self):
+ def test_update_bare_metal_server_all_params(self):
"""
- replace_subnet_network_acl()
+ update_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/network_acl')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.PUT,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a NetworkACLIdentityById model
- network_acl_identity_model = {}
- network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
+ # Construct a dict representation of a BareMetalServerMetadataServicePatch model
+ bare_metal_server_metadata_service_patch_model = {}
+ bare_metal_server_metadata_service_patch_model['enabled'] = True
+ bare_metal_server_metadata_service_patch_model['protocol'] = 'http'
+
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a BareMetalServerReservationAffinityPatch model
+ bare_metal_server_reservation_affinity_patch_model = {}
+ bare_metal_server_reservation_affinity_patch_model['policy'] = 'automatic'
+ bare_metal_server_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
+
+ # Construct a dict representation of a BareMetalServerTrustedPlatformModulePatch model
+ bare_metal_server_trusted_platform_module_patch_model = {}
+ bare_metal_server_trusted_platform_module_patch_model['mode'] = 'disabled'
+
+ # Construct a dict representation of a BareMetalServerPatch model
+ bare_metal_server_patch_model = {}
+ bare_metal_server_patch_model['bandwidth'] = 20000
+ bare_metal_server_patch_model['enable_secure_boot'] = False
+ bare_metal_server_patch_model['metadata_service'] = bare_metal_server_metadata_service_patch_model
+ bare_metal_server_patch_model['name'] = 'my-bare-metal-server'
+ bare_metal_server_patch_model['reservation_affinity'] = bare_metal_server_reservation_affinity_patch_model
+ bare_metal_server_patch_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_patch_model
# Set up parameter values
id = 'testString'
- network_acl_identity = network_acl_identity_model
+ bare_metal_server_patch = bare_metal_server_patch_model
# Invoke method
- response = _service.replace_subnet_network_acl(
+ response = _service.update_bare_metal_server(
id,
- network_acl_identity,
+ bare_metal_server_patch,
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 == network_acl_identity
+ assert req_body == bare_metal_server_patch
- def test_replace_subnet_network_acl_all_params_with_retries(self):
- # Enable retries and run test_replace_subnet_network_acl_all_params.
+ 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_replace_subnet_network_acl_all_params()
+ self.test_update_bare_metal_server_all_params()
- # Disable retries and run test_replace_subnet_network_acl_all_params.
+ # Disable retries and run test_update_bare_metal_server_all_params.
_service.disable_retries()
- self.test_replace_subnet_network_acl_all_params()
+ self.test_update_bare_metal_server_all_params()
@responses.activate
- def test_replace_subnet_network_acl_value_error(self):
+ def test_update_bare_metal_server_value_error(self):
"""
- test_replace_subnet_network_acl_value_error()
+ test_update_bare_metal_server_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/network_acl')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "metadata_service": {"enabled": false, "protocol": "http"}, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.PUT,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a NetworkACLIdentityById model
- network_acl_identity_model = {}
- network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
+ # Construct a dict representation of a BareMetalServerMetadataServicePatch model
+ bare_metal_server_metadata_service_patch_model = {}
+ bare_metal_server_metadata_service_patch_model['enabled'] = True
+ bare_metal_server_metadata_service_patch_model['protocol'] = 'http'
+
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a BareMetalServerReservationAffinityPatch model
+ bare_metal_server_reservation_affinity_patch_model = {}
+ bare_metal_server_reservation_affinity_patch_model['policy'] = 'automatic'
+ bare_metal_server_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
+
+ # Construct a dict representation of a BareMetalServerTrustedPlatformModulePatch model
+ bare_metal_server_trusted_platform_module_patch_model = {}
+ bare_metal_server_trusted_platform_module_patch_model['mode'] = 'disabled'
+
+ # Construct a dict representation of a BareMetalServerPatch model
+ bare_metal_server_patch_model = {}
+ bare_metal_server_patch_model['bandwidth'] = 20000
+ bare_metal_server_patch_model['enable_secure_boot'] = False
+ bare_metal_server_patch_model['metadata_service'] = bare_metal_server_metadata_service_patch_model
+ bare_metal_server_patch_model['name'] = 'my-bare-metal-server'
+ bare_metal_server_patch_model['reservation_affinity'] = bare_metal_server_reservation_affinity_patch_model
+ bare_metal_server_patch_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_patch_model
# Set up parameter values
id = 'testString'
- network_acl_identity = network_acl_identity_model
+ 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,
- "network_acl_identity": network_acl_identity,
+ "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.replace_subnet_network_acl(**req_copy)
+ _service.update_bare_metal_server(**req_copy)
- def test_replace_subnet_network_acl_value_error_with_retries(self):
- # Enable retries and run test_replace_subnet_network_acl_value_error.
+ 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_replace_subnet_network_acl_value_error()
+ self.test_update_bare_metal_server_value_error()
- # Disable retries and run test_replace_subnet_network_acl_value_error.
+ # Disable retries and run test_update_bare_metal_server_value_error.
_service.disable_retries()
- self.test_replace_subnet_network_acl_value_error()
+ self.test_update_bare_metal_server_value_error()
-class TestUnsetSubnetPublicGateway:
+class TestUpdateFirmwareForBareMetalServer:
"""
- Test Class for unset_subnet_public_gateway
+ Test Class for update_firmware_for_bare_metal_server
"""
@responses.activate
- def test_unset_subnet_public_gateway_all_params(self):
+ def test_update_firmware_for_bare_metal_server_all_params(self):
"""
- unset_subnet_public_gateway()
+ update_firmware_for_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/public_gateway')
+ url = preprocess_url('/bare_metal_servers/testString/firmware/update')
responses.add(
- responses.DELETE,
+ responses.POST,
url,
status=204,
)
# Set up parameter values
id = 'testString'
+ auto_start = True
# Invoke method
- response = _service.unset_subnet_public_gateway(
+ response = _service.update_firmware_for_bare_metal_server(
id,
+ auto_start=auto_start,
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['auto_start'] == True
- def test_unset_subnet_public_gateway_all_params_with_retries(self):
- # Enable retries and run test_unset_subnet_public_gateway_all_params.
+ def test_update_firmware_for_bare_metal_server_all_params_with_retries(self):
+ # Enable retries and run test_update_firmware_for_bare_metal_server_all_params.
_service.enable_retries()
- self.test_unset_subnet_public_gateway_all_params()
+ self.test_update_firmware_for_bare_metal_server_all_params()
- # Disable retries and run test_unset_subnet_public_gateway_all_params.
+ # Disable retries and run test_update_firmware_for_bare_metal_server_all_params.
_service.disable_retries()
- self.test_unset_subnet_public_gateway_all_params()
+ self.test_update_firmware_for_bare_metal_server_all_params()
@responses.activate
- def test_unset_subnet_public_gateway_value_error(self):
+ def test_update_firmware_for_bare_metal_server_required_params(self):
"""
- test_unset_subnet_public_gateway_value_error()
+ test_update_firmware_for_bare_metal_server_required_params()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/public_gateway')
+ url = preprocess_url('/bare_metal_servers/testString/firmware/update')
responses.add(
- responses.DELETE,
+ responses.POST,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.update_firmware_for_bare_metal_server(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 204
+
+ def test_update_firmware_for_bare_metal_server_required_params_with_retries(self):
+ # Enable retries and run test_update_firmware_for_bare_metal_server_required_params.
+ _service.enable_retries()
+ self.test_update_firmware_for_bare_metal_server_required_params()
+
+ # Disable retries and run test_update_firmware_for_bare_metal_server_required_params.
+ _service.disable_retries()
+ self.test_update_firmware_for_bare_metal_server_required_params()
+
+ @responses.activate
+ def test_update_firmware_for_bare_metal_server_value_error(self):
+ """
+ test_update_firmware_for_bare_metal_server_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/bare_metal_servers/testString/firmware/update')
+ responses.add(
+ responses.POST,
url,
status=204,
)
@@ -5240,31 +5358,31 @@ def test_unset_subnet_public_gateway_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.unset_subnet_public_gateway(**req_copy)
+ _service.update_firmware_for_bare_metal_server(**req_copy)
- def test_unset_subnet_public_gateway_value_error_with_retries(self):
- # Enable retries and run test_unset_subnet_public_gateway_value_error.
+ def test_update_firmware_for_bare_metal_server_value_error_with_retries(self):
+ # Enable retries and run test_update_firmware_for_bare_metal_server_value_error.
_service.enable_retries()
- self.test_unset_subnet_public_gateway_value_error()
+ self.test_update_firmware_for_bare_metal_server_value_error()
- # Disable retries and run test_unset_subnet_public_gateway_value_error.
+ # Disable retries and run test_update_firmware_for_bare_metal_server_value_error.
_service.disable_retries()
- self.test_unset_subnet_public_gateway_value_error()
+ self.test_update_firmware_for_bare_metal_server_value_error()
-class TestGetSubnetPublicGateway:
+class TestGetBareMetalServerInitialization:
"""
- Test Class for get_subnet_public_gateway
+ Test Class for get_bare_metal_server_initialization
"""
@responses.activate
- def test_get_subnet_public_gateway_all_params(self):
+ def test_get_bare_metal_server_initialization_all_params(self):
"""
- get_subnet_public_gateway()
+ get_bare_metal_server_initialization()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/public_gateway')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString/initialization')
+ mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
responses.add(
responses.GET,
url,
@@ -5277,7 +5395,7 @@ def test_get_subnet_public_gateway_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_subnet_public_gateway(
+ response = _service.get_bare_metal_server_initialization(
id,
headers={},
)
@@ -5286,23 +5404,23 @@ def test_get_subnet_public_gateway_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_subnet_public_gateway_all_params_with_retries(self):
- # Enable retries and run test_get_subnet_public_gateway_all_params.
+ 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_subnet_public_gateway_all_params()
+ self.test_get_bare_metal_server_initialization_all_params()
- # Disable retries and run test_get_subnet_public_gateway_all_params.
+ # Disable retries and run test_get_bare_metal_server_initialization_all_params.
_service.disable_retries()
- self.test_get_subnet_public_gateway_all_params()
+ self.test_get_bare_metal_server_initialization_all_params()
@responses.activate
- def test_get_subnet_public_gateway_value_error(self):
+ def test_get_bare_metal_server_initialization_value_error(self):
"""
- test_get_subnet_public_gateway_value_error()
+ test_get_bare_metal_server_initialization_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/public_gateway')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString/initialization')
+ mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
responses.add(
responses.GET,
url,
@@ -5321,171 +5439,204 @@ def test_get_subnet_public_gateway_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_subnet_public_gateway(**req_copy)
+ _service.get_bare_metal_server_initialization(**req_copy)
- def test_get_subnet_public_gateway_value_error_with_retries(self):
- # Enable retries and run test_get_subnet_public_gateway_value_error.
+ 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_subnet_public_gateway_value_error()
+ self.test_get_bare_metal_server_initialization_value_error()
- # Disable retries and run test_get_subnet_public_gateway_value_error.
+ # Disable retries and run test_get_bare_metal_server_initialization_value_error.
_service.disable_retries()
- self.test_get_subnet_public_gateway_value_error()
+ self.test_get_bare_metal_server_initialization_value_error()
-class TestSetSubnetPublicGateway:
+class TestReplaceBareMetalServerInitialization:
"""
- Test Class for set_subnet_public_gateway
+ Test Class for replace_bare_metal_server_initialization
"""
@responses.activate
- def test_set_subnet_public_gateway_all_params(self):
+ def test_replace_bare_metal_server_initialization_all_params(self):
"""
- set_subnet_public_gateway()
+ replace_bare_metal_server_initialization()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/public_gateway')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString/initialization')
+ mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
responses.add(
responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
- public_gateway_identity_model = {}
- public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ # Construct a dict representation of a BareMetalServerInitializationDefaultTrustedProfilePrototype model
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {}
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
# Set up parameter values
id = 'testString'
- public_gateway_identity = public_gateway_identity_model
+ image = image_identity_model
+ keys = [key_identity_model]
+ default_trusted_profile = bare_metal_server_initialization_default_trusted_profile_prototype_model
+ user_data = 'testString'
# Invoke method
- response = _service.set_subnet_public_gateway(
+ response = _service.replace_bare_metal_server_initialization(
id,
- public_gateway_identity,
+ image,
+ keys,
+ default_trusted_profile=default_trusted_profile,
+ user_data=user_data,
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 == public_gateway_identity
+ assert req_body['image'] == image_identity_model
+ assert req_body['keys'] == [key_identity_model]
+ assert req_body['default_trusted_profile'] == bare_metal_server_initialization_default_trusted_profile_prototype_model
+ assert req_body['user_data'] == 'testString'
- def test_set_subnet_public_gateway_all_params_with_retries(self):
- # Enable retries and run test_set_subnet_public_gateway_all_params.
+ def test_replace_bare_metal_server_initialization_all_params_with_retries(self):
+ # Enable retries and run test_replace_bare_metal_server_initialization_all_params.
_service.enable_retries()
- self.test_set_subnet_public_gateway_all_params()
+ self.test_replace_bare_metal_server_initialization_all_params()
- # Disable retries and run test_set_subnet_public_gateway_all_params.
+ # Disable retries and run test_replace_bare_metal_server_initialization_all_params.
_service.disable_retries()
- self.test_set_subnet_public_gateway_all_params()
+ self.test_replace_bare_metal_server_initialization_all_params()
@responses.activate
- def test_set_subnet_public_gateway_value_error(self):
+ def test_replace_bare_metal_server_initialization_value_error(self):
"""
- test_set_subnet_public_gateway_value_error()
+ test_replace_bare_metal_server_initialization_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/public_gateway')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/bare_metal_servers/testString/initialization')
+ mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
responses.add(
responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
- public_gateway_identity_model = {}
- public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ # Construct a dict representation of a BareMetalServerInitializationDefaultTrustedProfilePrototype model
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {}
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
# Set up parameter values
id = 'testString'
- public_gateway_identity = public_gateway_identity_model
+ image = image_identity_model
+ keys = [key_identity_model]
+ default_trusted_profile = bare_metal_server_initialization_default_trusted_profile_prototype_model
+ user_data = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "public_gateway_identity": public_gateway_identity,
+ "image": image,
+ "keys": keys,
}
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.set_subnet_public_gateway(**req_copy)
+ _service.replace_bare_metal_server_initialization(**req_copy)
- def test_set_subnet_public_gateway_value_error_with_retries(self):
- # Enable retries and run test_set_subnet_public_gateway_value_error.
+ def test_replace_bare_metal_server_initialization_value_error_with_retries(self):
+ # Enable retries and run test_replace_bare_metal_server_initialization_value_error.
_service.enable_retries()
- self.test_set_subnet_public_gateway_value_error()
+ self.test_replace_bare_metal_server_initialization_value_error()
- # Disable retries and run test_set_subnet_public_gateway_value_error.
+ # Disable retries and run test_replace_bare_metal_server_initialization_value_error.
_service.disable_retries()
- self.test_set_subnet_public_gateway_value_error()
+ self.test_replace_bare_metal_server_initialization_value_error()
-class TestGetSubnetRoutingTable:
+class TestRestartBareMetalServer:
"""
- Test Class for get_subnet_routing_table
+ Test Class for restart_bare_metal_server
"""
@responses.activate
- def test_get_subnet_routing_table_all_params(self):
+ def test_restart_bare_metal_server_all_params(self):
"""
- get_subnet_routing_table()
+ restart_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/routing_table')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/restart')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
id = 'testString'
# Invoke method
- response = _service.get_subnet_routing_table(
+ response = _service.restart_bare_metal_server(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_subnet_routing_table_all_params_with_retries(self):
- # Enable retries and run test_get_subnet_routing_table_all_params.
+ 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_get_subnet_routing_table_all_params()
+ self.test_restart_bare_metal_server_all_params()
- # Disable retries and run test_get_subnet_routing_table_all_params.
+ # Disable retries and run test_restart_bare_metal_server_all_params.
_service.disable_retries()
- self.test_get_subnet_routing_table_all_params()
+ self.test_restart_bare_metal_server_all_params()
@responses.activate
- def test_get_subnet_routing_table_value_error(self):
+ def test_restart_bare_metal_server_value_error(self):
"""
- test_get_subnet_routing_table_value_error()
+ test_restart_bare_metal_server_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/routing_table')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/restart')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
@@ -5498,127 +5649,245 @@ def test_get_subnet_routing_table_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_subnet_routing_table(**req_copy)
+ _service.restart_bare_metal_server(**req_copy)
- def test_get_subnet_routing_table_value_error_with_retries(self):
- # Enable retries and run test_get_subnet_routing_table_value_error.
+ 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_get_subnet_routing_table_value_error()
+ self.test_restart_bare_metal_server_value_error()
- # Disable retries and run test_get_subnet_routing_table_value_error.
+ # Disable retries and run test_restart_bare_metal_server_value_error.
_service.disable_retries()
- self.test_get_subnet_routing_table_value_error()
+ self.test_restart_bare_metal_server_value_error()
-class TestReplaceSubnetRoutingTable:
+class TestStartBareMetalServer:
"""
- Test Class for replace_subnet_routing_table
+ Test Class for start_bare_metal_server
"""
@responses.activate
- def test_replace_subnet_routing_table_all_params(self):
+ def test_start_bare_metal_server_all_params(self):
"""
- replace_subnet_routing_table()
+ start_bare_metal_server()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/routing_table')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/start')
responses.add(
- responses.PUT,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=204,
)
- # Construct a dict representation of a RoutingTableIdentityByCRN model
- routing_table_identity_model = {}
- routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+ # 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'
- routing_table_identity = routing_table_identity_model
+
+ # 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.replace_subnet_routing_table(
+ response = _service.stop_bare_metal_server(
id,
- routing_table_identity,
+ type,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 201
+ assert response.status_code == 204
# Validate body params
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body == routing_table_identity
+ assert req_body['type'] == 'hard'
- def test_replace_subnet_routing_table_all_params_with_retries(self):
- # Enable retries and run test_replace_subnet_routing_table_all_params.
+ 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_replace_subnet_routing_table_all_params()
+ self.test_stop_bare_metal_server_all_params()
- # Disable retries and run test_replace_subnet_routing_table_all_params.
+ # Disable retries and run test_stop_bare_metal_server_all_params.
_service.disable_retries()
- self.test_replace_subnet_routing_table_all_params()
+ self.test_stop_bare_metal_server_all_params()
@responses.activate
- def test_replace_subnet_routing_table_value_error(self):
+ def test_stop_bare_metal_server_value_error(self):
"""
- test_replace_subnet_routing_table_value_error()
+ test_stop_bare_metal_server_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/routing_table')
- mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
+ url = preprocess_url('/bare_metal_servers/testString/stop')
responses.add(
- responses.PUT,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=204,
)
- # Construct a dict representation of a RoutingTableIdentityByCRN model
- routing_table_identity_model = {}
- routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
-
# Set up parameter values
id = 'testString'
- routing_table_identity = routing_table_identity_model
+ type = 'hard'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "routing_table_identity": routing_table_identity,
+ "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.replace_subnet_routing_table(**req_copy)
+ _service.stop_bare_metal_server(**req_copy)
- def test_replace_subnet_routing_table_value_error_with_retries(self):
- # Enable retries and run test_replace_subnet_routing_table_value_error.
+ 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_replace_subnet_routing_table_value_error()
+ self.test_stop_bare_metal_server_value_error()
- # Disable retries and run test_replace_subnet_routing_table_value_error.
+ # Disable retries and run test_stop_bare_metal_server_value_error.
_service.disable_retries()
- self.test_replace_subnet_routing_table_value_error()
+ self.test_stop_bare_metal_server_value_error()
-class TestListSubnetReservedIps:
+# endregion
+##############################################################################
+# End of Service: BareMetalServers
+##############################################################################
+
+##############################################################################
+# Start of Service: ClusterNetworks
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_subnet_reserved_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 TestListClusterNetworkProfiles:
+ """
+ Test Class for list_cluster_network_profiles
"""
@responses.activate
- def test_list_subnet_reserved_ips_all_params(self):
+ def test_list_cluster_network_profiles_all_params(self):
"""
- list_subnet_reserved_ips()
+ list_cluster_network_profiles()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}'
+ url = preprocess_url('/cluster_network/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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,
@@ -5628,25 +5897,13 @@ def test_list_subnet_reserved_ips_all_params(self):
)
# Set up parameter values
- subnet_id = 'testString'
start = 'testString'
limit = 50
- sort = 'name'
- target_id = 'testString'
- target_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
- target_name = 'my-resource'
- target_resource_type = 'testString'
# Invoke method
- response = _service.list_subnet_reserved_ips(
- subnet_id,
+ response = _service.list_cluster_network_profiles(
start=start,
limit=limit,
- sort=sort,
- target_id=target_id,
- target_crn=target_crn,
- target_name=target_name,
- target_resource_type=target_resource_type,
headers={},
)
@@ -5658,29 +5915,24 @@ def test_list_subnet_reserved_ips_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 'sort={}'.format(sort) in query_string
- assert 'target.id={}'.format(target_id) in query_string
- assert 'target.crn={}'.format(target_crn) in query_string
- assert 'target.name={}'.format(target_name) in query_string
- assert 'target.resource_type={}'.format(target_resource_type) in query_string
- def test_list_subnet_reserved_ips_all_params_with_retries(self):
- # Enable retries and run test_list_subnet_reserved_ips_all_params.
+ def test_list_cluster_network_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_profiles_all_params.
_service.enable_retries()
- self.test_list_subnet_reserved_ips_all_params()
+ self.test_list_cluster_network_profiles_all_params()
- # Disable retries and run test_list_subnet_reserved_ips_all_params.
+ # Disable retries and run test_list_cluster_network_profiles_all_params.
_service.disable_retries()
- self.test_list_subnet_reserved_ips_all_params()
+ self.test_list_cluster_network_profiles_all_params()
@responses.activate
- def test_list_subnet_reserved_ips_required_params(self):
+ def test_list_cluster_network_profiles_required_params(self):
"""
- test_list_subnet_reserved_ips_required_params()
+ test_list_cluster_network_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}'
+ url = preprocess_url('/cluster_network/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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,
@@ -5689,36 +5941,30 @@ def test_list_subnet_reserved_ips_required_params(self):
status=200,
)
- # Set up parameter values
- subnet_id = 'testString'
-
# Invoke method
- response = _service.list_subnet_reserved_ips(
- subnet_id,
- headers={},
- )
+ response = _service.list_cluster_network_profiles()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_subnet_reserved_ips_required_params_with_retries(self):
- # Enable retries and run test_list_subnet_reserved_ips_required_params.
+ def test_list_cluster_network_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_profiles_required_params.
_service.enable_retries()
- self.test_list_subnet_reserved_ips_required_params()
+ self.test_list_cluster_network_profiles_required_params()
- # Disable retries and run test_list_subnet_reserved_ips_required_params.
+ # Disable retries and run test_list_cluster_network_profiles_required_params.
_service.disable_retries()
- self.test_list_subnet_reserved_ips_required_params()
+ self.test_list_cluster_network_profiles_required_params()
@responses.activate
- def test_list_subnet_reserved_ips_value_error(self):
+ def test_list_cluster_network_profiles_value_error(self):
"""
- test_list_subnet_reserved_ips_value_error()
+ test_list_cluster_network_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}'
+ url = preprocess_url('/cluster_network/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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,
@@ -5727,36 +5973,32 @@ def test_list_subnet_reserved_ips_value_error(self):
status=200,
)
- # Set up parameter values
- subnet_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "subnet_id": subnet_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_subnet_reserved_ips(**req_copy)
+ _service.list_cluster_network_profiles(**req_copy)
- def test_list_subnet_reserved_ips_value_error_with_retries(self):
- # Enable retries and run test_list_subnet_reserved_ips_value_error.
+ def test_list_cluster_network_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_cluster_network_profiles_value_error.
_service.enable_retries()
- self.test_list_subnet_reserved_ips_value_error()
+ self.test_list_cluster_network_profiles_value_error()
- # Disable retries and run test_list_subnet_reserved_ips_value_error.
+ # Disable retries and run test_list_cluster_network_profiles_value_error.
_service.disable_retries()
- self.test_list_subnet_reserved_ips_value_error()
+ self.test_list_cluster_network_profiles_value_error()
@responses.activate
- def test_list_subnet_reserved_ips_with_pager_get_next(self):
+ def test_list_cluster_network_profiles_with_pager_get_next(self):
"""
- test_list_subnet_reserved_ips_with_pager_get_next()
+ test_list_cluster_network_profiles_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/subnets/testString/reserved_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/cluster_network/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"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,
@@ -5774,15 +6016,9 @@ def test_list_subnet_reserved_ips_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = SubnetReservedIpsPager(
+ pager = ClusterNetworkProfilesPager(
client=_service,
- subnet_id='testString',
limit=10,
- sort='name',
- target_id='testString',
- target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
- target_name='my-resource',
- target_resource_type='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -5791,14 +6027,14 @@ def test_list_subnet_reserved_ips_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_subnet_reserved_ips_with_pager_get_all(self):
+ def test_list_cluster_network_profiles_with_pager_get_all(self):
"""
- test_list_subnet_reserved_ips_with_pager_get_all()
+ test_list_cluster_network_profiles_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/subnets/testString/reserved_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/cluster_network/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"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,
@@ -5815,220 +6051,172 @@ def test_list_subnet_reserved_ips_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = SubnetReservedIpsPager(
+ pager = ClusterNetworkProfilesPager(
client=_service,
- subnet_id='testString',
limit=10,
- sort='name',
- target_id='testString',
- target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
- target_name='my-resource',
- target_resource_type='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateSubnetReservedIp:
+class TestGetClusterNetworkProfile:
"""
- Test Class for create_subnet_reserved_ip
+ Test Class for get_cluster_network_profile
"""
@responses.activate
- def test_create_subnet_reserved_ip_all_params(self):
+ def test_get_cluster_network_profile_all_params(self):
"""
- create_subnet_reserved_ip()
+ get_cluster_network_profile()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips')
- 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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/cluster_network/profiles/h100')
+ mock_response = '{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityById model
- reserved_ip_target_prototype_model = {}
- reserved_ip_target_prototype_model['id'] = 'r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0'
-
# Set up parameter values
- subnet_id = 'testString'
- address = '192.168.3.4'
- auto_delete = False
- name = 'my-reserved-ip'
- target = reserved_ip_target_prototype_model
+ name = 'h100'
# Invoke method
- response = _service.create_subnet_reserved_ip(
- subnet_id,
- address=address,
- auto_delete=auto_delete,
- name=name,
- target=target,
+ response = _service.get_cluster_network_profile(
+ name,
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['address'] == '192.168.3.4'
- assert req_body['auto_delete'] == False
- assert req_body['name'] == 'my-reserved-ip'
- assert req_body['target'] == reserved_ip_target_prototype_model
+ assert response.status_code == 200
- def test_create_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_create_subnet_reserved_ip_all_params.
+ def test_get_cluster_network_profile_all_params_with_retries(self):
+ # Enable retries and run test_get_cluster_network_profile_all_params.
_service.enable_retries()
- self.test_create_subnet_reserved_ip_all_params()
+ self.test_get_cluster_network_profile_all_params()
- # Disable retries and run test_create_subnet_reserved_ip_all_params.
+ # Disable retries and run test_get_cluster_network_profile_all_params.
_service.disable_retries()
- self.test_create_subnet_reserved_ip_all_params()
+ self.test_get_cluster_network_profile_all_params()
@responses.activate
- def test_create_subnet_reserved_ip_value_error(self):
+ def test_get_cluster_network_profile_value_error(self):
"""
- test_create_subnet_reserved_ip_value_error()
+ test_get_cluster_network_profile_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips')
- 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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/cluster_network/profiles/h100')
+ mock_response = '{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityById model
- reserved_ip_target_prototype_model = {}
- reserved_ip_target_prototype_model['id'] = 'r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0'
-
# Set up parameter values
- subnet_id = 'testString'
- address = '192.168.3.4'
- auto_delete = False
- name = 'my-reserved-ip'
- target = reserved_ip_target_prototype_model
+ name = 'h100'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "subnet_id": subnet_id,
+ "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.create_subnet_reserved_ip(**req_copy)
+ _service.get_cluster_network_profile(**req_copy)
- def test_create_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_create_subnet_reserved_ip_value_error.
+ def test_get_cluster_network_profile_value_error_with_retries(self):
+ # Enable retries and run test_get_cluster_network_profile_value_error.
_service.enable_retries()
- self.test_create_subnet_reserved_ip_value_error()
+ self.test_get_cluster_network_profile_value_error()
- # Disable retries and run test_create_subnet_reserved_ip_value_error.
+ # Disable retries and run test_get_cluster_network_profile_value_error.
_service.disable_retries()
- self.test_create_subnet_reserved_ip_value_error()
+ self.test_get_cluster_network_profile_value_error()
-class TestDeleteSubnetReservedIp:
+class TestListClusterNetworks:
"""
- Test Class for delete_subnet_reserved_ip
+ Test Class for list_cluster_networks
"""
@responses.activate
- def test_delete_subnet_reserved_ip_all_params(self):
+ def test_list_cluster_networks_all_params(self):
"""
- delete_subnet_reserved_ip()
+ list_cluster_networks()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips/testString')
+ url = preprocess_url('/cluster_networks')
+ mock_response = '{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- subnet_id = 'testString'
- id = 'testString'
+ start = 'testString'
+ limit = 50
+ resource_group_id = 'testString'
+ name = 'my-name'
+ sort = 'name'
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
# Invoke method
- response = _service.delete_subnet_reserved_ip(
- subnet_id,
- id,
+ response = _service.list_cluster_networks(
+ start=start,
+ limit=limit,
+ resource_group_id=resource_group_id,
+ name=name,
+ sort=sort,
+ vpc_id=vpc_id,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_delete_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_delete_subnet_reserved_ip_all_params.
- _service.enable_retries()
- self.test_delete_subnet_reserved_ip_all_params()
-
- # Disable retries and run test_delete_subnet_reserved_ip_all_params.
- _service.disable_retries()
- self.test_delete_subnet_reserved_ip_all_params()
-
- @responses.activate
- def test_delete_subnet_reserved_ip_value_error(self):
- """
- test_delete_subnet_reserved_ip_value_error()
- """
- # Set up mock
- url = preprocess_url('/subnets/testString/reserved_ips/testString')
- responses.add(
- responses.DELETE,
- url,
- status=204,
- )
-
- # Set up parameter values
- subnet_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "subnet_id": subnet_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_subnet_reserved_ip(**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 '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 '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_delete_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_delete_subnet_reserved_ip_value_error.
+ def test_list_cluster_networks_all_params_with_retries(self):
+ # Enable retries and run test_list_cluster_networks_all_params.
_service.enable_retries()
- self.test_delete_subnet_reserved_ip_value_error()
+ self.test_list_cluster_networks_all_params()
- # Disable retries and run test_delete_subnet_reserved_ip_value_error.
+ # Disable retries and run test_list_cluster_networks_all_params.
_service.disable_retries()
- self.test_delete_subnet_reserved_ip_value_error()
-
-
-class TestGetSubnetReservedIp:
- """
- Test Class for get_subnet_reserved_ip
- """
+ self.test_list_cluster_networks_all_params()
@responses.activate
- def test_get_subnet_reserved_ip_all_params(self):
+ def test_list_cluster_networks_required_params(self):
"""
- get_subnet_reserved_ip()
+ test_list_cluster_networks_required_params()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/cluster_networks')
+ mock_response = '{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -6037,38 +6225,30 @@ def test_get_subnet_reserved_ip_all_params(self):
status=200,
)
- # Set up parameter values
- subnet_id = 'testString'
- id = 'testString'
-
# Invoke method
- response = _service.get_subnet_reserved_ip(
- subnet_id,
- id,
- headers={},
- )
+ response = _service.list_cluster_networks()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_get_subnet_reserved_ip_all_params.
+ def test_list_cluster_networks_required_params_with_retries(self):
+ # Enable retries and run test_list_cluster_networks_required_params.
_service.enable_retries()
- self.test_get_subnet_reserved_ip_all_params()
+ self.test_list_cluster_networks_required_params()
- # Disable retries and run test_get_subnet_reserved_ip_all_params.
+ # Disable retries and run test_list_cluster_networks_required_params.
_service.disable_retries()
- self.test_get_subnet_reserved_ip_all_params()
+ self.test_list_cluster_networks_required_params()
@responses.activate
- def test_get_subnet_reserved_ip_value_error(self):
+ def test_list_cluster_networks_value_error(self):
"""
- test_get_subnet_reserved_ip_value_error()
+ test_list_cluster_networks_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/cluster_networks')
+ mock_response = '{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -6077,202 +6257,264 @@ def test_get_subnet_reserved_ip_value_error(self):
status=200,
)
- # Set up parameter values
- subnet_id = 'testString'
- id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "subnet_id": subnet_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_subnet_reserved_ip(**req_copy)
+ _service.list_cluster_networks(**req_copy)
- def test_get_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_get_subnet_reserved_ip_value_error.
+ def test_list_cluster_networks_value_error_with_retries(self):
+ # Enable retries and run test_list_cluster_networks_value_error.
_service.enable_retries()
- self.test_get_subnet_reserved_ip_value_error()
+ self.test_list_cluster_networks_value_error()
- # Disable retries and run test_get_subnet_reserved_ip_value_error.
+ # Disable retries and run test_list_cluster_networks_value_error.
_service.disable_retries()
- self.test_get_subnet_reserved_ip_value_error()
+ self.test_list_cluster_networks_value_error()
+
+ @responses.activate
+ def test_list_cluster_networks_with_pager_get_next(self):
+ """
+ test_list_cluster_networks_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/cluster_networks')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ mock_response2 = '{"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = ClusterNetworksPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ sort='name',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestUpdateSubnetReservedIp:
+ @responses.activate
+ def test_list_cluster_networks_with_pager_get_all(self):
+ """
+ test_list_cluster_networks_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/cluster_networks')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ mock_response2 = '{"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = ClusterNetworksPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ sort='name',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateClusterNetwork:
"""
- Test Class for update_subnet_reserved_ip
+ Test Class for create_cluster_network
"""
@responses.activate
- def test_update_subnet_reserved_ip_all_params(self):
+ def test_create_cluster_network_all_params(self):
"""
- update_subnet_reserved_ip()
+ create_cluster_network()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/cluster_networks')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ReservedIPPatch model
- reserved_ip_patch_model = {}
- reserved_ip_patch_model['auto_delete'] = False
- reserved_ip_patch_model['name'] = 'my-reserved-ip-updated'
+ # Construct a dict representation of a ClusterNetworkProfileIdentityByName model
+ cluster_network_profile_identity_model = {}
+ cluster_network_profile_identity_model['name'] = 'h100'
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Construct a dict representation of a ClusterNetworkSubnetPrefixPrototype model
+ cluster_network_subnet_prefix_prototype_model = {}
+ cluster_network_subnet_prefix_prototype_model['cidr'] = '10.0.0.0/24'
# Set up parameter values
- subnet_id = 'testString'
- id = 'testString'
- reserved_ip_patch = reserved_ip_patch_model
+ profile = cluster_network_profile_identity_model
+ vpc = vpc_identity_model
+ zone = zone_identity_model
+ name = 'my-cluster-network'
+ resource_group = resource_group_identity_model
+ subnet_prefixes = [cluster_network_subnet_prefix_prototype_model]
# Invoke method
- response = _service.update_subnet_reserved_ip(
- subnet_id,
- id,
- reserved_ip_patch,
+ response = _service.create_cluster_network(
+ profile,
+ vpc,
+ zone,
+ name=name,
+ resource_group=resource_group,
+ subnet_prefixes=subnet_prefixes,
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 == reserved_ip_patch
+ assert req_body['profile'] == cluster_network_profile_identity_model
+ assert req_body['vpc'] == vpc_identity_model
+ assert req_body['zone'] == zone_identity_model
+ assert req_body['name'] == 'my-cluster-network'
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['subnet_prefixes'] == [cluster_network_subnet_prefix_prototype_model]
- def test_update_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_update_subnet_reserved_ip_all_params.
+ def test_create_cluster_network_all_params_with_retries(self):
+ # Enable retries and run test_create_cluster_network_all_params.
_service.enable_retries()
- self.test_update_subnet_reserved_ip_all_params()
+ self.test_create_cluster_network_all_params()
- # Disable retries and run test_update_subnet_reserved_ip_all_params.
+ # Disable retries and run test_create_cluster_network_all_params.
_service.disable_retries()
- self.test_update_subnet_reserved_ip_all_params()
+ self.test_create_cluster_network_all_params()
@responses.activate
- def test_update_subnet_reserved_ip_value_error(self):
+ def test_create_cluster_network_value_error(self):
"""
- test_update_subnet_reserved_ip_value_error()
+ test_create_cluster_network_value_error()
"""
# Set up mock
- url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/cluster_networks')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ReservedIPPatch model
- reserved_ip_patch_model = {}
- reserved_ip_patch_model['auto_delete'] = False
- reserved_ip_patch_model['name'] = 'my-reserved-ip-updated'
+ # Construct a dict representation of a ClusterNetworkProfileIdentityByName model
+ cluster_network_profile_identity_model = {}
+ cluster_network_profile_identity_model['name'] = 'h100'
- # Set up parameter values
- subnet_id = 'testString'
- id = 'testString'
- reserved_ip_patch = reserved_ip_patch_model
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "subnet_id": subnet_id,
- "id": id,
- "reserved_ip_patch": reserved_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_subnet_reserved_ip(**req_copy)
-
- def test_update_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_update_subnet_reserved_ip_value_error.
- _service.enable_retries()
- self.test_update_subnet_reserved_ip_value_error()
-
- # Disable retries and run test_update_subnet_reserved_ip_value_error.
- _service.disable_retries()
- self.test_update_subnet_reserved_ip_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: Subnets
-##############################################################################
-
-##############################################################################
-# Start of Service: Images
-##############################################################################
-# region
-
-
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- def test_new_instance(self):
- """
- new_instance()
- """
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
- )
+ # Construct a dict representation of a ClusterNetworkSubnetPrefixPrototype model
+ cluster_network_subnet_prefix_prototype_model = {}
+ cluster_network_subnet_prefix_prototype_model['cidr'] = '10.0.0.0/24'
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Set up parameter values
+ profile = cluster_network_profile_identity_model
+ vpc = vpc_identity_model
+ zone = zone_identity_model
+ name = 'my-cluster-network'
+ resource_group = resource_group_identity_model
+ subnet_prefixes = [cluster_network_subnet_prefix_prototype_model]
- 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',
- )
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "profile": profile,
+ "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_cluster_network(**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_create_cluster_network_value_error_with_retries(self):
+ # Enable retries and run test_create_cluster_network_value_error.
+ _service.enable_retries()
+ self.test_create_cluster_network_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,
- )
+ # Disable retries and run test_create_cluster_network_value_error.
+ _service.disable_retries()
+ self.test_create_cluster_network_value_error()
-class TestListImages:
+class TestListClusterNetworkInterfaces:
"""
- Test Class for list_images
+ Test Class for list_cluster_network_interfaces
"""
@responses.activate
- def test_list_images_all_params(self):
+ def test_list_cluster_network_interfaces_all_params(self):
"""
- list_images()
+ list_cluster_network_interfaces()
"""
# Set up mock
- url = preprocess_url('/images')
- mock_response = '{"first": {"href": "href"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response = '{"first": {"href": "href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -6282,25 +6524,19 @@ def test_list_images_all_params(self):
)
# Set up parameter values
+ cluster_network_id = 'testString'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
name = 'my-name'
- status = ['available']
- visibility = 'private'
- user_data_format = ['cloud_init']
- remote_account_id = 'bb1b52262f7441a586f49068482f1e60'
+ sort = 'name'
# Invoke method
- response = _service.list_images(
+ response = _service.list_cluster_network_interfaces(
+ cluster_network_id,
start=start,
limit=limit,
- resource_group_id=resource_group_id,
name=name,
- status=status,
- visibility=visibility,
- user_data_format=user_data_format,
- remote_account_id=remote_account_id,
+ sort=sort,
headers={},
)
@@ -6312,30 +6548,26 @@ def test_list_images_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 'status={}'.format(','.join(status)) in query_string
- assert 'visibility={}'.format(visibility) in query_string
- assert 'user_data_format={}'.format(','.join(user_data_format)) in query_string
- assert 'remote.account.id={}'.format(remote_account_id) in query_string
+ assert 'sort={}'.format(sort) in query_string
- def test_list_images_all_params_with_retries(self):
- # Enable retries and run test_list_images_all_params.
+ def test_list_cluster_network_interfaces_all_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_interfaces_all_params.
_service.enable_retries()
- self.test_list_images_all_params()
+ self.test_list_cluster_network_interfaces_all_params()
- # Disable retries and run test_list_images_all_params.
+ # Disable retries and run test_list_cluster_network_interfaces_all_params.
_service.disable_retries()
- self.test_list_images_all_params()
+ self.test_list_cluster_network_interfaces_all_params()
@responses.activate
- def test_list_images_required_params(self):
+ def test_list_cluster_network_interfaces_required_params(self):
"""
- test_list_images_required_params()
+ test_list_cluster_network_interfaces_required_params()
"""
# Set up mock
- url = preprocess_url('/images')
- mock_response = '{"first": {"href": "href"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response = '{"first": {"href": "href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -6344,30 +6576,36 @@ def test_list_images_required_params(self):
status=200,
)
+ # Set up parameter values
+ cluster_network_id = 'testString'
+
# Invoke method
- response = _service.list_images()
+ response = _service.list_cluster_network_interfaces(
+ cluster_network_id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_images_required_params_with_retries(self):
- # Enable retries and run test_list_images_required_params.
+ def test_list_cluster_network_interfaces_required_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_interfaces_required_params.
_service.enable_retries()
- self.test_list_images_required_params()
+ self.test_list_cluster_network_interfaces_required_params()
- # Disable retries and run test_list_images_required_params.
+ # Disable retries and run test_list_cluster_network_interfaces_required_params.
_service.disable_retries()
- self.test_list_images_required_params()
+ self.test_list_cluster_network_interfaces_required_params()
@responses.activate
- def test_list_images_value_error(self):
+ def test_list_cluster_network_interfaces_value_error(self):
"""
- test_list_images_value_error()
+ test_list_cluster_network_interfaces_value_error()
"""
# Set up mock
- url = preprocess_url('/images')
- mock_response = '{"first": {"href": "href"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response = '{"first": {"href": "href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -6376,32 +6614,36 @@ def test_list_images_value_error(self):
status=200,
)
+ # Set up parameter values
+ cluster_network_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_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_images(**req_copy)
+ _service.list_cluster_network_interfaces(**req_copy)
- def test_list_images_value_error_with_retries(self):
- # Enable retries and run test_list_images_value_error.
+ def test_list_cluster_network_interfaces_value_error_with_retries(self):
+ # Enable retries and run test_list_cluster_network_interfaces_value_error.
_service.enable_retries()
- self.test_list_images_value_error()
+ self.test_list_cluster_network_interfaces_value_error()
- # Disable retries and run test_list_images_value_error.
+ # Disable retries and run test_list_cluster_network_interfaces_value_error.
_service.disable_retries()
- self.test_list_images_value_error()
+ self.test_list_cluster_network_interfaces_value_error()
@responses.activate
- def test_list_images_with_pager_get_next(self):
+ def test_list_cluster_network_interfaces_with_pager_get_next(self):
"""
- test_list_images_with_pager_get_next()
+ test_list_cluster_network_interfaces_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/images')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
- mock_response2 = '{"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ mock_response2 = '{"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -6419,15 +6661,12 @@ def test_list_images_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = ImagesPager(
+ pager = ClusterNetworkInterfacesPager(
client=_service,
+ cluster_network_id='testString',
limit=10,
- resource_group_id='testString',
name='my-name',
- status=['available'],
- visibility='private',
- user_data_format=['cloud_init'],
- remote_account_id='bb1b52262f7441a586f49068482f1e60',
+ sort='name',
)
while pager.has_next():
next_page = pager.get_next()
@@ -6436,14 +6675,14 @@ def test_list_images_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_images_with_pager_get_all(self):
+ def test_list_cluster_network_interfaces_with_pager_get_all(self):
"""
- test_list_images_with_pager_get_all()
+ test_list_cluster_network_interfaces_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/images')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
- mock_response2 = '{"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ mock_response2 = '{"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -6460,34 +6699,31 @@ def test_list_images_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = ImagesPager(
+ pager = ClusterNetworkInterfacesPager(
client=_service,
+ cluster_network_id='testString',
limit=10,
- resource_group_id='testString',
name='my-name',
- status=['available'],
- visibility='private',
- user_data_format=['cloud_init'],
- remote_account_id='bb1b52262f7441a586f49068482f1e60',
+ sort='name',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateImage:
+class TestCreateClusterNetworkInterface:
"""
- Test Class for create_image
+ Test Class for create_cluster_network_interface
"""
@responses.activate
- def test_create_image_all_params(self):
+ def test_create_cluster_network_interface_all_params(self):
"""
- create_image()
+ create_cluster_network_interface()
"""
# Set up mock
- url = preprocess_url('/images')
- mock_response = '{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -6496,39 +6732,28 @@ def test_create_image_all_params(self):
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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a ImageFilePrototype model
- image_file_prototype_model = {}
- image_file_prototype_model['href'] = 'cos://us-south/my-bucket/my-image.qcow2'
-
- # Construct a dict representation of a OperatingSystemIdentityByName model
- operating_system_identity_model = {}
- operating_system_identity_model['name'] = 'debian-9-amd64'
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
- # Construct a dict representation of a ImagePrototypeImageByFile model
- image_prototype_model = {}
- image_prototype_model['deprecation_at'] = '2019-01-01T12:00:00Z'
- image_prototype_model['name'] = 'my-image'
- image_prototype_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
- image_prototype_model['resource_group'] = resource_group_identity_model
- image_prototype_model['encrypted_data_key'] = 'testString'
- image_prototype_model['encryption_key'] = encryption_key_identity_model
- image_prototype_model['file'] = image_file_prototype_model
- image_prototype_model['operating_system'] = operating_system_identity_model
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
# Set up parameter values
- image_prototype = image_prototype_model
+ cluster_network_id = 'testString'
+ name = 'my-cluster-network-interface'
+ primary_ip = cluster_network_interface_primary_ip_prototype_model
+ subnet = cluster_network_subnet_identity_model
# Invoke method
- response = _service.create_image(
- image_prototype,
+ response = _service.create_cluster_network_interface(
+ cluster_network_id,
+ name=name,
+ primary_ip=primary_ip,
+ subnet=subnet,
headers={},
)
@@ -6537,25 +6762,27 @@ def test_create_image_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 == image_prototype
+ assert req_body['name'] == 'my-cluster-network-interface'
+ assert req_body['primary_ip'] == cluster_network_interface_primary_ip_prototype_model
+ assert req_body['subnet'] == cluster_network_subnet_identity_model
- def test_create_image_all_params_with_retries(self):
- # Enable retries and run test_create_image_all_params.
+ def test_create_cluster_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_create_cluster_network_interface_all_params.
_service.enable_retries()
- self.test_create_image_all_params()
+ self.test_create_cluster_network_interface_all_params()
- # Disable retries and run test_create_image_all_params.
+ # Disable retries and run test_create_cluster_network_interface_all_params.
_service.disable_retries()
- self.test_create_image_all_params()
+ self.test_create_cluster_network_interface_all_params()
@responses.activate
- def test_create_image_value_error(self):
+ def test_create_cluster_network_interface_value_error(self):
"""
- test_create_image_value_error()
+ test_create_cluster_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/images')
- mock_response = '{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
+ url = preprocess_url('/cluster_networks/testString/interfaces')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -6564,79 +6791,72 @@ def test_create_image_value_error(self):
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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a ImageFilePrototype model
- image_file_prototype_model = {}
- image_file_prototype_model['href'] = 'cos://us-south/my-bucket/my-image.qcow2'
-
- # Construct a dict representation of a OperatingSystemIdentityByName model
- operating_system_identity_model = {}
- operating_system_identity_model['name'] = 'debian-9-amd64'
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
- # Construct a dict representation of a ImagePrototypeImageByFile model
- image_prototype_model = {}
- image_prototype_model['deprecation_at'] = '2019-01-01T12:00:00Z'
- image_prototype_model['name'] = 'my-image'
- image_prototype_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
- image_prototype_model['resource_group'] = resource_group_identity_model
- image_prototype_model['encrypted_data_key'] = 'testString'
- image_prototype_model['encryption_key'] = encryption_key_identity_model
- image_prototype_model['file'] = image_file_prototype_model
- image_prototype_model['operating_system'] = operating_system_identity_model
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
# Set up parameter values
- image_prototype = image_prototype_model
+ cluster_network_id = 'testString'
+ name = 'my-cluster-network-interface'
+ primary_ip = cluster_network_interface_primary_ip_prototype_model
+ subnet = cluster_network_subnet_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "image_prototype": image_prototype,
+ "cluster_network_id": cluster_network_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_image(**req_copy)
+ _service.create_cluster_network_interface(**req_copy)
- def test_create_image_value_error_with_retries(self):
- # Enable retries and run test_create_image_value_error.
+ def test_create_cluster_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_create_cluster_network_interface_value_error.
_service.enable_retries()
- self.test_create_image_value_error()
+ self.test_create_cluster_network_interface_value_error()
- # Disable retries and run test_create_image_value_error.
+ # Disable retries and run test_create_cluster_network_interface_value_error.
_service.disable_retries()
- self.test_create_image_value_error()
+ self.test_create_cluster_network_interface_value_error()
-class TestDeleteImage:
+class TestDeleteClusterNetworkInterface:
"""
- Test Class for delete_image
+ Test Class for delete_cluster_network_interface
"""
@responses.activate
- def test_delete_image_all_params(self):
+ def test_delete_cluster_network_interface_all_params(self):
"""
- delete_image()
+ delete_cluster_network_interface()
"""
# Set up mock
- url = preprocess_url('/images/testString')
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
url,
+ body=mock_response,
+ content_type='application/json',
status=202,
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.delete_image(
+ response = _service.delete_cluster_network_interface(
+ cluster_network_id,
id,
+ if_match=if_match,
headers={},
)
@@ -6644,63 +6864,108 @@ def test_delete_image_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 202
- def test_delete_image_all_params_with_retries(self):
- # Enable retries and run test_delete_image_all_params.
+ def test_delete_cluster_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_interface_all_params.
_service.enable_retries()
- self.test_delete_image_all_params()
+ self.test_delete_cluster_network_interface_all_params()
- # Disable retries and run test_delete_image_all_params.
+ # Disable retries and run test_delete_cluster_network_interface_all_params.
_service.disable_retries()
- self.test_delete_image_all_params()
+ self.test_delete_cluster_network_interface_all_params()
@responses.activate
- def test_delete_image_value_error(self):
+ def test_delete_cluster_network_interface_required_params(self):
"""
- test_delete_image_value_error()
+ test_delete_cluster_network_interface_required_params()
"""
# Set up mock
- url = preprocess_url('/images/testString')
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
+ )
+
+ # Set up parameter values
+ cluster_network_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_cluster_network_interface(
+ cluster_network_id,
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_cluster_network_interface_required_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_interface_required_params.
+ _service.enable_retries()
+ self.test_delete_cluster_network_interface_required_params()
+
+ # Disable retries and run test_delete_cluster_network_interface_required_params.
+ _service.disable_retries()
+ self.test_delete_cluster_network_interface_required_params()
+
+ @responses.activate
+ def test_delete_cluster_network_interface_value_error(self):
+ """
+ test_delete_cluster_network_interface_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
url,
+ body=mock_response,
+ content_type='application/json',
status=202,
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_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_image(**req_copy)
+ _service.delete_cluster_network_interface(**req_copy)
- def test_delete_image_value_error_with_retries(self):
- # Enable retries and run test_delete_image_value_error.
+ def test_delete_cluster_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_interface_value_error.
_service.enable_retries()
- self.test_delete_image_value_error()
+ self.test_delete_cluster_network_interface_value_error()
- # Disable retries and run test_delete_image_value_error.
+ # Disable retries and run test_delete_cluster_network_interface_value_error.
_service.disable_retries()
- self.test_delete_image_value_error()
+ self.test_delete_cluster_network_interface_value_error()
-class TestGetImage:
+class TestGetClusterNetworkInterface:
"""
- Test Class for get_image
+ Test Class for get_cluster_network_interface
"""
@responses.activate
- def test_get_image_all_params(self):
+ def test_get_cluster_network_interface_all_params(self):
"""
- get_image()
+ get_cluster_network_interface()
"""
# Set up mock
- url = preprocess_url('/images/testString')
- mock_response = '{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -6710,10 +6975,12 @@ def test_get_image_all_params(self):
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_image(
+ response = _service.get_cluster_network_interface(
+ cluster_network_id,
id,
headers={},
)
@@ -6722,23 +6989,23 @@ def test_get_image_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_image_all_params_with_retries(self):
- # Enable retries and run test_get_image_all_params.
+ def test_get_cluster_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_get_cluster_network_interface_all_params.
_service.enable_retries()
- self.test_get_image_all_params()
+ self.test_get_cluster_network_interface_all_params()
- # Disable retries and run test_get_image_all_params.
+ # Disable retries and run test_get_cluster_network_interface_all_params.
_service.disable_retries()
- self.test_get_image_all_params()
+ self.test_get_cluster_network_interface_all_params()
@responses.activate
- def test_get_image_value_error(self):
+ def test_get_cluster_network_interface_value_error(self):
"""
- test_get_image_value_error()
+ test_get_cluster_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/images/testString')
- mock_response = '{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -6748,40 +7015,42 @@ def test_get_image_value_error(self):
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_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_image(**req_copy)
+ _service.get_cluster_network_interface(**req_copy)
- def test_get_image_value_error_with_retries(self):
- # Enable retries and run test_get_image_value_error.
+ def test_get_cluster_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_get_cluster_network_interface_value_error.
_service.enable_retries()
- self.test_get_image_value_error()
+ self.test_get_cluster_network_interface_value_error()
- # Disable retries and run test_get_image_value_error.
+ # Disable retries and run test_get_cluster_network_interface_value_error.
_service.disable_retries()
- self.test_get_image_value_error()
+ self.test_get_cluster_network_interface_value_error()
-class TestUpdateImage:
+class TestUpdateClusterNetworkInterface:
"""
- Test Class for update_image
+ Test Class for update_cluster_network_interface
"""
@responses.activate
- def test_update_image_all_params(self):
+ def test_update_cluster_network_interface_all_params(self):
"""
- update_image()
+ update_cluster_network_interface()
"""
# Set up mock
- url = preprocess_url('/images/testString')
- mock_response = '{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -6790,20 +7059,23 @@ def test_update_image_all_params(self):
status=200,
)
- # Construct a dict representation of a ImagePatch model
- image_patch_model = {}
- image_patch_model['deprecation_at'] = '2019-01-01T12:00:00Z'
- image_patch_model['name'] = 'my-image'
- image_patch_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
+ # Construct a dict representation of a ClusterNetworkInterfacePatch model
+ cluster_network_interface_patch_model = {}
+ cluster_network_interface_patch_model['auto_delete'] = False
+ cluster_network_interface_patch_model['name'] = 'my-cluster-network-interface'
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
- image_patch = image_patch_model
+ cluster_network_interface_patch = cluster_network_interface_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_image(
+ response = _service.update_cluster_network_interface(
+ cluster_network_id,
id,
- image_patch,
+ cluster_network_interface_patch,
+ if_match=if_match,
headers={},
)
@@ -6812,25 +7084,25 @@ def test_update_image_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 == image_patch
+ assert req_body == cluster_network_interface_patch
- def test_update_image_all_params_with_retries(self):
- # Enable retries and run test_update_image_all_params.
+ def test_update_cluster_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_interface_all_params.
_service.enable_retries()
- self.test_update_image_all_params()
+ self.test_update_cluster_network_interface_all_params()
- # Disable retries and run test_update_image_all_params.
+ # Disable retries and run test_update_cluster_network_interface_all_params.
_service.disable_retries()
- self.test_update_image_all_params()
+ self.test_update_cluster_network_interface_all_params()
@responses.activate
- def test_update_image_value_error(self):
+ def test_update_cluster_network_interface_required_params(self):
"""
- test_update_image_value_error()
+ test_update_cluster_network_interface_required_params()
"""
# Set up mock
- url = preprocess_url('/images/testString')
- mock_response = '{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -6839,199 +7111,100 @@ def test_update_image_value_error(self):
status=200,
)
- # Construct a dict representation of a ImagePatch model
- image_patch_model = {}
- image_patch_model['deprecation_at'] = '2019-01-01T12:00:00Z'
- image_patch_model['name'] = 'my-image'
- image_patch_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
-
- # Set up parameter values
- id = 'testString'
- image_patch = image_patch_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "image_patch": image_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_image(**req_copy)
-
- def test_update_image_value_error_with_retries(self):
- # Enable retries and run test_update_image_value_error.
- _service.enable_retries()
- self.test_update_image_value_error()
-
- # Disable retries and run test_update_image_value_error.
- _service.disable_retries()
- self.test_update_image_value_error()
-
-
-class TestDeprecateImage:
- """
- Test Class for deprecate_image
- """
-
- @responses.activate
- def test_deprecate_image_all_params(self):
- """
- deprecate_image()
- """
- # Set up mock
- url = preprocess_url('/images/testString/deprecate')
- responses.add(
- responses.POST,
- url,
- status=204,
- )
+ # Construct a dict representation of a ClusterNetworkInterfacePatch model
+ cluster_network_interface_patch_model = {}
+ cluster_network_interface_patch_model['auto_delete'] = False
+ cluster_network_interface_patch_model['name'] = 'my-cluster-network-interface'
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
+ cluster_network_interface_patch = cluster_network_interface_patch_model
# Invoke method
- response = _service.deprecate_image(
+ response = _service.update_cluster_network_interface(
+ cluster_network_id,
id,
+ cluster_network_interface_patch,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_deprecate_image_all_params_with_retries(self):
- # Enable retries and run test_deprecate_image_all_params.
- _service.enable_retries()
- self.test_deprecate_image_all_params()
-
- # Disable retries and run test_deprecate_image_all_params.
- _service.disable_retries()
- self.test_deprecate_image_all_params()
-
- @responses.activate
- def test_deprecate_image_value_error(self):
- """
- test_deprecate_image_value_error()
- """
- # Set up mock
- url = preprocess_url('/images/testString/deprecate')
- 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.deprecate_image(**req_copy)
+ assert response.status_code == 200
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body == cluster_network_interface_patch
- def test_deprecate_image_value_error_with_retries(self):
- # Enable retries and run test_deprecate_image_value_error.
+ def test_update_cluster_network_interface_required_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_interface_required_params.
_service.enable_retries()
- self.test_deprecate_image_value_error()
+ self.test_update_cluster_network_interface_required_params()
- # Disable retries and run test_deprecate_image_value_error.
+ # Disable retries and run test_update_cluster_network_interface_required_params.
_service.disable_retries()
- self.test_deprecate_image_value_error()
-
-
-class TestObsoleteImage:
- """
- Test Class for obsolete_image
- """
+ self.test_update_cluster_network_interface_required_params()
@responses.activate
- def test_obsolete_image_all_params(self):
+ def test_update_cluster_network_interface_value_error(self):
"""
- obsolete_image()
+ test_update_cluster_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/images/testString/obsolete')
+ url = preprocess_url('/cluster_networks/testString/interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
- status=204,
- )
-
- # Set up parameter values
- id = 'testString'
-
- # Invoke method
- response = _service.obsolete_image(
- id,
- headers={},
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_obsolete_image_all_params_with_retries(self):
- # Enable retries and run test_obsolete_image_all_params.
- _service.enable_retries()
- self.test_obsolete_image_all_params()
-
- # Disable retries and run test_obsolete_image_all_params.
- _service.disable_retries()
- self.test_obsolete_image_all_params()
-
- @responses.activate
- def test_obsolete_image_value_error(self):
- """
- test_obsolete_image_value_error()
- """
- # Set up mock
- url = preprocess_url('/images/testString/obsolete')
- responses.add(
- responses.POST,
- url,
- status=204,
- )
+ # Construct a dict representation of a ClusterNetworkInterfacePatch model
+ cluster_network_interface_patch_model = {}
+ cluster_network_interface_patch_model['auto_delete'] = False
+ cluster_network_interface_patch_model['name'] = 'my-cluster-network-interface'
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
+ cluster_network_interface_patch = cluster_network_interface_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_id,
"id": id,
+ "cluster_network_interface_patch": cluster_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.obsolete_image(**req_copy)
+ _service.update_cluster_network_interface(**req_copy)
- def test_obsolete_image_value_error_with_retries(self):
- # Enable retries and run test_obsolete_image_value_error.
+ def test_update_cluster_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_update_cluster_network_interface_value_error.
_service.enable_retries()
- self.test_obsolete_image_value_error()
+ self.test_update_cluster_network_interface_value_error()
- # Disable retries and run test_obsolete_image_value_error.
+ # Disable retries and run test_update_cluster_network_interface_value_error.
_service.disable_retries()
- self.test_obsolete_image_value_error()
+ self.test_update_cluster_network_interface_value_error()
-class TestListImageExportJobs:
+class TestListClusterNetworkSubnets:
"""
- Test Class for list_image_export_jobs
+ Test Class for list_cluster_network_subnets
"""
@responses.activate
- def test_list_image_export_jobs_all_params(self):
+ def test_list_cluster_network_subnets_all_params(self):
"""
- list_image_export_jobs()
+ list_cluster_network_subnets()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs')
- mock_response = '{"export_jobs": [{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}]}'
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -7041,13 +7214,19 @@ def test_list_image_export_jobs_all_params(self):
)
# Set up parameter values
- image_id = 'testString'
+ cluster_network_id = 'testString'
+ start = 'testString'
+ limit = 50
name = 'my-name'
+ sort = 'name'
# Invoke method
- response = _service.list_image_export_jobs(
- image_id,
+ response = _service.list_cluster_network_subnets(
+ cluster_network_id,
+ start=start,
+ limit=limit,
name=name,
+ sort=sort,
headers={},
)
@@ -7057,25 +7236,28 @@ def test_list_image_export_jobs_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 'name={}'.format(name) in query_string
+ assert 'sort={}'.format(sort) in query_string
- def test_list_image_export_jobs_all_params_with_retries(self):
- # Enable retries and run test_list_image_export_jobs_all_params.
+ def test_list_cluster_network_subnets_all_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_subnets_all_params.
_service.enable_retries()
- self.test_list_image_export_jobs_all_params()
+ self.test_list_cluster_network_subnets_all_params()
- # Disable retries and run test_list_image_export_jobs_all_params.
+ # Disable retries and run test_list_cluster_network_subnets_all_params.
_service.disable_retries()
- self.test_list_image_export_jobs_all_params()
+ self.test_list_cluster_network_subnets_all_params()
@responses.activate
- def test_list_image_export_jobs_required_params(self):
+ def test_list_cluster_network_subnets_required_params(self):
"""
- test_list_image_export_jobs_required_params()
+ test_list_cluster_network_subnets_required_params()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs')
- mock_response = '{"export_jobs": [{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}]}'
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -7085,11 +7267,11 @@ def test_list_image_export_jobs_required_params(self):
)
# Set up parameter values
- image_id = 'testString'
+ cluster_network_id = 'testString'
# Invoke method
- response = _service.list_image_export_jobs(
- image_id,
+ response = _service.list_cluster_network_subnets(
+ cluster_network_id,
headers={},
)
@@ -7097,23 +7279,23 @@ def test_list_image_export_jobs_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_image_export_jobs_required_params_with_retries(self):
- # Enable retries and run test_list_image_export_jobs_required_params.
+ def test_list_cluster_network_subnets_required_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_subnets_required_params.
_service.enable_retries()
- self.test_list_image_export_jobs_required_params()
+ self.test_list_cluster_network_subnets_required_params()
- # Disable retries and run test_list_image_export_jobs_required_params.
+ # Disable retries and run test_list_cluster_network_subnets_required_params.
_service.disable_retries()
- self.test_list_image_export_jobs_required_params()
+ self.test_list_cluster_network_subnets_required_params()
@responses.activate
- def test_list_image_export_jobs_value_error(self):
+ def test_list_cluster_network_subnets_value_error(self):
"""
- test_list_image_export_jobs_value_error()
+ test_list_cluster_network_subnets_value_error()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs')
- mock_response = '{"export_jobs": [{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}]}'
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -7123,40 +7305,115 @@ def test_list_image_export_jobs_value_error(self):
)
# Set up parameter values
- image_id = 'testString'
+ cluster_network_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "image_id": image_id,
+ "cluster_network_id": cluster_network_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_image_export_jobs(**req_copy)
+ _service.list_cluster_network_subnets(**req_copy)
- def test_list_image_export_jobs_value_error_with_retries(self):
- # Enable retries and run test_list_image_export_jobs_value_error.
+ def test_list_cluster_network_subnets_value_error_with_retries(self):
+ # Enable retries and run test_list_cluster_network_subnets_value_error.
_service.enable_retries()
- self.test_list_image_export_jobs_value_error()
+ self.test_list_cluster_network_subnets_value_error()
- # Disable retries and run test_list_image_export_jobs_value_error.
+ # Disable retries and run test_list_cluster_network_subnets_value_error.
_service.disable_retries()
- self.test_list_image_export_jobs_value_error()
+ self.test_list_cluster_network_subnets_value_error()
+ @responses.activate
+ def test_list_cluster_network_subnets_with_pager_get_next(self):
+ """
+ test_list_cluster_network_subnets_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestCreateImageExportJob:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = ClusterNetworkSubnetsPager(
+ client=_service,
+ cluster_network_id='testString',
+ limit=10,
+ name='my-name',
+ sort='name',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_cluster_network_subnets_with_pager_get_all(self):
+ """
+ test_list_cluster_network_subnets_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = ClusterNetworkSubnetsPager(
+ client=_service,
+ cluster_network_id='testString',
+ limit=10,
+ name='my-name',
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateClusterNetworkSubnet:
"""
- Test Class for create_image_export_job
+ Test Class for create_cluster_network_subnet
"""
@responses.activate
- def test_create_image_export_job_all_params(self):
+ def test_create_cluster_network_subnet_all_params(self):
"""
- create_image_export_job()
+ create_cluster_network_subnet()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.POST,
url,
@@ -7165,22 +7422,20 @@ def test_create_image_export_job_all_params(self):
status=201,
)
- # Construct a dict representation of a CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
- cloud_object_storage_bucket_identity_model = {}
- cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+ # Construct a dict representation of a ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model
+ cluster_network_subnet_prototype_model = {}
+ cluster_network_subnet_prototype_model['ip_version'] = 'ipv4'
+ cluster_network_subnet_prototype_model['name'] = 'my-cluster-network-subnet'
+ cluster_network_subnet_prototype_model['total_ipv4_address_count'] = 256
# Set up parameter values
- image_id = 'testString'
- storage_bucket = cloud_object_storage_bucket_identity_model
- format = 'qcow2'
- name = 'my-image-export'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_prototype = cluster_network_subnet_prototype_model
# Invoke method
- response = _service.create_image_export_job(
- image_id,
- storage_bucket,
- format=format,
- name=name,
+ response = _service.create_cluster_network_subnet(
+ cluster_network_id,
+ cluster_network_subnet_prototype,
headers={},
)
@@ -7189,27 +7444,25 @@ def test_create_image_export_job_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['storage_bucket'] == cloud_object_storage_bucket_identity_model
- assert req_body['format'] == 'qcow2'
- assert req_body['name'] == 'my-image-export'
+ assert req_body == cluster_network_subnet_prototype
- def test_create_image_export_job_all_params_with_retries(self):
- # Enable retries and run test_create_image_export_job_all_params.
+ def test_create_cluster_network_subnet_all_params_with_retries(self):
+ # Enable retries and run test_create_cluster_network_subnet_all_params.
_service.enable_retries()
- self.test_create_image_export_job_all_params()
+ self.test_create_cluster_network_subnet_all_params()
- # Disable retries and run test_create_image_export_job_all_params.
+ # Disable retries and run test_create_cluster_network_subnet_all_params.
_service.disable_retries()
- self.test_create_image_export_job_all_params()
+ self.test_create_cluster_network_subnet_all_params()
@responses.activate
- def test_create_image_export_job_value_error(self):
+ def test_create_cluster_network_subnet_value_error(self):
"""
- test_create_image_export_job_value_error()
+ test_create_cluster_network_subnet_value_error()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
+ url = preprocess_url('/cluster_networks/testString/subnets')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.POST,
url,
@@ -7218,130 +7471,106 @@ def test_create_image_export_job_value_error(self):
status=201,
)
- # Construct a dict representation of a CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
- cloud_object_storage_bucket_identity_model = {}
- cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+ # Construct a dict representation of a ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model
+ cluster_network_subnet_prototype_model = {}
+ cluster_network_subnet_prototype_model['ip_version'] = 'ipv4'
+ cluster_network_subnet_prototype_model['name'] = 'my-cluster-network-subnet'
+ cluster_network_subnet_prototype_model['total_ipv4_address_count'] = 256
# Set up parameter values
- image_id = 'testString'
- storage_bucket = cloud_object_storage_bucket_identity_model
- format = 'qcow2'
- name = 'my-image-export'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_prototype = cluster_network_subnet_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "image_id": image_id,
- "storage_bucket": storage_bucket,
+ "cluster_network_id": cluster_network_id,
+ "cluster_network_subnet_prototype": cluster_network_subnet_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_image_export_job(**req_copy)
+ _service.create_cluster_network_subnet(**req_copy)
- def test_create_image_export_job_value_error_with_retries(self):
- # Enable retries and run test_create_image_export_job_value_error.
+ def test_create_cluster_network_subnet_value_error_with_retries(self):
+ # Enable retries and run test_create_cluster_network_subnet_value_error.
_service.enable_retries()
- self.test_create_image_export_job_value_error()
+ self.test_create_cluster_network_subnet_value_error()
- # Disable retries and run test_create_image_export_job_value_error.
+ # Disable retries and run test_create_cluster_network_subnet_value_error.
_service.disable_retries()
- self.test_create_image_export_job_value_error()
+ self.test_create_cluster_network_subnet_value_error()
-class TestDeleteImageExportJob:
+class TestListClusterNetworkSubnetReservedIps:
"""
- Test Class for delete_image_export_job
+ Test Class for list_cluster_network_subnet_reserved_ips
"""
@responses.activate
- def test_delete_image_export_job_all_params(self):
+ def test_list_cluster_network_subnet_reserved_ips_all_params(self):
"""
- delete_image_export_job()
+ list_cluster_network_subnet_reserved_ips()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs/testString')
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- image_id = 'testString'
- id = 'testString'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ start = 'testString'
+ limit = 50
+ name = 'my-name'
+ sort = 'name'
# Invoke method
- response = _service.delete_image_export_job(
- image_id,
- id,
+ response = _service.list_cluster_network_subnet_reserved_ips(
+ cluster_network_id,
+ cluster_network_subnet_id,
+ start=start,
+ limit=limit,
+ name=name,
+ sort=sort,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ 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 'sort={}'.format(sort) in query_string
- def test_delete_image_export_job_all_params_with_retries(self):
- # Enable retries and run test_delete_image_export_job_all_params.
+ def test_list_cluster_network_subnet_reserved_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_subnet_reserved_ips_all_params.
_service.enable_retries()
- self.test_delete_image_export_job_all_params()
+ self.test_list_cluster_network_subnet_reserved_ips_all_params()
- # Disable retries and run test_delete_image_export_job_all_params.
+ # Disable retries and run test_list_cluster_network_subnet_reserved_ips_all_params.
_service.disable_retries()
- self.test_delete_image_export_job_all_params()
+ self.test_list_cluster_network_subnet_reserved_ips_all_params()
@responses.activate
- def test_delete_image_export_job_value_error(self):
+ def test_list_cluster_network_subnet_reserved_ips_required_params(self):
"""
- test_delete_image_export_job_value_error()
+ test_list_cluster_network_subnet_reserved_ips_required_params()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs/testString')
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}'
responses.add(
- responses.DELETE,
- url,
- status=202,
- )
-
- # Set up parameter values
- image_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "image_id": image_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_image_export_job(**req_copy)
-
- def test_delete_image_export_job_value_error_with_retries(self):
- # Enable retries and run test_delete_image_export_job_value_error.
- _service.enable_retries()
- self.test_delete_image_export_job_value_error()
-
- # Disable retries and run test_delete_image_export_job_value_error.
- _service.disable_retries()
- self.test_delete_image_export_job_value_error()
-
-
-class TestGetImageExportJob:
- """
- Test Class for get_image_export_job
- """
-
- @responses.activate
- def test_get_image_export_job_all_params(self):
- """
- get_image_export_job()
- """
- # Set up mock
- url = preprocess_url('/images/testString/export_jobs/testString')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
- responses.add(
- responses.GET,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
@@ -7349,13 +7578,13 @@ def test_get_image_export_job_all_params(self):
)
# Set up parameter values
- image_id = 'testString'
- id = 'testString'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
# Invoke method
- response = _service.get_image_export_job(
- image_id,
- id,
+ response = _service.list_cluster_network_subnet_reserved_ips(
+ cluster_network_id,
+ cluster_network_subnet_id,
headers={},
)
@@ -7363,23 +7592,23 @@ def test_get_image_export_job_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_image_export_job_all_params_with_retries(self):
- # Enable retries and run test_get_image_export_job_all_params.
+ def test_list_cluster_network_subnet_reserved_ips_required_params_with_retries(self):
+ # Enable retries and run test_list_cluster_network_subnet_reserved_ips_required_params.
_service.enable_retries()
- self.test_get_image_export_job_all_params()
+ self.test_list_cluster_network_subnet_reserved_ips_required_params()
- # Disable retries and run test_get_image_export_job_all_params.
+ # Disable retries and run test_list_cluster_network_subnet_reserved_ips_required_params.
_service.disable_retries()
- self.test_get_image_export_job_all_params()
+ self.test_list_cluster_network_subnet_reserved_ips_required_params()
@responses.activate
- def test_get_image_export_job_value_error(self):
+ def test_list_cluster_network_subnet_reserved_ips_value_error(self):
"""
- test_get_image_export_job_value_error()
+ test_list_cluster_network_subnet_reserved_ips_value_error()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs/testString')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -7389,327 +7618,347 @@ def test_get_image_export_job_value_error(self):
)
# Set up parameter values
- image_id = 'testString'
- id = 'testString'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "image_id": image_id,
- "id": id,
+ "cluster_network_id": cluster_network_id,
+ "cluster_network_subnet_id": cluster_network_subnet_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_image_export_job(**req_copy)
+ _service.list_cluster_network_subnet_reserved_ips(**req_copy)
- def test_get_image_export_job_value_error_with_retries(self):
- # Enable retries and run test_get_image_export_job_value_error.
+ def test_list_cluster_network_subnet_reserved_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_cluster_network_subnet_reserved_ips_value_error.
_service.enable_retries()
- self.test_get_image_export_job_value_error()
+ self.test_list_cluster_network_subnet_reserved_ips_value_error()
- # Disable retries and run test_get_image_export_job_value_error.
+ # Disable retries and run test_list_cluster_network_subnet_reserved_ips_value_error.
_service.disable_retries()
- self.test_get_image_export_job_value_error()
+ self.test_list_cluster_network_subnet_reserved_ips_value_error()
+ @responses.activate
+ def test_list_cluster_network_subnet_reserved_ips_with_pager_get_next(self):
+ """
+ test_list_cluster_network_subnet_reserved_ips_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestUpdateImageExportJob:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = ClusterNetworkSubnetReservedIpsPager(
+ client=_service,
+ cluster_network_id='testString',
+ cluster_network_subnet_id='testString',
+ limit=10,
+ name='my-name',
+ sort='name',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_cluster_network_subnet_reserved_ips_with_pager_get_all(self):
+ """
+ test_list_cluster_network_subnet_reserved_ips_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = ClusterNetworkSubnetReservedIpsPager(
+ client=_service,
+ cluster_network_id='testString',
+ cluster_network_subnet_id='testString',
+ limit=10,
+ name='my-name',
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateClusterNetworkSubnetReservedIp:
"""
- Test Class for update_image_export_job
+ Test Class for create_cluster_network_subnet_reserved_ip
"""
@responses.activate
- def test_update_image_export_job_all_params(self):
+ def test_create_cluster_network_subnet_reserved_ip_all_params(self):
"""
- update_image_export_job()
+ create_cluster_network_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs/testString')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.PATCH,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ImageExportJobPatch model
- image_export_job_patch_model = {}
- image_export_job_patch_model['name'] = 'my-image-export-job-updated'
-
# Set up parameter values
- image_id = 'testString'
- id = 'testString'
- image_export_job_patch = image_export_job_patch_model
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ address = '192.168.3.4'
+ name = 'my-cluster-network-subnet-reserved-ip'
# Invoke method
- response = _service.update_image_export_job(
- image_id,
- id,
- image_export_job_patch,
+ response = _service.create_cluster_network_subnet_reserved_ip(
+ cluster_network_id,
+ cluster_network_subnet_id,
+ address=address,
+ 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 == image_export_job_patch
+ assert req_body['address'] == '192.168.3.4'
+ assert req_body['name'] == 'my-cluster-network-subnet-reserved-ip'
- def test_update_image_export_job_all_params_with_retries(self):
- # Enable retries and run test_update_image_export_job_all_params.
+ def test_create_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_create_cluster_network_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_update_image_export_job_all_params()
+ self.test_create_cluster_network_subnet_reserved_ip_all_params()
- # Disable retries and run test_update_image_export_job_all_params.
+ # Disable retries and run test_create_cluster_network_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_update_image_export_job_all_params()
+ self.test_create_cluster_network_subnet_reserved_ip_all_params()
@responses.activate
- def test_update_image_export_job_value_error(self):
+ def test_create_cluster_network_subnet_reserved_ip_value_error(self):
"""
- test_update_image_export_job_value_error()
+ test_create_cluster_network_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/images/testString/export_jobs/testString')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.PATCH,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ImageExportJobPatch model
- image_export_job_patch_model = {}
- image_export_job_patch_model['name'] = 'my-image-export-job-updated'
-
# Set up parameter values
- image_id = 'testString'
- id = 'testString'
- image_export_job_patch = image_export_job_patch_model
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ address = '192.168.3.4'
+ name = 'my-cluster-network-subnet-reserved-ip'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "image_id": image_id,
- "id": id,
- "image_export_job_patch": image_export_job_patch,
+ "cluster_network_id": cluster_network_id,
+ "cluster_network_subnet_id": cluster_network_subnet_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_image_export_job(**req_copy)
+ _service.create_cluster_network_subnet_reserved_ip(**req_copy)
- def test_update_image_export_job_value_error_with_retries(self):
- # Enable retries and run test_update_image_export_job_value_error.
+ def test_create_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_create_cluster_network_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_update_image_export_job_value_error()
+ self.test_create_cluster_network_subnet_reserved_ip_value_error()
- # Disable retries and run test_update_image_export_job_value_error.
+ # Disable retries and run test_create_cluster_network_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_update_image_export_job_value_error()
+ self.test_create_cluster_network_subnet_reserved_ip_value_error()
-class TestListOperatingSystems:
+class TestDeleteClusterNetworkSubnetReservedIp:
"""
- Test Class for list_operating_systems
+ Test Class for delete_cluster_network_subnet_reserved_ip
"""
@responses.activate
- def test_list_operating_systems_all_params(self):
+ def test_delete_cluster_network_subnet_reserved_ip_all_params(self):
"""
- list_operating_systems()
+ delete_cluster_network_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/operating_systems')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "operating_systems": [{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- start = 'testString'
- limit = 50
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.list_operating_systems(
- start=start,
- limit=limit,
+ response = _service.delete_cluster_network_subnet_reserved_ip(
+ cluster_network_id,
+ cluster_network_subnet_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_operating_systems_all_params_with_retries(self):
- # Enable retries and run test_list_operating_systems_all_params.
+ def test_delete_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_list_operating_systems_all_params()
+ self.test_delete_cluster_network_subnet_reserved_ip_all_params()
- # Disable retries and run test_list_operating_systems_all_params.
+ # Disable retries and run test_delete_cluster_network_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_list_operating_systems_all_params()
+ self.test_delete_cluster_network_subnet_reserved_ip_all_params()
@responses.activate
- def test_list_operating_systems_required_params(self):
+ def test_delete_cluster_network_subnet_reserved_ip_required_params(self):
"""
- test_list_operating_systems_required_params()
+ test_delete_cluster_network_subnet_reserved_ip_required_params()
"""
# Set up mock
- url = preprocess_url('/operating_systems')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "operating_systems": [{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
+ # Set up parameter values
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
+
# Invoke method
- response = _service.list_operating_systems()
+ response = _service.delete_cluster_network_subnet_reserved_ip(
+ cluster_network_id,
+ cluster_network_subnet_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_operating_systems_required_params_with_retries(self):
- # Enable retries and run test_list_operating_systems_required_params.
+ def test_delete_cluster_network_subnet_reserved_ip_required_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_subnet_reserved_ip_required_params.
_service.enable_retries()
- self.test_list_operating_systems_required_params()
+ self.test_delete_cluster_network_subnet_reserved_ip_required_params()
- # Disable retries and run test_list_operating_systems_required_params.
+ # Disable retries and run test_delete_cluster_network_subnet_reserved_ip_required_params.
_service.disable_retries()
- self.test_list_operating_systems_required_params()
+ self.test_delete_cluster_network_subnet_reserved_ip_required_params()
@responses.activate
- def test_list_operating_systems_value_error(self):
+ def test_delete_cluster_network_subnet_reserved_ip_value_error(self):
"""
- test_list_operating_systems_value_error()
+ test_delete_cluster_network_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/operating_systems')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "operating_systems": [{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
+ # Set up parameter values
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_id,
+ "cluster_network_subnet_id": cluster_network_subnet_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_operating_systems(**req_copy)
+ _service.delete_cluster_network_subnet_reserved_ip(**req_copy)
- def test_list_operating_systems_value_error_with_retries(self):
- # Enable retries and run test_list_operating_systems_value_error.
+ def test_delete_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_list_operating_systems_value_error()
+ self.test_delete_cluster_network_subnet_reserved_ip_value_error()
- # Disable retries and run test_list_operating_systems_value_error.
+ # Disable retries and run test_delete_cluster_network_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_list_operating_systems_value_error()
-
- @responses.activate
- def test_list_operating_systems_with_pager_get_next(self):
- """
- test_list_operating_systems_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/operating_systems')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
- mock_response2 = '{"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = OperatingSystemsPager(
- client=_service,
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_operating_systems_with_pager_get_all(self):
- """
- test_list_operating_systems_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/operating_systems')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
- mock_response2 = '{"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = OperatingSystemsPager(
- client=_service,
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_delete_cluster_network_subnet_reserved_ip_value_error()
-class TestGetOperatingSystem:
+class TestGetClusterNetworkSubnetReservedIp:
"""
- Test Class for get_operating_system
+ Test Class for get_cluster_network_subnet_reserved_ip
"""
@responses.activate
- def test_get_operating_system_all_params(self):
+ def test_get_cluster_network_subnet_reserved_ip_all_params(self):
"""
- get_operating_system()
+ get_cluster_network_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/operating_systems/red-7-amd64')
- mock_response = '{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
responses.GET,
url,
@@ -7719,11 +7968,15 @@ def test_get_operating_system_all_params(self):
)
# Set up parameter values
- name = 'red-7-amd64'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.get_operating_system(
- name,
+ response = _service.get_cluster_network_subnet_reserved_ip(
+ cluster_network_id,
+ cluster_network_subnet_id,
+ id,
headers={},
)
@@ -7731,23 +7984,23 @@ def test_get_operating_system_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_operating_system_all_params_with_retries(self):
- # Enable retries and run test_get_operating_system_all_params.
+ def test_get_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_cluster_network_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_get_operating_system_all_params()
+ self.test_get_cluster_network_subnet_reserved_ip_all_params()
- # Disable retries and run test_get_operating_system_all_params.
+ # Disable retries and run test_get_cluster_network_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_get_operating_system_all_params()
+ self.test_get_cluster_network_subnet_reserved_ip_all_params()
@responses.activate
- def test_get_operating_system_value_error(self):
+ def test_get_cluster_network_subnet_reserved_ip_value_error(self):
"""
- test_get_operating_system_value_error()
+ test_get_cluster_network_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/operating_systems/red-7-amd64')
- mock_response = '{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
responses.GET,
url,
@@ -7757,466 +8010,331 @@ def test_get_operating_system_value_error(self):
)
# Set up parameter values
- name = 'red-7-amd64'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "name": name,
+ "cluster_network_id": cluster_network_id,
+ "cluster_network_subnet_id": cluster_network_subnet_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_operating_system(**req_copy)
+ _service.get_cluster_network_subnet_reserved_ip(**req_copy)
- def test_get_operating_system_value_error_with_retries(self):
- # Enable retries and run test_get_operating_system_value_error.
+ def test_get_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_cluster_network_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_get_operating_system_value_error()
+ self.test_get_cluster_network_subnet_reserved_ip_value_error()
- # Disable retries and run test_get_operating_system_value_error.
+ # Disable retries and run test_get_cluster_network_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_get_operating_system_value_error()
+ self.test_get_cluster_network_subnet_reserved_ip_value_error()
-# endregion
-##############################################################################
-# End of Service: Images
-##############################################################################
-
-##############################################################################
-# Start of Service: Keys
-##############################################################################
-# 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 TestListKeys:
- """
- Test Class for list_keys
- """
+class TestUpdateClusterNetworkSubnetReservedIp:
+ """
+ Test Class for update_cluster_network_subnet_reserved_ip
+ """
@responses.activate
- def test_list_keys_all_params(self):
+ def test_update_cluster_network_subnet_reserved_ip_all_params(self):
"""
- list_keys()
+ update_cluster_network_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/keys')
- mock_response = '{"first": {"href": "href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ClusterNetworkSubnetReservedIPPatch model
+ cluster_network_subnet_reserved_ip_patch_model = {}
+ cluster_network_subnet_reserved_ip_patch_model['auto_delete'] = False
+ cluster_network_subnet_reserved_ip_patch_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
+ cluster_network_subnet_reserved_ip_patch = cluster_network_subnet_reserved_ip_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.list_keys(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
+ response = _service.update_cluster_network_subnet_reserved_ip(
+ cluster_network_id,
+ cluster_network_subnet_id,
+ id,
+ cluster_network_subnet_reserved_ip_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
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body == cluster_network_subnet_reserved_ip_patch
- def test_list_keys_all_params_with_retries(self):
- # Enable retries and run test_list_keys_all_params.
+ def test_update_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_list_keys_all_params()
+ self.test_update_cluster_network_subnet_reserved_ip_all_params()
- # Disable retries and run test_list_keys_all_params.
+ # Disable retries and run test_update_cluster_network_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_list_keys_all_params()
+ self.test_update_cluster_network_subnet_reserved_ip_all_params()
@responses.activate
- def test_list_keys_required_params(self):
+ def test_update_cluster_network_subnet_reserved_ip_required_params(self):
"""
- test_list_keys_required_params()
+ test_update_cluster_network_subnet_reserved_ip_required_params()
"""
# Set up mock
- url = preprocess_url('/keys')
- mock_response = '{"first": {"href": "href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ClusterNetworkSubnetReservedIPPatch model
+ cluster_network_subnet_reserved_ip_patch_model = {}
+ cluster_network_subnet_reserved_ip_patch_model['auto_delete'] = False
+ cluster_network_subnet_reserved_ip_patch_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
+ # Set up parameter values
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
+ cluster_network_subnet_reserved_ip_patch = cluster_network_subnet_reserved_ip_patch_model
+
# Invoke method
- response = _service.list_keys()
+ response = _service.update_cluster_network_subnet_reserved_ip(
+ cluster_network_id,
+ cluster_network_subnet_id,
+ id,
+ cluster_network_subnet_reserved_ip_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 == cluster_network_subnet_reserved_ip_patch
- def test_list_keys_required_params_with_retries(self):
- # Enable retries and run test_list_keys_required_params.
+ def test_update_cluster_network_subnet_reserved_ip_required_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_subnet_reserved_ip_required_params.
_service.enable_retries()
- self.test_list_keys_required_params()
+ self.test_update_cluster_network_subnet_reserved_ip_required_params()
- # Disable retries and run test_list_keys_required_params.
+ # Disable retries and run test_update_cluster_network_subnet_reserved_ip_required_params.
_service.disable_retries()
- self.test_list_keys_required_params()
+ self.test_update_cluster_network_subnet_reserved_ip_required_params()
@responses.activate
- def test_list_keys_value_error(self):
+ def test_update_cluster_network_subnet_reserved_ip_value_error(self):
"""
- test_list_keys_value_error()
+ test_update_cluster_network_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/keys')
- mock_response = '{"first": {"href": "href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
+ mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ClusterNetworkSubnetReservedIPPatch model
+ cluster_network_subnet_reserved_ip_patch_model = {}
+ cluster_network_subnet_reserved_ip_patch_model['auto_delete'] = False
+ cluster_network_subnet_reserved_ip_patch_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
+ # Set up parameter values
+ cluster_network_id = 'testString'
+ cluster_network_subnet_id = 'testString'
+ id = 'testString'
+ cluster_network_subnet_reserved_ip_patch = cluster_network_subnet_reserved_ip_patch_model
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_id,
+ "cluster_network_subnet_id": cluster_network_subnet_id,
+ "id": id,
+ "cluster_network_subnet_reserved_ip_patch": cluster_network_subnet_reserved_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.list_keys(**req_copy)
+ _service.update_cluster_network_subnet_reserved_ip(**req_copy)
- def test_list_keys_value_error_with_retries(self):
- # Enable retries and run test_list_keys_value_error.
+ def test_update_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_update_cluster_network_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_list_keys_value_error()
+ self.test_update_cluster_network_subnet_reserved_ip_value_error()
- # Disable retries and run test_list_keys_value_error.
+ # Disable retries and run test_update_cluster_network_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_list_keys_value_error()
-
- @responses.activate
- def test_list_keys_with_pager_get_next(self):
- """
- test_list_keys_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/keys')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
- mock_response2 = '{"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = KeysPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_keys_with_pager_get_all(self):
- """
- test_list_keys_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/keys')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
- mock_response2 = '{"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = KeysPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_update_cluster_network_subnet_reserved_ip_value_error()
-class TestCreateKey:
+class TestDeleteClusterNetworkSubnet:
"""
- Test Class for create_key
+ Test Class for delete_cluster_network_subnet
"""
@responses.activate
- def test_create_key_all_params(self):
+ def test_delete_cluster_network_subnet_all_params(self):
"""
- create_key()
+ delete_cluster_network_subnet()
"""
# Set up mock
- url = preprocess_url('/keys')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
- responses.POST,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=202,
)
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
# Set up parameter values
- public_key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En'
- name = 'my-key-1'
- resource_group = resource_group_identity_model
- type = 'rsa'
+ cluster_network_id = 'testString'
+ id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.create_key(
- public_key,
- name=name,
- resource_group=resource_group,
- type=type,
+ response = _service.delete_cluster_network_subnet(
+ cluster_network_id,
+ 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['public_key'] == 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En'
- assert req_body['name'] == 'my-key-1'
- assert req_body['resource_group'] == resource_group_identity_model
- assert req_body['type'] == 'rsa'
+ assert response.status_code == 202
- def test_create_key_all_params_with_retries(self):
- # Enable retries and run test_create_key_all_params.
+ def test_delete_cluster_network_subnet_all_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_subnet_all_params.
_service.enable_retries()
- self.test_create_key_all_params()
+ self.test_delete_cluster_network_subnet_all_params()
- # Disable retries and run test_create_key_all_params.
+ # Disable retries and run test_delete_cluster_network_subnet_all_params.
_service.disable_retries()
- self.test_create_key_all_params()
+ self.test_delete_cluster_network_subnet_all_params()
@responses.activate
- def test_create_key_value_error(self):
+ def test_delete_cluster_network_subnet_required_params(self):
"""
- test_create_key_value_error()
+ test_delete_cluster_network_subnet_required_params()
"""
# Set up mock
- url = preprocess_url('/keys')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
- responses.POST,
+ responses.DELETE,
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'
-
- # Set up parameter values
- public_key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En'
- name = 'my-key-1'
- resource_group = resource_group_identity_model
- type = 'rsa'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "public_key": public_key,
- }
- 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_key(**req_copy)
-
- def test_create_key_value_error_with_retries(self):
- # Enable retries and run test_create_key_value_error.
- _service.enable_retries()
- self.test_create_key_value_error()
-
- # Disable retries and run test_create_key_value_error.
- _service.disable_retries()
- self.test_create_key_value_error()
-
-
-class TestDeleteKey:
- """
- Test Class for delete_key
- """
-
- @responses.activate
- def test_delete_key_all_params(self):
- """
- delete_key()
- """
- # Set up mock
- url = preprocess_url('/keys/testString')
- responses.add(
- responses.DELETE,
- url,
- status=204,
+ status=202,
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_key(
+ response = _service.delete_cluster_network_subnet(
+ cluster_network_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_key_all_params_with_retries(self):
- # Enable retries and run test_delete_key_all_params.
+ def test_delete_cluster_network_subnet_required_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_subnet_required_params.
_service.enable_retries()
- self.test_delete_key_all_params()
+ self.test_delete_cluster_network_subnet_required_params()
- # Disable retries and run test_delete_key_all_params.
+ # Disable retries and run test_delete_cluster_network_subnet_required_params.
_service.disable_retries()
- self.test_delete_key_all_params()
+ self.test_delete_cluster_network_subnet_required_params()
@responses.activate
- def test_delete_key_value_error(self):
+ def test_delete_cluster_network_subnet_value_error(self):
"""
- test_delete_key_value_error()
+ test_delete_cluster_network_subnet_value_error()
"""
# Set up mock
- url = preprocess_url('/keys/testString')
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_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_key(**req_copy)
+ _service.delete_cluster_network_subnet(**req_copy)
- def test_delete_key_value_error_with_retries(self):
- # Enable retries and run test_delete_key_value_error.
+ def test_delete_cluster_network_subnet_value_error_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_subnet_value_error.
_service.enable_retries()
- self.test_delete_key_value_error()
+ self.test_delete_cluster_network_subnet_value_error()
- # Disable retries and run test_delete_key_value_error.
+ # Disable retries and run test_delete_cluster_network_subnet_value_error.
_service.disable_retries()
- self.test_delete_key_value_error()
+ self.test_delete_cluster_network_subnet_value_error()
-class TestGetKey:
+class TestGetClusterNetworkSubnet:
"""
- Test Class for get_key
+ Test Class for get_cluster_network_subnet
"""
@responses.activate
- def test_get_key_all_params(self):
+ def test_get_cluster_network_subnet_all_params(self):
"""
- get_key()
+ get_cluster_network_subnet()
"""
# Set up mock
- url = preprocess_url('/keys/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.GET,
url,
@@ -8226,10 +8344,12 @@ def test_get_key_all_params(self):
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_key(
+ response = _service.get_cluster_network_subnet(
+ cluster_network_id,
id,
headers={},
)
@@ -8238,23 +8358,23 @@ def test_get_key_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_key_all_params_with_retries(self):
- # Enable retries and run test_get_key_all_params.
+ def test_get_cluster_network_subnet_all_params_with_retries(self):
+ # Enable retries and run test_get_cluster_network_subnet_all_params.
_service.enable_retries()
- self.test_get_key_all_params()
+ self.test_get_cluster_network_subnet_all_params()
- # Disable retries and run test_get_key_all_params.
+ # Disable retries and run test_get_cluster_network_subnet_all_params.
_service.disable_retries()
- self.test_get_key_all_params()
+ self.test_get_cluster_network_subnet_all_params()
@responses.activate
- def test_get_key_value_error(self):
+ def test_get_cluster_network_subnet_value_error(self):
"""
- test_get_key_value_error()
+ test_get_cluster_network_subnet_value_error()
"""
# Set up mock
- url = preprocess_url('/keys/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.GET,
url,
@@ -8264,40 +8384,42 @@ def test_get_key_value_error(self):
)
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_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_key(**req_copy)
+ _service.get_cluster_network_subnet(**req_copy)
- def test_get_key_value_error_with_retries(self):
- # Enable retries and run test_get_key_value_error.
+ def test_get_cluster_network_subnet_value_error_with_retries(self):
+ # Enable retries and run test_get_cluster_network_subnet_value_error.
_service.enable_retries()
- self.test_get_key_value_error()
+ self.test_get_cluster_network_subnet_value_error()
- # Disable retries and run test_get_key_value_error.
+ # Disable retries and run test_get_cluster_network_subnet_value_error.
_service.disable_retries()
- self.test_get_key_value_error()
+ self.test_get_cluster_network_subnet_value_error()
-class TestUpdateKey:
+class TestUpdateClusterNetworkSubnet:
"""
- Test Class for update_key
+ Test Class for update_cluster_network_subnet
"""
@responses.activate
- def test_update_key_all_params(self):
+ def test_update_cluster_network_subnet_all_params(self):
"""
- update_key()
+ update_cluster_network_subnet()
"""
# Set up mock
- url = preprocess_url('/keys/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.PATCH,
url,
@@ -8306,18 +8428,22 @@ def test_update_key_all_params(self):
status=200,
)
- # Construct a dict representation of a KeyPatch model
- key_patch_model = {}
- key_patch_model['name'] = 'my-key-1'
+ # Construct a dict representation of a ClusterNetworkSubnetPatch model
+ cluster_network_subnet_patch_model = {}
+ cluster_network_subnet_patch_model['name'] = 'my-cluster-network-subnet'
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
- key_patch = key_patch_model
+ cluster_network_subnet_patch = cluster_network_subnet_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_key(
+ response = _service.update_cluster_network_subnet(
+ cluster_network_id,
id,
- key_patch,
+ cluster_network_subnet_patch,
+ if_match=if_match,
headers={},
)
@@ -8326,25 +8452,25 @@ def test_update_key_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 == key_patch
+ assert req_body == cluster_network_subnet_patch
- def test_update_key_all_params_with_retries(self):
- # Enable retries and run test_update_key_all_params.
+ def test_update_cluster_network_subnet_all_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_subnet_all_params.
_service.enable_retries()
- self.test_update_key_all_params()
+ self.test_update_cluster_network_subnet_all_params()
- # Disable retries and run test_update_key_all_params.
+ # Disable retries and run test_update_cluster_network_subnet_all_params.
_service.disable_retries()
- self.test_update_key_all_params()
+ self.test_update_cluster_network_subnet_all_params()
@responses.activate
- def test_update_key_value_error(self):
+ def test_update_cluster_network_subnet_required_params(self):
"""
- test_update_key_value_error()
+ test_update_cluster_network_subnet_required_params()
"""
# Set up mock
- url = preprocess_url('/keys/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
responses.add(
responses.PATCH,
url,
@@ -8353,175 +8479,219 @@ def test_update_key_value_error(self):
status=200,
)
- # Construct a dict representation of a KeyPatch model
- key_patch_model = {}
- key_patch_model['name'] = 'my-key-1'
-
+ # Construct a dict representation of a ClusterNetworkSubnetPatch model
+ cluster_network_subnet_patch_model = {}
+ cluster_network_subnet_patch_model['name'] = 'my-cluster-network-subnet'
+
# Set up parameter values
+ cluster_network_id = 'testString'
id = 'testString'
- key_patch = key_patch_model
+ cluster_network_subnet_patch = cluster_network_subnet_patch_model
+
+ # Invoke method
+ response = _service.update_cluster_network_subnet(
+ cluster_network_id,
+ id,
+ cluster_network_subnet_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 == cluster_network_subnet_patch
+
+ def test_update_cluster_network_subnet_required_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_subnet_required_params.
+ _service.enable_retries()
+ self.test_update_cluster_network_subnet_required_params()
+
+ # Disable retries and run test_update_cluster_network_subnet_required_params.
+ _service.disable_retries()
+ self.test_update_cluster_network_subnet_required_params()
+
+ @responses.activate
+ def test_update_cluster_network_subnet_value_error(self):
+ """
+ test_update_cluster_network_subnet_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/cluster_networks/testString/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ responses.add(
+ responses.PATCH,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Construct a dict representation of a ClusterNetworkSubnetPatch model
+ cluster_network_subnet_patch_model = {}
+ cluster_network_subnet_patch_model['name'] = 'my-cluster-network-subnet'
+
+ # Set up parameter values
+ cluster_network_id = 'testString'
+ id = 'testString'
+ cluster_network_subnet_patch = cluster_network_subnet_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "cluster_network_id": cluster_network_id,
"id": id,
- "key_patch": key_patch,
+ "cluster_network_subnet_patch": cluster_network_subnet_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_key(**req_copy)
+ _service.update_cluster_network_subnet(**req_copy)
- def test_update_key_value_error_with_retries(self):
- # Enable retries and run test_update_key_value_error.
+ def test_update_cluster_network_subnet_value_error_with_retries(self):
+ # Enable retries and run test_update_cluster_network_subnet_value_error.
_service.enable_retries()
- self.test_update_key_value_error()
+ self.test_update_cluster_network_subnet_value_error()
- # Disable retries and run test_update_key_value_error.
+ # Disable retries and run test_update_cluster_network_subnet_value_error.
_service.disable_retries()
- self.test_update_key_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: Keys
-##############################################################################
-
-##############################################################################
-# Start of Service: Instances
-##############################################################################
-# region
+ self.test_update_cluster_network_subnet_value_error()
-class TestNewInstance:
+class TestDeleteClusterNetwork:
"""
- Test Class for new_instance
+ Test Class for delete_cluster_network
"""
- def test_new_instance(self):
+ @responses.activate
+ def test_delete_cluster_network_all_params(self):
"""
- new_instance()
+ delete_cluster_network()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
-
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up mock
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
- 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',
- )
+ # Set up parameter values
+ id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
- 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()
+ # Invoke method
+ response = _service.delete_cluster_network(
+ id,
+ if_match=if_match,
+ headers={},
+ )
- 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,
- )
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+ def test_delete_cluster_network_all_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_all_params.
+ _service.enable_retries()
+ self.test_delete_cluster_network_all_params()
-class TestListInstanceProfiles:
- """
- Test Class for list_instance_profiles
- """
+ # Disable retries and run test_delete_cluster_network_all_params.
+ _service.disable_retries()
+ self.test_delete_cluster_network_all_params()
@responses.activate
- def test_list_instance_profiles_all_params(self):
+ def test_delete_cluster_network_required_params(self):
"""
- list_instance_profiles()
+ test_delete_cluster_network_required_params()
"""
# Set up mock
- url = preprocess_url('/instance/profiles')
- mock_response = '{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}]}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
+ # Set up parameter values
+ id = 'testString'
+
# Invoke method
- response = _service.list_instance_profiles()
+ response = _service.delete_cluster_network(
+ id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 202
- def test_list_instance_profiles_all_params_with_retries(self):
- # Enable retries and run test_list_instance_profiles_all_params.
+ def test_delete_cluster_network_required_params_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_required_params.
_service.enable_retries()
- self.test_list_instance_profiles_all_params()
+ self.test_delete_cluster_network_required_params()
- # Disable retries and run test_list_instance_profiles_all_params.
+ # Disable retries and run test_delete_cluster_network_required_params.
_service.disable_retries()
- self.test_list_instance_profiles_all_params()
+ self.test_delete_cluster_network_required_params()
@responses.activate
- def test_list_instance_profiles_value_error(self):
+ def test_delete_cluster_network_value_error(self):
"""
- test_list_instance_profiles_value_error()
+ test_delete_cluster_network_value_error()
"""
# Set up mock
- url = preprocess_url('/instance/profiles')
- mock_response = '{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}]}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ 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.list_instance_profiles(**req_copy)
+ _service.delete_cluster_network(**req_copy)
- def test_list_instance_profiles_value_error_with_retries(self):
- # Enable retries and run test_list_instance_profiles_value_error.
+ def test_delete_cluster_network_value_error_with_retries(self):
+ # Enable retries and run test_delete_cluster_network_value_error.
_service.enable_retries()
- self.test_list_instance_profiles_value_error()
+ self.test_delete_cluster_network_value_error()
- # Disable retries and run test_list_instance_profiles_value_error.
+ # Disable retries and run test_delete_cluster_network_value_error.
_service.disable_retries()
- self.test_list_instance_profiles_value_error()
+ self.test_delete_cluster_network_value_error()
-class TestGetInstanceProfile:
+class TestGetClusterNetwork:
"""
- Test Class for get_instance_profile
+ Test Class for get_cluster_network
"""
@responses.activate
- def test_get_instance_profile_all_params(self):
+ def test_get_cluster_network_all_params(self):
"""
- get_instance_profile()
+ get_cluster_network()
"""
# Set up mock
- url = preprocess_url('/instance/profiles/mx2-host-152x1216')
- mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -8531,11 +8701,11 @@ def test_get_instance_profile_all_params(self):
)
# Set up parameter values
- name = 'mx2-host-152x1216'
+ id = 'testString'
# Invoke method
- response = _service.get_instance_profile(
- name,
+ response = _service.get_cluster_network(
+ id,
headers={},
)
@@ -8543,23 +8713,23 @@ def test_get_instance_profile_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_profile_all_params_with_retries(self):
- # Enable retries and run test_get_instance_profile_all_params.
+ def test_get_cluster_network_all_params_with_retries(self):
+ # Enable retries and run test_get_cluster_network_all_params.
_service.enable_retries()
- self.test_get_instance_profile_all_params()
+ self.test_get_cluster_network_all_params()
- # Disable retries and run test_get_instance_profile_all_params.
+ # Disable retries and run test_get_cluster_network_all_params.
_service.disable_retries()
- self.test_get_instance_profile_all_params()
+ self.test_get_cluster_network_all_params()
@responses.activate
- def test_get_instance_profile_value_error(self):
+ def test_get_cluster_network_value_error(self):
"""
- test_get_instance_profile_value_error()
+ test_get_cluster_network_value_error()
"""
# Set up mock
- url = preprocess_url('/instance/profiles/mx2-host-152x1216')
- mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -8569,1696 +8739,559 @@ def test_get_instance_profile_value_error(self):
)
# Set up parameter values
- name = 'mx2-host-152x1216'
+ 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_instance_profile(**req_copy)
+ _service.get_cluster_network(**req_copy)
- def test_get_instance_profile_value_error_with_retries(self):
- # Enable retries and run test_get_instance_profile_value_error.
+ def test_get_cluster_network_value_error_with_retries(self):
+ # Enable retries and run test_get_cluster_network_value_error.
_service.enable_retries()
- self.test_get_instance_profile_value_error()
+ self.test_get_cluster_network_value_error()
- # Disable retries and run test_get_instance_profile_value_error.
+ # Disable retries and run test_get_cluster_network_value_error.
_service.disable_retries()
- self.test_get_instance_profile_value_error()
+ self.test_get_cluster_network_value_error()
-class TestListInstanceTemplates:
+class TestUpdateClusterNetwork:
"""
- Test Class for list_instance_templates
+ Test Class for update_cluster_network
"""
@responses.activate
- def test_list_instance_templates_all_params(self):
+ def test_update_cluster_network_all_params(self):
"""
- list_instance_templates()
+ update_cluster_network()
"""
# Set up mock
- url = preprocess_url('/instance/templates')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ClusterNetworkPatch model
+ cluster_network_patch_model = {}
+ cluster_network_patch_model['name'] = 'my-cluster-network'
+
+ # Set up parameter values
+ id = 'testString'
+ cluster_network_patch = cluster_network_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+
# Invoke method
- response = _service.list_instance_templates()
+ response = _service.update_cluster_network(
+ id,
+ cluster_network_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 == cluster_network_patch
- def test_list_instance_templates_all_params_with_retries(self):
- # Enable retries and run test_list_instance_templates_all_params.
+ def test_update_cluster_network_all_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_all_params.
_service.enable_retries()
- self.test_list_instance_templates_all_params()
+ self.test_update_cluster_network_all_params()
- # Disable retries and run test_list_instance_templates_all_params.
+ # Disable retries and run test_update_cluster_network_all_params.
_service.disable_retries()
- self.test_list_instance_templates_all_params()
+ self.test_update_cluster_network_all_params()
@responses.activate
- def test_list_instance_templates_value_error(self):
+ def test_update_cluster_network_required_params(self):
"""
- test_list_instance_templates_value_error()
+ test_update_cluster_network_required_params()
"""
# Set up mock
- url = preprocess_url('/instance/templates')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
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_instance_templates(**req_copy)
+ # Construct a dict representation of a ClusterNetworkPatch model
+ cluster_network_patch_model = {}
+ cluster_network_patch_model['name'] = 'my-cluster-network'
- def test_list_instance_templates_value_error_with_retries(self):
- # Enable retries and run test_list_instance_templates_value_error.
- _service.enable_retries()
- self.test_list_instance_templates_value_error()
+ # Set up parameter values
+ id = 'testString'
+ cluster_network_patch = cluster_network_patch_model
- # Disable retries and run test_list_instance_templates_value_error.
- _service.disable_retries()
- self.test_list_instance_templates_value_error()
+ # Invoke method
+ response = _service.update_cluster_network(
+ id,
+ cluster_network_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 == cluster_network_patch
-class TestCreateInstanceTemplate:
- """
- Test Class for create_instance_template
- """
+ def test_update_cluster_network_required_params_with_retries(self):
+ # Enable retries and run test_update_cluster_network_required_params.
+ _service.enable_retries()
+ self.test_update_cluster_network_required_params()
+
+ # Disable retries and run test_update_cluster_network_required_params.
+ _service.disable_retries()
+ self.test_update_cluster_network_required_params()
@responses.activate
- def test_create_instance_template_all_params(self):
+ def test_update_cluster_network_value_error(self):
"""
- create_instance_template()
+ test_update_cluster_network_value_error()
"""
# Set up mock
- url = preprocess_url('/instance/templates')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
+ url = preprocess_url('/cluster_networks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a InstanceAvailabilityPolicyPrototype model
- instance_availability_policy_prototype_model = {}
- instance_availability_policy_prototype_model['host_failure'] = 'restart'
+ # Construct a dict representation of a ClusterNetworkPatch model
+ cluster_network_patch_model = {}
+ cluster_network_patch_model['name'] = 'my-cluster-network'
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+ # Set up parameter values
+ id = 'testString'
+ cluster_network_patch = cluster_network_patch_model
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "cluster_network_patch": cluster_network_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_cluster_network(**req_copy)
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+ def test_update_cluster_network_value_error_with_retries(self):
+ # Enable retries and run test_update_cluster_network_value_error.
+ _service.enable_retries()
+ self.test_update_cluster_network_value_error()
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
- instance_cluster_network_attachment_prototype_instance_context_model = {}
- instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
- instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
+ # Disable retries and run test_update_cluster_network_value_error.
+ _service.disable_retries()
+ self.test_update_cluster_network_value_error()
- # Construct a dict representation of a TrustedProfileIdentityById model
- trusted_profile_identity_model = {}
- trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
- # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
- instance_default_trusted_profile_prototype_model = {}
- instance_default_trusted_profile_prototype_model['auto_link'] = False
- instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+# endregion
+##############################################################################
+# End of Service: ClusterNetworks
+##############################################################################
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+##############################################################################
+# Start of Service: DedicatedHosts
+##############################################################################
+# region
- # Construct a dict representation of a InstanceMetadataServicePrototype model
- instance_metadata_service_prototype_model = {}
- instance_metadata_service_prototype_model['enabled'] = False
- instance_metadata_service_prototype_model['protocol'] = 'https'
- instance_metadata_service_prototype_model['response_hop_limit'] = 2
- # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_prototype_model = {}
- instance_placement_target_prototype_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
+class TestNewInstance:
+ """
+ Test Class for new_instance
+ """
- # Construct a dict representation of a InstanceProfileIdentityByName model
- instance_profile_identity_model = {}
- instance_profile_identity_model['name'] = 'bx2-4x16'
+ def test_new_instance(self):
+ """
+ new_instance()
+ """
+ os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE',
+ )
- # Construct a dict representation of a InstanceReservationAffinityPrototype model
- instance_reservation_affinity_prototype_model = {}
- instance_reservation_affinity_prototype_model['policy'] = 'automatic'
- instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
+ assert service is not None
+ assert isinstance(service, VpcV1)
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ 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',
+ )
- # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
- volume_attachment_prototype_volume_model = {}
- volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+ 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()
- # Construct a dict representation of a VolumeAttachmentPrototype model
- volume_attachment_prototype_model = {}
- volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
- volume_attachment_prototype_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
+ 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,
+ )
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # 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 VolumePrototypeInstanceByImageContext model
- volume_prototype_instance_by_image_context_model = {}
- volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
- volume_prototype_instance_by_image_context_model['capacity'] = 100
- volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
- volume_prototype_instance_by_image_context_model['iops'] = 10000
- volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
- volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
- volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
- volume_prototype_instance_by_image_context_model['user_tags'] = []
-
- # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
- volume_attachment_prototype_instance_by_image_context_model = {}
- volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
- volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
-
- # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
- catalog_offering_version_plan_identity_model = {}
- catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
-
- # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
- catalog_offering_identity_model = {}
- catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
-
- # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
- instance_catalog_offering_prototype_model = {}
- instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
- instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
-
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a SecurityGroupIdentityById model
- security_group_identity_model = {}
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
- instance_network_attachment_prototype_virtual_network_interface_model = {}
- instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
- instance_network_attachment_prototype_model = {}
- instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
- instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
-
- # 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 NetworkInterfacePrototype model
- network_interface_prototype_model = {}
- network_interface_prototype_model['allow_ip_spoofing'] = True
- network_interface_prototype_model['name'] = 'my-instance-network-interface'
- network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
- network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- network_interface_prototype_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a InstanceTemplatePrototypeInstanceTemplateBySourceTemplate model
- instance_template_prototype_model = {}
- instance_template_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
- instance_template_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
- instance_template_prototype_model['confidential_compute_mode'] = 'disabled'
- instance_template_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
- instance_template_prototype_model['enable_secure_boot'] = True
- instance_template_prototype_model['keys'] = [key_identity_model]
- instance_template_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
- instance_template_prototype_model['name'] = 'my-instance'
- instance_template_prototype_model['placement_target'] = instance_placement_target_prototype_model
- instance_template_prototype_model['profile'] = instance_profile_identity_model
- instance_template_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
- instance_template_prototype_model['resource_group'] = resource_group_identity_model
- instance_template_prototype_model['total_volume_bandwidth'] = 500
- instance_template_prototype_model['user_data'] = 'testString'
- instance_template_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
- instance_template_prototype_model['vpc'] = vpc_identity_model
- instance_template_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
- instance_template_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
- instance_template_prototype_model['image'] = image_identity_model
- instance_template_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
- instance_template_prototype_model['network_interfaces'] = [network_interface_prototype_model]
- instance_template_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
- instance_template_prototype_model['primary_network_interface'] = network_interface_prototype_model
- instance_template_prototype_model['source_template'] = instance_template_identity_model
- instance_template_prototype_model['zone'] = zone_identity_model
-
- # Set up parameter values
- instance_template_prototype = instance_template_prototype_model
-
- # Invoke method
- response = _service.create_instance_template(
- instance_template_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 == instance_template_prototype
-
- def test_create_instance_template_all_params_with_retries(self):
- # Enable retries and run test_create_instance_template_all_params.
- _service.enable_retries()
- self.test_create_instance_template_all_params()
-
- # Disable retries and run test_create_instance_template_all_params.
- _service.disable_retries()
- self.test_create_instance_template_all_params()
+class TestListDedicatedHostGroups:
+ """
+ Test Class for list_dedicated_host_groups
+ """
@responses.activate
- def test_create_instance_template_value_error(self):
+ def test_list_dedicated_host_groups_all_params(self):
"""
- test_create_instance_template_value_error()
+ list_dedicated_host_groups()
"""
# Set up mock
- url = preprocess_url('/instance/templates')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response = '{"first": {"href": "href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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": "href"}, "total_count": 132}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a InstanceAvailabilityPolicyPrototype model
- instance_availability_policy_prototype_model = {}
- instance_availability_policy_prototype_model['host_failure'] = 'restart'
-
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
-
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
-
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
-
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
- instance_cluster_network_attachment_prototype_instance_context_model = {}
- instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
- instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
-
- # Construct a dict representation of a TrustedProfileIdentityById model
- trusted_profile_identity_model = {}
- trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
-
- # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
- instance_default_trusted_profile_prototype_model = {}
- instance_default_trusted_profile_prototype_model['auto_link'] = False
- instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
-
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
-
- # Construct a dict representation of a InstanceMetadataServicePrototype model
- instance_metadata_service_prototype_model = {}
- instance_metadata_service_prototype_model['enabled'] = False
- instance_metadata_service_prototype_model['protocol'] = 'https'
- instance_metadata_service_prototype_model['response_hop_limit'] = 2
-
- # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_prototype_model = {}
- instance_placement_target_prototype_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
-
- # Construct a dict representation of a InstanceProfileIdentityByName model
- instance_profile_identity_model = {}
- instance_profile_identity_model['name'] = 'bx2-4x16'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a InstanceReservationAffinityPrototype model
- instance_reservation_affinity_prototype_model = {}
- instance_reservation_affinity_prototype_model['policy'] = 'automatic'
- instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
- volume_attachment_prototype_volume_model = {}
- volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
-
- # Construct a dict representation of a VolumeAttachmentPrototype model
- volume_attachment_prototype_model = {}
- volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
- volume_attachment_prototype_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # 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 VolumePrototypeInstanceByImageContext model
- volume_prototype_instance_by_image_context_model = {}
- volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
- volume_prototype_instance_by_image_context_model['capacity'] = 100
- volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
- volume_prototype_instance_by_image_context_model['iops'] = 10000
- volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
- volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
- volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
- volume_prototype_instance_by_image_context_model['user_tags'] = []
-
- # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
- volume_attachment_prototype_instance_by_image_context_model = {}
- volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
- volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
-
- # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
- catalog_offering_version_plan_identity_model = {}
- catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
-
- # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
- catalog_offering_identity_model = {}
- catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
-
- # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
- instance_catalog_offering_prototype_model = {}
- instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
- instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
-
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a SecurityGroupIdentityById model
- security_group_identity_model = {}
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
- instance_network_attachment_prototype_virtual_network_interface_model = {}
- instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
- instance_network_attachment_prototype_model = {}
- instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
- instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
-
- # 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 NetworkInterfacePrototype model
- network_interface_prototype_model = {}
- network_interface_prototype_model['allow_ip_spoofing'] = True
- network_interface_prototype_model['name'] = 'my-instance-network-interface'
- network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
- network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- network_interface_prototype_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a InstanceTemplatePrototypeInstanceTemplateBySourceTemplate model
- instance_template_prototype_model = {}
- instance_template_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
- instance_template_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
- instance_template_prototype_model['confidential_compute_mode'] = 'disabled'
- instance_template_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
- instance_template_prototype_model['enable_secure_boot'] = True
- instance_template_prototype_model['keys'] = [key_identity_model]
- instance_template_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
- instance_template_prototype_model['name'] = 'my-instance'
- instance_template_prototype_model['placement_target'] = instance_placement_target_prototype_model
- instance_template_prototype_model['profile'] = instance_profile_identity_model
- instance_template_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
- instance_template_prototype_model['resource_group'] = resource_group_identity_model
- instance_template_prototype_model['total_volume_bandwidth'] = 500
- instance_template_prototype_model['user_data'] = 'testString'
- instance_template_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
- instance_template_prototype_model['vpc'] = vpc_identity_model
- instance_template_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
- instance_template_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
- instance_template_prototype_model['image'] = image_identity_model
- instance_template_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
- instance_template_prototype_model['network_interfaces'] = [network_interface_prototype_model]
- instance_template_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
- instance_template_prototype_model['primary_network_interface'] = network_interface_prototype_model
- instance_template_prototype_model['source_template'] = instance_template_identity_model
- instance_template_prototype_model['zone'] = zone_identity_model
-
# Set up parameter values
- instance_template_prototype = instance_template_prototype_model
+ start = 'testString'
+ limit = 50
+ resource_group_id = 'testString'
+ zone_name = 'us-south-1'
+ name = 'my-name'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "instance_template_prototype": instance_template_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_instance_template(**req_copy)
+ # Invoke method
+ response = _service.list_dedicated_host_groups(
+ start=start,
+ limit=limit,
+ resource_group_id=resource_group_id,
+ zone_name=zone_name,
+ name=name,
+ headers={},
+ )
- def test_create_instance_template_value_error_with_retries(self):
- # Enable retries and run test_create_instance_template_value_error.
+ # 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 'zone.name={}'.format(zone_name) in query_string
+ assert 'name={}'.format(name) in query_string
+
+ def test_list_dedicated_host_groups_all_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_groups_all_params.
_service.enable_retries()
- self.test_create_instance_template_value_error()
+ self.test_list_dedicated_host_groups_all_params()
- # Disable retries and run test_create_instance_template_value_error.
+ # Disable retries and run test_list_dedicated_host_groups_all_params.
_service.disable_retries()
- self.test_create_instance_template_value_error()
-
-
-class TestDeleteInstanceTemplate:
- """
- Test Class for delete_instance_template
- """
+ self.test_list_dedicated_host_groups_all_params()
@responses.activate
- def test_delete_instance_template_all_params(self):
+ def test_list_dedicated_host_groups_required_params(self):
"""
- delete_instance_template()
+ test_list_dedicated_host_groups_required_params()
"""
# Set up mock
- url = preprocess_url('/instance/templates/testString')
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response = '{"first": {"href": "href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Set up parameter values
- id = 'testString'
-
# Invoke method
- response = _service.delete_instance_template(
- id,
- headers={},
- )
+ response = _service.list_dedicated_host_groups()
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_instance_template_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_template_all_params.
+ def test_list_dedicated_host_groups_required_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_groups_required_params.
_service.enable_retries()
- self.test_delete_instance_template_all_params()
+ self.test_list_dedicated_host_groups_required_params()
- # Disable retries and run test_delete_instance_template_all_params.
+ # Disable retries and run test_list_dedicated_host_groups_required_params.
_service.disable_retries()
- self.test_delete_instance_template_all_params()
+ self.test_list_dedicated_host_groups_required_params()
@responses.activate
- def test_delete_instance_template_value_error(self):
+ def test_list_dedicated_host_groups_value_error(self):
"""
- test_delete_instance_template_value_error()
+ test_list_dedicated_host_groups_value_error()
"""
# Set up mock
- url = preprocess_url('/instance/templates/testString')
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response = '{"first": {"href": "href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ 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.delete_instance_template(**req_copy)
+ _service.list_dedicated_host_groups(**req_copy)
- def test_delete_instance_template_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_template_value_error.
+ def test_list_dedicated_host_groups_value_error_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_groups_value_error.
_service.enable_retries()
- self.test_delete_instance_template_value_error()
+ self.test_list_dedicated_host_groups_value_error()
- # Disable retries and run test_delete_instance_template_value_error.
+ # Disable retries and run test_list_dedicated_host_groups_value_error.
_service.disable_retries()
- self.test_delete_instance_template_value_error()
-
-
-class TestGetInstanceTemplate:
- """
- Test Class for get_instance_template
- """
+ self.test_list_dedicated_host_groups_value_error()
@responses.activate
- def test_get_instance_template_all_params(self):
+ def test_list_dedicated_host_groups_with_pager_get_next(self):
"""
- get_instance_template()
+ test_list_dedicated_host_groups_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/instance/templates/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
+ # Set up a two-page mock response
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"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_instance_template(
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_instance_template_all_params_with_retries(self):
- # Enable retries and run test_get_instance_template_all_params.
- _service.enable_retries()
- self.test_get_instance_template_all_params()
-
- # Disable retries and run test_get_instance_template_all_params.
- _service.disable_retries()
- self.test_get_instance_template_all_params()
-
- @responses.activate
- def test_get_instance_template_value_error(self):
- """
- test_get_instance_template_value_error()
- """
- # Set up mock
- url = preprocess_url('/instance/templates/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
- 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_instance_template(**req_copy)
-
- def test_get_instance_template_value_error_with_retries(self):
- # Enable retries and run test_get_instance_template_value_error.
- _service.enable_retries()
- self.test_get_instance_template_value_error()
-
- # Disable retries and run test_get_instance_template_value_error.
- _service.disable_retries()
- self.test_get_instance_template_value_error()
-
-
-class TestUpdateInstanceTemplate:
- """
- Test Class for update_instance_template
- """
-
- @responses.activate
- def test_update_instance_template_all_params(self):
- """
- update_instance_template()
- """
- # Set up mock
- url = preprocess_url('/instance/templates/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Construct a dict representation of a InstanceTemplatePatch model
- instance_template_patch_model = {}
- instance_template_patch_model['name'] = 'my-instance-template-updated'
-
- # Set up parameter values
- id = 'testString'
- instance_template_patch = instance_template_patch_model
-
- # Invoke method
- response = _service.update_instance_template(
- id,
- instance_template_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 == instance_template_patch
-
- def test_update_instance_template_all_params_with_retries(self):
- # Enable retries and run test_update_instance_template_all_params.
- _service.enable_retries()
- self.test_update_instance_template_all_params()
-
- # Disable retries and run test_update_instance_template_all_params.
- _service.disable_retries()
- self.test_update_instance_template_all_params()
-
- @responses.activate
- def test_update_instance_template_value_error(self):
- """
- test_update_instance_template_value_error()
- """
- # Set up mock
- url = preprocess_url('/instance/templates/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Construct a dict representation of a InstanceTemplatePatch model
- instance_template_patch_model = {}
- instance_template_patch_model['name'] = 'my-instance-template-updated'
-
- # Set up parameter values
- id = 'testString'
- instance_template_patch = instance_template_patch_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "instance_template_patch": instance_template_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_instance_template(**req_copy)
-
- def test_update_instance_template_value_error_with_retries(self):
- # Enable retries and run test_update_instance_template_value_error.
- _service.enable_retries()
- self.test_update_instance_template_value_error()
-
- # Disable retries and run test_update_instance_template_value_error.
- _service.disable_retries()
- self.test_update_instance_template_value_error()
-
-
-class TestListInstances:
- """
- Test Class for list_instances
- """
-
- @responses.activate
- def test_list_instances_all_params(self):
- """
- list_instances()
- """
- # Set up mock
- url = preprocess_url('/instances')
- mock_response = '{"first": {"href": "href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- name = 'my-name'
- cluster_network_id = 'testString'
- cluster_network_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573'
- cluster_network_name = 'my-cluster-network'
- dedicated_host_id = 'testString'
- dedicated_host_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
- dedicated_host_name = 'my-dedicated-host'
- placement_group_id = 'testString'
- placement_group_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871'
- placement_group_name = 'my-placement-group'
- reservation_affinity_policy = 'automatic'
- reservation_id = 'testString'
- reservation_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- reservation_name = 'my-reservation'
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
-
- # Invoke method
- response = _service.list_instances(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
- name=name,
- cluster_network_id=cluster_network_id,
- cluster_network_crn=cluster_network_crn,
- cluster_network_name=cluster_network_name,
- dedicated_host_id=dedicated_host_id,
- dedicated_host_crn=dedicated_host_crn,
- dedicated_host_name=dedicated_host_name,
- placement_group_id=placement_group_id,
- placement_group_crn=placement_group_crn,
- placement_group_name=placement_group_name,
- reservation_affinity_policy=reservation_affinity_policy,
- reservation_id=reservation_id,
- reservation_crn=reservation_crn,
- reservation_name=reservation_name,
- vpc_id=vpc_id,
- vpc_crn=vpc_crn,
- vpc_name=vpc_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 'cluster_network.id={}'.format(cluster_network_id) in query_string
- assert 'cluster_network.crn={}'.format(cluster_network_crn) in query_string
- assert 'cluster_network.name={}'.format(cluster_network_name) in query_string
- assert 'dedicated_host.id={}'.format(dedicated_host_id) in query_string
- assert 'dedicated_host.crn={}'.format(dedicated_host_crn) in query_string
- assert 'dedicated_host.name={}'.format(dedicated_host_name) in query_string
- assert 'placement_group.id={}'.format(placement_group_id) in query_string
- assert 'placement_group.crn={}'.format(placement_group_crn) in query_string
- assert 'placement_group.name={}'.format(placement_group_name) in query_string
- assert 'reservation_affinity.policy={}'.format(reservation_affinity_policy) in query_string
- assert 'reservation.id={}'.format(reservation_id) in query_string
- assert 'reservation.crn={}'.format(reservation_crn) in query_string
- assert 'reservation.name={}'.format(reservation_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
-
- def test_list_instances_all_params_with_retries(self):
- # Enable retries and run test_list_instances_all_params.
- _service.enable_retries()
- self.test_list_instances_all_params()
-
- # Disable retries and run test_list_instances_all_params.
- _service.disable_retries()
- self.test_list_instances_all_params()
-
- @responses.activate
- def test_list_instances_required_params(self):
- """
- test_list_instances_required_params()
- """
- # Set up mock
- url = preprocess_url('/instances')
- mock_response = '{"first": {"href": "href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Invoke method
- response = _service.list_instances()
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_instances_required_params_with_retries(self):
- # Enable retries and run test_list_instances_required_params.
- _service.enable_retries()
- self.test_list_instances_required_params()
-
- # Disable retries and run test_list_instances_required_params.
- _service.disable_retries()
- self.test_list_instances_required_params()
-
- @responses.activate
- def test_list_instances_value_error(self):
- """
- test_list_instances_value_error()
- """
- # Set up mock
- url = preprocess_url('/instances')
- mock_response = '{"first": {"href": "href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "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_instances(**req_copy)
-
- def test_list_instances_value_error_with_retries(self):
- # Enable retries and run test_list_instances_value_error.
- _service.enable_retries()
- self.test_list_instances_value_error()
-
- # Disable retries and run test_list_instances_value_error.
- _service.disable_retries()
- self.test_list_instances_value_error()
-
- @responses.activate
- def test_list_instances_with_pager_get_next(self):
- """
- test_list_instances_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/instances')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- mock_response2 = '{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
content_type='application/json',
status=200,
)
# Exercise the pager class for this operation
all_results = []
- pager = InstancesPager(
+ pager = DedicatedHostGroupsPager(
client=_service,
limit=10,
resource_group_id='testString',
+ zone_name='us-south-1',
name='my-name',
- cluster_network_id='testString',
- cluster_network_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573',
- cluster_network_name='my-cluster-network',
- dedicated_host_id='testString',
- dedicated_host_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a',
- dedicated_host_name='my-dedicated-host',
- placement_group_id='testString',
- placement_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871',
- placement_group_name='my-placement-group',
- reservation_affinity_policy='automatic',
- reservation_id='testString',
- reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
- reservation_name='my-reservation',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
)
while pager.has_next():
next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_instances_with_pager_get_all(self):
- """
- test_list_instances_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/instances')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- mock_response2 = '{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = InstancesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- cluster_network_id='testString',
- cluster_network_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573',
- cluster_network_name='my-cluster-network',
- dedicated_host_id='testString',
- dedicated_host_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a',
- dedicated_host_name='my-dedicated-host',
- placement_group_id='testString',
- placement_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871',
- placement_group_name='my-placement-group',
- reservation_affinity_policy='automatic',
- reservation_id='testString',
- reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
- reservation_name='my-reservation',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
-
-
-class TestCreateInstance:
- """
- Test Class for create_instance
- """
-
- @responses.activate
- def test_create_instance_all_params(self):
- """
- create_instance()
- """
- # Set up mock
- url = preprocess_url('/instances')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 InstanceAvailabilityPolicyPrototype model
- instance_availability_policy_prototype_model = {}
- instance_availability_policy_prototype_model['host_failure'] = 'restart'
-
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
-
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
-
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
-
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
- instance_cluster_network_attachment_prototype_instance_context_model = {}
- instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
- instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
-
- # Construct a dict representation of a TrustedProfileIdentityById model
- trusted_profile_identity_model = {}
- trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
-
- # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
- instance_default_trusted_profile_prototype_model = {}
- instance_default_trusted_profile_prototype_model['auto_link'] = False
- instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
-
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
-
- # Construct a dict representation of a InstanceMetadataServicePrototype model
- instance_metadata_service_prototype_model = {}
- instance_metadata_service_prototype_model['enabled'] = False
- instance_metadata_service_prototype_model['protocol'] = 'https'
- instance_metadata_service_prototype_model['response_hop_limit'] = 2
-
- # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_prototype_model = {}
- instance_placement_target_prototype_model['id'] = 'r006-418fe842-a3e9-47b9-a938-1aa5bd632871'
-
- # Construct a dict representation of a InstanceProfileIdentityByName model
- instance_profile_identity_model = {}
- instance_profile_identity_model['name'] = 'bx2-2x8'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a InstanceReservationAffinityPrototype model
- instance_reservation_affinity_prototype_model = {}
- instance_reservation_affinity_prototype_model['policy'] = 'automatic'
- instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # 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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model
- volume_attachment_prototype_volume_model = {}
- volume_attachment_prototype_volume_model['bandwidth'] = 1000
- volume_attachment_prototype_volume_model['iops'] = 10000
- volume_attachment_prototype_volume_model['name'] = 'my-data-volume'
- volume_attachment_prototype_volume_model['profile'] = volume_profile_identity_model
- volume_attachment_prototype_volume_model['resource_group'] = resource_group_identity_model
- volume_attachment_prototype_volume_model['user_tags'] = []
- volume_attachment_prototype_volume_model['capacity'] = 1000
- volume_attachment_prototype_volume_model['encryption_key'] = encryption_key_identity_model
-
- # Construct a dict representation of a VolumeAttachmentPrototype model
- volume_attachment_prototype_model = {}
- volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
- volume_attachment_prototype_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a VolumePrototypeInstanceByImageContext model
- volume_prototype_instance_by_image_context_model = {}
- volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
- volume_prototype_instance_by_image_context_model['capacity'] = 100
- volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
- volume_prototype_instance_by_image_context_model['iops'] = 10000
- volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
- volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
- volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
- volume_prototype_instance_by_image_context_model['user_tags'] = []
-
- # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
- volume_attachment_prototype_instance_by_image_context_model = {}
- volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
- volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
-
- # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
- catalog_offering_version_plan_identity_model = {}
- catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
-
- # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
- catalog_offering_identity_model = {}
- catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
-
- # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
- instance_catalog_offering_prototype_model = {}
- instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
- instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
-
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a SecurityGroupIdentityById model
- security_group_identity_model = {}
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
- instance_network_attachment_prototype_virtual_network_interface_model = {}
- instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
- instance_network_attachment_prototype_model = {}
- instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
- instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
-
- # 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 NetworkInterfacePrototype model
- network_interface_prototype_model = {}
- network_interface_prototype_model['allow_ip_spoofing'] = True
- network_interface_prototype_model['name'] = 'my-instance-network-interface'
- network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
- network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- network_interface_prototype_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a InstancePrototypeInstanceBySourceTemplate model
- instance_prototype_model = {}
- instance_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
- instance_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
- instance_prototype_model['confidential_compute_mode'] = 'disabled'
- instance_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
- instance_prototype_model['enable_secure_boot'] = True
- instance_prototype_model['keys'] = [key_identity_model]
- instance_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
- instance_prototype_model['name'] = 'my-instance'
- instance_prototype_model['placement_target'] = instance_placement_target_prototype_model
- instance_prototype_model['profile'] = instance_profile_identity_model
- instance_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
- instance_prototype_model['resource_group'] = resource_group_identity_model
- instance_prototype_model['total_volume_bandwidth'] = 500
- instance_prototype_model['user_data'] = 'testString'
- instance_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
- instance_prototype_model['vpc'] = vpc_identity_model
- instance_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
- instance_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
- instance_prototype_model['image'] = image_identity_model
- instance_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
- instance_prototype_model['network_interfaces'] = [network_interface_prototype_model]
- instance_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
- instance_prototype_model['primary_network_interface'] = network_interface_prototype_model
- instance_prototype_model['source_template'] = instance_template_identity_model
- instance_prototype_model['zone'] = zone_identity_model
-
- # Set up parameter values
- instance_prototype = instance_prototype_model
-
- # Invoke method
- response = _service.create_instance(
- instance_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 == instance_prototype
-
- def test_create_instance_all_params_with_retries(self):
- # Enable retries and run test_create_instance_all_params.
- _service.enable_retries()
- self.test_create_instance_all_params()
-
- # Disable retries and run test_create_instance_all_params.
- _service.disable_retries()
- self.test_create_instance_all_params()
-
- @responses.activate
- def test_create_instance_value_error(self):
- """
- test_create_instance_value_error()
- """
- # Set up mock
- url = preprocess_url('/instances')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 InstanceAvailabilityPolicyPrototype model
- instance_availability_policy_prototype_model = {}
- instance_availability_policy_prototype_model['host_failure'] = 'restart'
-
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
-
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
-
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
-
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
- instance_cluster_network_attachment_prototype_instance_context_model = {}
- instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
- instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
-
- # Construct a dict representation of a TrustedProfileIdentityById model
- trusted_profile_identity_model = {}
- trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
-
- # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
- instance_default_trusted_profile_prototype_model = {}
- instance_default_trusted_profile_prototype_model['auto_link'] = False
- instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
-
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
-
- # Construct a dict representation of a InstanceMetadataServicePrototype model
- instance_metadata_service_prototype_model = {}
- instance_metadata_service_prototype_model['enabled'] = False
- instance_metadata_service_prototype_model['protocol'] = 'https'
- instance_metadata_service_prototype_model['response_hop_limit'] = 2
-
- # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_prototype_model = {}
- instance_placement_target_prototype_model['id'] = 'r006-418fe842-a3e9-47b9-a938-1aa5bd632871'
-
- # Construct a dict representation of a InstanceProfileIdentityByName model
- instance_profile_identity_model = {}
- instance_profile_identity_model['name'] = 'bx2-2x8'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a InstanceReservationAffinityPrototype model
- instance_reservation_affinity_prototype_model = {}
- instance_reservation_affinity_prototype_model['policy'] = 'automatic'
- instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # 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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model
- volume_attachment_prototype_volume_model = {}
- volume_attachment_prototype_volume_model['bandwidth'] = 1000
- volume_attachment_prototype_volume_model['iops'] = 10000
- volume_attachment_prototype_volume_model['name'] = 'my-data-volume'
- volume_attachment_prototype_volume_model['profile'] = volume_profile_identity_model
- volume_attachment_prototype_volume_model['resource_group'] = resource_group_identity_model
- volume_attachment_prototype_volume_model['user_tags'] = []
- volume_attachment_prototype_volume_model['capacity'] = 1000
- volume_attachment_prototype_volume_model['encryption_key'] = encryption_key_identity_model
-
- # Construct a dict representation of a VolumeAttachmentPrototype model
- volume_attachment_prototype_model = {}
- volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
- volume_attachment_prototype_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a VolumePrototypeInstanceByImageContext model
- volume_prototype_instance_by_image_context_model = {}
- volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
- volume_prototype_instance_by_image_context_model['capacity'] = 100
- volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
- volume_prototype_instance_by_image_context_model['iops'] = 10000
- volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
- volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
- volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
- volume_prototype_instance_by_image_context_model['user_tags'] = []
-
- # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
- volume_attachment_prototype_instance_by_image_context_model = {}
- volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
- volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
- volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
-
- # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
- catalog_offering_version_plan_identity_model = {}
- catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
-
- # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
- catalog_offering_identity_model = {}
- catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
-
- # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
- instance_catalog_offering_prototype_model = {}
- instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
- instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
-
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a SecurityGroupIdentityById model
- security_group_identity_model = {}
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
- instance_network_attachment_prototype_virtual_network_interface_model = {}
- instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
- instance_network_attachment_prototype_model = {}
- instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
- instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
-
- # 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 NetworkInterfacePrototype model
- network_interface_prototype_model = {}
- network_interface_prototype_model['allow_ip_spoofing'] = True
- network_interface_prototype_model['name'] = 'my-instance-network-interface'
- network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
- network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- network_interface_prototype_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a InstancePrototypeInstanceBySourceTemplate model
- instance_prototype_model = {}
- instance_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
- instance_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
- instance_prototype_model['confidential_compute_mode'] = 'disabled'
- instance_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
- instance_prototype_model['enable_secure_boot'] = True
- instance_prototype_model['keys'] = [key_identity_model]
- instance_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
- instance_prototype_model['name'] = 'my-instance'
- instance_prototype_model['placement_target'] = instance_placement_target_prototype_model
- instance_prototype_model['profile'] = instance_profile_identity_model
- instance_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
- instance_prototype_model['resource_group'] = resource_group_identity_model
- instance_prototype_model['total_volume_bandwidth'] = 500
- instance_prototype_model['user_data'] = 'testString'
- instance_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
- instance_prototype_model['vpc'] = vpc_identity_model
- instance_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
- instance_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
- instance_prototype_model['image'] = image_identity_model
- instance_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
- instance_prototype_model['network_interfaces'] = [network_interface_prototype_model]
- instance_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
- instance_prototype_model['primary_network_interface'] = network_interface_prototype_model
- instance_prototype_model['source_template'] = instance_template_identity_model
- instance_prototype_model['zone'] = zone_identity_model
-
- # Set up parameter values
- instance_prototype = instance_prototype_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "instance_prototype": instance_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_instance(**req_copy)
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
- def test_create_instance_value_error_with_retries(self):
- # Enable retries and run test_create_instance_value_error.
- _service.enable_retries()
- self.test_create_instance_value_error()
+ @responses.activate
+ def test_list_dedicated_host_groups_with_pager_get_all(self):
+ """
+ test_list_dedicated_host_groups_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"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_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
- # Disable retries and run test_create_instance_value_error.
- _service.disable_retries()
- self.test_create_instance_value_error()
+ # Exercise the pager class for this operation
+ pager = DedicatedHostGroupsPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ zone_name='us-south-1',
+ name='my-name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestDeleteInstance:
+class TestCreateDedicatedHostGroup:
"""
- Test Class for delete_instance
+ Test Class for create_dedicated_host_group
"""
@responses.activate
- def test_delete_instance_all_params(self):
+ def test_create_dedicated_host_group_all_params(self):
"""
- delete_instance()
+ create_dedicated_host_group()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
# Set up parameter values
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ class_ = 'mx2'
+ family = 'balanced'
+ zone = zone_identity_model
+ name = 'testString'
+ resource_group = resource_group_identity_model
# Invoke method
- response = _service.delete_instance(
- id,
- if_match=if_match,
+ response = _service.create_dedicated_host_group(
+ class_,
+ family,
+ zone,
+ name=name,
+ resource_group=resource_group,
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['class'] == 'mx2'
+ assert req_body['family'] == 'balanced'
+ assert req_body['zone'] == zone_identity_model
+ assert req_body['name'] == 'testString'
+ assert req_body['resource_group'] == resource_group_identity_model
- def test_delete_instance_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_all_params.
+ def test_create_dedicated_host_group_all_params_with_retries(self):
+ # Enable retries and run test_create_dedicated_host_group_all_params.
_service.enable_retries()
- self.test_delete_instance_all_params()
+ self.test_create_dedicated_host_group_all_params()
- # Disable retries and run test_delete_instance_all_params.
+ # Disable retries and run test_create_dedicated_host_group_all_params.
_service.disable_retries()
- self.test_delete_instance_all_params()
+ self.test_create_dedicated_host_group_all_params()
@responses.activate
- def test_delete_instance_required_params(self):
+ def test_create_dedicated_host_group_value_error(self):
"""
- test_delete_instance_required_params()
+ test_create_dedicated_host_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
+ url = preprocess_url('/dedicated_host/groups')
+ mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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 ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Set up parameter values
+ class_ = 'mx2'
+ family = 'balanced'
+ zone = zone_identity_model
+ name = 'testString'
+ resource_group = resource_group_identity_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "class_": class_,
+ "family": family,
+ "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_dedicated_host_group(**req_copy)
+
+ def test_create_dedicated_host_group_value_error_with_retries(self):
+ # Enable retries and run test_create_dedicated_host_group_value_error.
+ _service.enable_retries()
+ self.test_create_dedicated_host_group_value_error()
+
+ # Disable retries and run test_create_dedicated_host_group_value_error.
+ _service.disable_retries()
+ self.test_create_dedicated_host_group_value_error()
+
+
+class TestDeleteDedicatedHostGroup:
+ """
+ Test Class for delete_dedicated_host_group
+ """
+
+ @responses.activate
+ def test_delete_dedicated_host_group_all_params(self):
+ """
+ delete_dedicated_host_group()
+ """
+ # Set up mock
+ url = preprocess_url('/dedicated_host/groups/testString')
responses.add(
responses.DELETE,
url,
@@ -10269,7 +9302,7 @@ def test_delete_instance_required_params(self):
id = 'testString'
# Invoke method
- response = _service.delete_instance(
+ response = _service.delete_dedicated_host_group(
id,
headers={},
)
@@ -10278,22 +9311,22 @@ def test_delete_instance_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_instance_required_params_with_retries(self):
- # Enable retries and run test_delete_instance_required_params.
+ def test_delete_dedicated_host_group_all_params_with_retries(self):
+ # Enable retries and run test_delete_dedicated_host_group_all_params.
_service.enable_retries()
- self.test_delete_instance_required_params()
+ self.test_delete_dedicated_host_group_all_params()
- # Disable retries and run test_delete_instance_required_params.
+ # Disable retries and run test_delete_dedicated_host_group_all_params.
_service.disable_retries()
- self.test_delete_instance_required_params()
+ self.test_delete_dedicated_host_group_all_params()
@responses.activate
- def test_delete_instance_value_error(self):
+ def test_delete_dedicated_host_group_value_error(self):
"""
- test_delete_instance_value_error()
+ test_delete_dedicated_host_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
+ url = preprocess_url('/dedicated_host/groups/testString')
responses.add(
responses.DELETE,
url,
@@ -10310,31 +9343,31 @@ def test_delete_instance_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_instance(**req_copy)
+ _service.delete_dedicated_host_group(**req_copy)
- def test_delete_instance_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_value_error.
+ def test_delete_dedicated_host_group_value_error_with_retries(self):
+ # Enable retries and run test_delete_dedicated_host_group_value_error.
_service.enable_retries()
- self.test_delete_instance_value_error()
+ self.test_delete_dedicated_host_group_value_error()
- # Disable retries and run test_delete_instance_value_error.
+ # Disable retries and run test_delete_dedicated_host_group_value_error.
_service.disable_retries()
- self.test_delete_instance_value_error()
+ self.test_delete_dedicated_host_group_value_error()
-class TestGetInstance:
+class TestGetDedicatedHostGroup:
"""
- Test Class for get_instance
+ Test Class for get_dedicated_host_group
"""
@responses.activate
- def test_get_instance_all_params(self):
+ def test_get_dedicated_host_group_all_params(self):
"""
- get_instance()
+ get_dedicated_host_group()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/dedicated_host/groups/testString')
+ mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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,
@@ -10347,7 +9380,7 @@ def test_get_instance_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_instance(
+ response = _service.get_dedicated_host_group(
id,
headers={},
)
@@ -10356,23 +9389,23 @@ def test_get_instance_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_all_params_with_retries(self):
- # Enable retries and run test_get_instance_all_params.
+ def test_get_dedicated_host_group_all_params_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_group_all_params.
_service.enable_retries()
- self.test_get_instance_all_params()
+ self.test_get_dedicated_host_group_all_params()
- # Disable retries and run test_get_instance_all_params.
+ # Disable retries and run test_get_dedicated_host_group_all_params.
_service.disable_retries()
- self.test_get_instance_all_params()
+ self.test_get_dedicated_host_group_all_params()
@responses.activate
- def test_get_instance_value_error(self):
+ def test_get_dedicated_host_group_value_error(self):
"""
- test_get_instance_value_error()
+ test_get_dedicated_host_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/dedicated_host/groups/testString')
+ mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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,
@@ -10391,31 +9424,31 @@ def test_get_instance_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_instance(**req_copy)
+ _service.get_dedicated_host_group(**req_copy)
- def test_get_instance_value_error_with_retries(self):
- # Enable retries and run test_get_instance_value_error.
+ def test_get_dedicated_host_group_value_error_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_group_value_error.
_service.enable_retries()
- self.test_get_instance_value_error()
+ self.test_get_dedicated_host_group_value_error()
- # Disable retries and run test_get_instance_value_error.
+ # Disable retries and run test_get_dedicated_host_group_value_error.
_service.disable_retries()
- self.test_get_instance_value_error()
+ self.test_get_dedicated_host_group_value_error()
-class TestUpdateInstance:
+class TestUpdateDedicatedHostGroup:
"""
- Test Class for update_instance
+ Test Class for update_dedicated_host_group
"""
@responses.activate
- def test_update_instance_all_params(self):
+ def test_update_dedicated_host_group_all_params(self):
"""
- update_instance()
+ update_dedicated_host_group()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/dedicated_host/groups/testString')
+ mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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,
@@ -10424,55 +9457,18 @@ def test_update_instance_all_params(self):
status=200,
)
- # Construct a dict representation of a InstanceAvailabilityPolicyPatch model
- instance_availability_policy_patch_model = {}
- instance_availability_policy_patch_model['host_failure'] = 'restart'
-
- # Construct a dict representation of a InstanceMetadataServicePatch model
- instance_metadata_service_patch_model = {}
- instance_metadata_service_patch_model['enabled'] = True
- instance_metadata_service_patch_model['protocol'] = 'http'
- instance_metadata_service_patch_model['response_hop_limit'] = 1
-
- # Construct a dict representation of a InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_patch_model = {}
- instance_placement_target_patch_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
-
- # Construct a dict representation of a InstancePatchProfileInstanceProfileIdentityByName model
- instance_patch_profile_model = {}
- instance_patch_profile_model['name'] = 'bx2-4x16'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a InstanceReservationAffinityPatch model
- instance_reservation_affinity_patch_model = {}
- instance_reservation_affinity_patch_model['policy'] = 'automatic'
- instance_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a InstancePatch model
- instance_patch_model = {}
- instance_patch_model['availability_policy'] = instance_availability_policy_patch_model
- instance_patch_model['confidential_compute_mode'] = 'disabled'
- instance_patch_model['enable_secure_boot'] = True
- instance_patch_model['metadata_service'] = instance_metadata_service_patch_model
- instance_patch_model['name'] = 'my-instance'
- instance_patch_model['placement_target'] = instance_placement_target_patch_model
- instance_patch_model['profile'] = instance_patch_profile_model
- instance_patch_model['reservation_affinity'] = instance_reservation_affinity_patch_model
- instance_patch_model['total_volume_bandwidth'] = 500
+ # Construct a dict representation of a DedicatedHostGroupPatch model
+ dedicated_host_group_patch_model = {}
+ dedicated_host_group_patch_model['name'] = 'my-dedicated-host-group-updated'
# Set up parameter values
id = 'testString'
- instance_patch = instance_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ dedicated_host_group_patch = dedicated_host_group_patch_model
# Invoke method
- response = _service.update_instance(
+ response = _service.update_dedicated_host_group(
id,
- instance_patch,
- if_match=if_match,
+ dedicated_host_group_patch,
headers={},
)
@@ -10481,25 +9477,25 @@ def test_update_instance_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 == instance_patch
+ assert req_body == dedicated_host_group_patch
- def test_update_instance_all_params_with_retries(self):
- # Enable retries and run test_update_instance_all_params.
+ def test_update_dedicated_host_group_all_params_with_retries(self):
+ # Enable retries and run test_update_dedicated_host_group_all_params.
_service.enable_retries()
- self.test_update_instance_all_params()
+ self.test_update_dedicated_host_group_all_params()
- # Disable retries and run test_update_instance_all_params.
+ # Disable retries and run test_update_dedicated_host_group_all_params.
_service.disable_retries()
- self.test_update_instance_all_params()
+ self.test_update_dedicated_host_group_all_params()
@responses.activate
- def test_update_instance_required_params(self):
+ def test_update_dedicated_host_group_value_error(self):
"""
- test_update_instance_required_params()
+ test_update_dedicated_host_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/dedicated_host/groups/testString')
+ mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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,
@@ -10508,164 +9504,92 @@ def test_update_instance_required_params(self):
status=200,
)
- # Construct a dict representation of a InstanceAvailabilityPolicyPatch model
- instance_availability_policy_patch_model = {}
- instance_availability_policy_patch_model['host_failure'] = 'restart'
-
- # Construct a dict representation of a InstanceMetadataServicePatch model
- instance_metadata_service_patch_model = {}
- instance_metadata_service_patch_model['enabled'] = True
- instance_metadata_service_patch_model['protocol'] = 'http'
- instance_metadata_service_patch_model['response_hop_limit'] = 1
-
- # Construct a dict representation of a InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_patch_model = {}
- instance_placement_target_patch_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
-
- # Construct a dict representation of a InstancePatchProfileInstanceProfileIdentityByName model
- instance_patch_profile_model = {}
- instance_patch_profile_model['name'] = 'bx2-4x16'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a InstanceReservationAffinityPatch model
- instance_reservation_affinity_patch_model = {}
- instance_reservation_affinity_patch_model['policy'] = 'automatic'
- instance_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a InstancePatch model
- instance_patch_model = {}
- instance_patch_model['availability_policy'] = instance_availability_policy_patch_model
- instance_patch_model['confidential_compute_mode'] = 'disabled'
- instance_patch_model['enable_secure_boot'] = True
- instance_patch_model['metadata_service'] = instance_metadata_service_patch_model
- instance_patch_model['name'] = 'my-instance'
- instance_patch_model['placement_target'] = instance_placement_target_patch_model
- instance_patch_model['profile'] = instance_patch_profile_model
- instance_patch_model['reservation_affinity'] = instance_reservation_affinity_patch_model
- instance_patch_model['total_volume_bandwidth'] = 500
+ # Construct a dict representation of a DedicatedHostGroupPatch model
+ dedicated_host_group_patch_model = {}
+ dedicated_host_group_patch_model['name'] = 'my-dedicated-host-group-updated'
# Set up parameter values
id = 'testString'
- instance_patch = instance_patch_model
-
- # Invoke method
- response = _service.update_instance(
- id,
- instance_patch,
- headers={},
- )
+ dedicated_host_group_patch = dedicated_host_group_patch_model
- # 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 == instance_patch
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "dedicated_host_group_patch": dedicated_host_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_dedicated_host_group(**req_copy)
- def test_update_instance_required_params_with_retries(self):
- # Enable retries and run test_update_instance_required_params.
+ def test_update_dedicated_host_group_value_error_with_retries(self):
+ # Enable retries and run test_update_dedicated_host_group_value_error.
_service.enable_retries()
- self.test_update_instance_required_params()
+ self.test_update_dedicated_host_group_value_error()
- # Disable retries and run test_update_instance_required_params.
+ # Disable retries and run test_update_dedicated_host_group_value_error.
_service.disable_retries()
- self.test_update_instance_required_params()
+ self.test_update_dedicated_host_group_value_error()
+
+
+class TestListDedicatedHostProfiles:
+ """
+ Test Class for list_dedicated_host_profiles
+ """
@responses.activate
- def test_update_instance_value_error(self):
+ def test_list_dedicated_host_profiles_all_params(self):
"""
- test_update_instance_value_error()
+ list_dedicated_host_profiles()
"""
# Set up mock
- url = preprocess_url('/instances/testString')
- mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/dedicated_host/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceAvailabilityPolicyPatch model
- instance_availability_policy_patch_model = {}
- instance_availability_policy_patch_model['host_failure'] = 'restart'
-
- # Construct a dict representation of a InstanceMetadataServicePatch model
- instance_metadata_service_patch_model = {}
- instance_metadata_service_patch_model['enabled'] = True
- instance_metadata_service_patch_model['protocol'] = 'http'
- instance_metadata_service_patch_model['response_hop_limit'] = 1
-
- # Construct a dict representation of a InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityById model
- instance_placement_target_patch_model = {}
- instance_placement_target_patch_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
-
- # Construct a dict representation of a InstancePatchProfileInstanceProfileIdentityByName model
- instance_patch_profile_model = {}
- instance_patch_profile_model['name'] = 'bx2-4x16'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a InstanceReservationAffinityPatch model
- instance_reservation_affinity_patch_model = {}
- instance_reservation_affinity_patch_model['policy'] = 'automatic'
- instance_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a InstancePatch model
- instance_patch_model = {}
- instance_patch_model['availability_policy'] = instance_availability_policy_patch_model
- instance_patch_model['confidential_compute_mode'] = 'disabled'
- instance_patch_model['enable_secure_boot'] = True
- instance_patch_model['metadata_service'] = instance_metadata_service_patch_model
- instance_patch_model['name'] = 'my-instance'
- instance_patch_model['placement_target'] = instance_placement_target_patch_model
- instance_patch_model['profile'] = instance_patch_profile_model
- instance_patch_model['reservation_affinity'] = instance_reservation_affinity_patch_model
- instance_patch_model['total_volume_bandwidth'] = 500
-
# Set up parameter values
- id = 'testString'
- instance_patch = instance_patch_model
+ start = 'testString'
+ limit = 50
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "instance_patch": instance_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_instance(**req_copy)
+ # Invoke method
+ response = _service.list_dedicated_host_profiles(
+ start=start,
+ limit=limit,
+ headers={},
+ )
- def test_update_instance_value_error_with_retries(self):
- # Enable retries and run test_update_instance_value_error.
+ # 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_dedicated_host_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_profiles_all_params.
_service.enable_retries()
- self.test_update_instance_value_error()
+ self.test_list_dedicated_host_profiles_all_params()
- # Disable retries and run test_update_instance_value_error.
+ # Disable retries and run test_list_dedicated_host_profiles_all_params.
_service.disable_retries()
- self.test_update_instance_value_error()
-
-
-class TestGetInstanceInitialization:
- """
- Test Class for get_instance_initialization
- """
+ self.test_list_dedicated_host_profiles_all_params()
@responses.activate
- def test_get_instance_initialization_all_params(self):
+ def test_list_dedicated_host_profiles_required_params(self):
"""
- get_instance_initialization()
+ test_list_dedicated_host_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/instances/testString/initialization')
- mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}'
+ url = preprocess_url('/dedicated_host/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -10674,36 +9598,30 @@ def test_get_instance_initialization_all_params(self):
status=200,
)
- # Set up parameter values
- id = 'testString'
-
# Invoke method
- response = _service.get_instance_initialization(
- id,
- headers={},
- )
+ response = _service.list_dedicated_host_profiles()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_initialization_all_params_with_retries(self):
- # Enable retries and run test_get_instance_initialization_all_params.
+ def test_list_dedicated_host_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_profiles_required_params.
_service.enable_retries()
- self.test_get_instance_initialization_all_params()
+ self.test_list_dedicated_host_profiles_required_params()
- # Disable retries and run test_get_instance_initialization_all_params.
+ # Disable retries and run test_list_dedicated_host_profiles_required_params.
_service.disable_retries()
- self.test_get_instance_initialization_all_params()
+ self.test_list_dedicated_host_profiles_required_params()
@responses.activate
- def test_get_instance_initialization_value_error(self):
+ def test_list_dedicated_host_profiles_value_error(self):
"""
- test_get_instance_initialization_value_error()
+ test_list_dedicated_host_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/initialization')
- mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}'
+ url = preprocess_url('/dedicated_host/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -10712,133 +9630,187 @@ def test_get_instance_initialization_value_error(self):
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_instance_initialization(**req_copy)
+ _service.list_dedicated_host_profiles(**req_copy)
- def test_get_instance_initialization_value_error_with_retries(self):
- # Enable retries and run test_get_instance_initialization_value_error.
+ def test_list_dedicated_host_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_profiles_value_error.
_service.enable_retries()
- self.test_get_instance_initialization_value_error()
+ self.test_list_dedicated_host_profiles_value_error()
- # Disable retries and run test_get_instance_initialization_value_error.
+ # Disable retries and run test_list_dedicated_host_profiles_value_error.
_service.disable_retries()
- self.test_get_instance_initialization_value_error()
+ self.test_list_dedicated_host_profiles_value_error()
+ @responses.activate
+ def test_list_dedicated_host_profiles_with_pager_get_next(self):
+ """
+ test_list_dedicated_host_profiles_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/dedicated_host/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestCreateInstanceAction:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = DedicatedHostProfilesPager(
+ client=_service,
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_dedicated_host_profiles_with_pager_get_all(self):
+ """
+ test_list_dedicated_host_profiles_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/dedicated_host/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = DedicatedHostProfilesPager(
+ client=_service,
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestGetDedicatedHostProfile:
"""
- Test Class for create_instance_action
+ Test Class for get_dedicated_host_profile
"""
@responses.activate
- def test_create_instance_action_all_params(self):
+ def test_get_dedicated_host_profile_all_params(self):
"""
- create_instance_action()
+ get_dedicated_host_profile()
"""
# Set up mock
- url = preprocess_url('/instances/testString/actions')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}'
+ url = preprocess_url('/dedicated_host/profiles/mx2-host-152x1216')
+ mock_response = '{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- type = 'reboot'
- force = True
+ name = 'mx2-host-152x1216'
# Invoke method
- response = _service.create_instance_action(
- instance_id,
- type,
- force=force,
+ response = _service.get_dedicated_host_profile(
+ name,
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['type'] == 'reboot'
- assert req_body['force'] == True
+ assert response.status_code == 200
- def test_create_instance_action_all_params_with_retries(self):
- # Enable retries and run test_create_instance_action_all_params.
+ def test_get_dedicated_host_profile_all_params_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_profile_all_params.
_service.enable_retries()
- self.test_create_instance_action_all_params()
+ self.test_get_dedicated_host_profile_all_params()
- # Disable retries and run test_create_instance_action_all_params.
+ # Disable retries and run test_get_dedicated_host_profile_all_params.
_service.disable_retries()
- self.test_create_instance_action_all_params()
+ self.test_get_dedicated_host_profile_all_params()
@responses.activate
- def test_create_instance_action_value_error(self):
+ def test_get_dedicated_host_profile_value_error(self):
"""
- test_create_instance_action_value_error()
+ test_get_dedicated_host_profile_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/actions')
- mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}'
+ url = preprocess_url('/dedicated_host/profiles/mx2-host-152x1216')
+ mock_response = '{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- type = 'reboot'
- force = True
+ name = 'mx2-host-152x1216'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "type": type,
+ "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.create_instance_action(**req_copy)
+ _service.get_dedicated_host_profile(**req_copy)
- def test_create_instance_action_value_error_with_retries(self):
- # Enable retries and run test_create_instance_action_value_error.
+ def test_get_dedicated_host_profile_value_error_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_profile_value_error.
_service.enable_retries()
- self.test_create_instance_action_value_error()
+ self.test_get_dedicated_host_profile_value_error()
- # Disable retries and run test_create_instance_action_value_error.
+ # Disable retries and run test_get_dedicated_host_profile_value_error.
_service.disable_retries()
- self.test_create_instance_action_value_error()
+ self.test_get_dedicated_host_profile_value_error()
-class TestListInstanceClusterNetworkAttachments:
+class TestListDedicatedHosts:
"""
- Test Class for list_instance_cluster_network_attachments
+ Test Class for list_dedicated_hosts
"""
@responses.activate
- def test_list_instance_cluster_network_attachments_all_params(self):
+ def test_list_dedicated_hosts_all_params(self):
"""
- list_instance_cluster_network_attachments()
+ list_dedicated_hosts()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response = '{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response = '{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -10848,15 +9820,21 @@ def test_list_instance_cluster_network_attachments_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
+ dedicated_host_group_id = 'testString'
start = 'testString'
limit = 50
+ resource_group_id = 'testString'
+ zone_name = 'us-south-1'
+ name = 'my-name'
# Invoke method
- response = _service.list_instance_cluster_network_attachments(
- instance_id,
+ response = _service.list_dedicated_hosts(
+ dedicated_host_group_id=dedicated_host_group_id,
start=start,
limit=limit,
+ resource_group_id=resource_group_id,
+ zone_name=zone_name,
+ name=name,
headers={},
)
@@ -10866,26 +9844,30 @@ def test_list_instance_cluster_network_attachments_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 'dedicated_host_group.id={}'.format(dedicated_host_group_id) 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 'zone.name={}'.format(zone_name) in query_string
+ assert 'name={}'.format(name) in query_string
- def test_list_instance_cluster_network_attachments_all_params_with_retries(self):
- # Enable retries and run test_list_instance_cluster_network_attachments_all_params.
+ def test_list_dedicated_hosts_all_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_hosts_all_params.
_service.enable_retries()
- self.test_list_instance_cluster_network_attachments_all_params()
+ self.test_list_dedicated_hosts_all_params()
- # Disable retries and run test_list_instance_cluster_network_attachments_all_params.
+ # Disable retries and run test_list_dedicated_hosts_all_params.
_service.disable_retries()
- self.test_list_instance_cluster_network_attachments_all_params()
+ self.test_list_dedicated_hosts_all_params()
@responses.activate
- def test_list_instance_cluster_network_attachments_required_params(self):
+ def test_list_dedicated_hosts_required_params(self):
"""
- test_list_instance_cluster_network_attachments_required_params()
+ test_list_dedicated_hosts_required_params()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response = '{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response = '{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -10894,36 +9876,30 @@ def test_list_instance_cluster_network_attachments_required_params(self):
status=200,
)
- # Set up parameter values
- instance_id = 'testString'
-
# Invoke method
- response = _service.list_instance_cluster_network_attachments(
- instance_id,
- headers={},
- )
+ response = _service.list_dedicated_hosts()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_cluster_network_attachments_required_params_with_retries(self):
- # Enable retries and run test_list_instance_cluster_network_attachments_required_params.
+ def test_list_dedicated_hosts_required_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_hosts_required_params.
_service.enable_retries()
- self.test_list_instance_cluster_network_attachments_required_params()
+ self.test_list_dedicated_hosts_required_params()
- # Disable retries and run test_list_instance_cluster_network_attachments_required_params.
+ # Disable retries and run test_list_dedicated_hosts_required_params.
_service.disable_retries()
- self.test_list_instance_cluster_network_attachments_required_params()
+ self.test_list_dedicated_hosts_required_params()
@responses.activate
- def test_list_instance_cluster_network_attachments_value_error(self):
+ def test_list_dedicated_hosts_value_error(self):
"""
- test_list_instance_cluster_network_attachments_value_error()
+ test_list_dedicated_hosts_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response = '{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response = '{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -10932,36 +9908,32 @@ def test_list_instance_cluster_network_attachments_value_error(self):
status=200,
)
- # Set up parameter values
- instance_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_cluster_network_attachments(**req_copy)
+ _service.list_dedicated_hosts(**req_copy)
- def test_list_instance_cluster_network_attachments_value_error_with_retries(self):
- # Enable retries and run test_list_instance_cluster_network_attachments_value_error.
+ def test_list_dedicated_hosts_value_error_with_retries(self):
+ # Enable retries and run test_list_dedicated_hosts_value_error.
_service.enable_retries()
- self.test_list_instance_cluster_network_attachments_value_error()
+ self.test_list_dedicated_hosts_value_error()
- # Disable retries and run test_list_instance_cluster_network_attachments_value_error.
+ # Disable retries and run test_list_dedicated_hosts_value_error.
_service.disable_retries()
- self.test_list_instance_cluster_network_attachments_value_error()
+ self.test_list_dedicated_hosts_value_error()
@responses.activate
- def test_list_instance_cluster_network_attachments_with_pager_get_next(self):
+ def test_list_dedicated_hosts_with_pager_get_next(self):
"""
- test_list_instance_cluster_network_attachments_with_pager_get_next()
+ test_list_dedicated_hosts_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
- mock_response2 = '{"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -10979,10 +9951,13 @@ def test_list_instance_cluster_network_attachments_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = InstanceClusterNetworkAttachmentsPager(
+ pager = DedicatedHostsPager(
client=_service,
- instance_id='testString',
+ dedicated_host_group_id='testString',
limit=10,
+ resource_group_id='testString',
+ zone_name='us-south-1',
+ name='my-name',
)
while pager.has_next():
next_page = pager.get_next()
@@ -10991,14 +9966,14 @@ def test_list_instance_cluster_network_attachments_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_instance_cluster_network_attachments_with_pager_get_all(self):
+ def test_list_dedicated_hosts_with_pager_get_all(self):
"""
- test_list_instance_cluster_network_attachments_with_pager_get_all()
+ test_list_dedicated_hosts_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
- mock_response2 = '{"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -11015,29 +9990,32 @@ def test_list_instance_cluster_network_attachments_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = InstanceClusterNetworkAttachmentsPager(
+ pager = DedicatedHostsPager(
client=_service,
- instance_id='testString',
+ dedicated_host_group_id='testString',
limit=10,
+ resource_group_id='testString',
+ zone_name='us-south-1',
+ name='my-name',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateClusterNetworkAttachment:
+class TestCreateDedicatedHost:
"""
- Test Class for create_cluster_network_attachment
+ Test Class for create_dedicated_host
"""
@responses.activate
- def test_create_cluster_network_attachment_all_params(self):
+ def test_create_dedicated_host_all_params(self):
"""
- create_cluster_network_attachment()
+ create_dedicated_host()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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,
@@ -11046,39 +10024,32 @@ def test_create_cluster_network_attachment_all_params(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+ # Construct a dict representation of a DedicatedHostProfileIdentityByName model
+ dedicated_host_profile_identity_model = {}
+ dedicated_host_profile_identity_model['name'] = 'mx2-host-152x1216'
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+ # Construct a dict representation of a DedicatedHostGroupIdentityById model
+ dedicated_host_group_identity_model = {}
+ dedicated_host_group_identity_model['id'] = '0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0'
- # Construct a dict representation of a InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityById model
- instance_cluster_network_attachment_before_prototype_model = {}
- instance_cluster_network_attachment_before_prototype_model['id'] = '0717-fb880975-db45-4459-8548-64e3995ac213'
+ # Construct a dict representation of a DedicatedHostPrototypeDedicatedHostByGroup model
+ dedicated_host_prototype_model = {}
+ dedicated_host_prototype_model['instance_placement_enabled'] = True
+ dedicated_host_prototype_model['name'] = 'my-host'
+ dedicated_host_prototype_model['profile'] = dedicated_host_profile_identity_model
+ dedicated_host_prototype_model['resource_group'] = resource_group_identity_model
+ dedicated_host_prototype_model['group'] = dedicated_host_group_identity_model
# Set up parameter values
- instance_id = 'testString'
- cluster_network_interface = instance_cluster_network_attachment_prototype_cluster_network_interface_model
- before = instance_cluster_network_attachment_before_prototype_model
- name = 'my-instance-network-attachment'
+ dedicated_host_prototype = dedicated_host_prototype_model
# Invoke method
- response = _service.create_cluster_network_attachment(
- instance_id,
- cluster_network_interface,
- before=before,
- name=name,
+ response = _service.create_dedicated_host(
+ dedicated_host_prototype,
headers={},
)
@@ -11087,27 +10058,25 @@ def test_create_cluster_network_attachment_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['cluster_network_interface'] == instance_cluster_network_attachment_prototype_cluster_network_interface_model
- assert req_body['before'] == instance_cluster_network_attachment_before_prototype_model
- assert req_body['name'] == 'my-instance-network-attachment'
+ assert req_body == dedicated_host_prototype
- def test_create_cluster_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_create_cluster_network_attachment_all_params.
+ def test_create_dedicated_host_all_params_with_retries(self):
+ # Enable retries and run test_create_dedicated_host_all_params.
_service.enable_retries()
- self.test_create_cluster_network_attachment_all_params()
+ self.test_create_dedicated_host_all_params()
- # Disable retries and run test_create_cluster_network_attachment_all_params.
+ # Disable retries and run test_create_dedicated_host_all_params.
_service.disable_retries()
- self.test_create_cluster_network_attachment_all_params()
+ self.test_create_dedicated_host_all_params()
@responses.activate
- def test_create_cluster_network_attachment_value_error(self):
+ def test_create_dedicated_host_value_error(self):
"""
- test_create_cluster_network_attachment_value_error()
+ test_create_dedicated_host_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts')
+ mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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,
@@ -11116,151 +10085,142 @@ def test_create_cluster_network_attachment_value_error(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+ # Construct a dict representation of a DedicatedHostProfileIdentityByName model
+ dedicated_host_profile_identity_model = {}
+ dedicated_host_profile_identity_model['name'] = 'mx2-host-152x1216'
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
- instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+ # Construct a dict representation of a DedicatedHostGroupIdentityById model
+ dedicated_host_group_identity_model = {}
+ dedicated_host_group_identity_model['id'] = '0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0'
- # Construct a dict representation of a InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityById model
- instance_cluster_network_attachment_before_prototype_model = {}
- instance_cluster_network_attachment_before_prototype_model['id'] = '0717-fb880975-db45-4459-8548-64e3995ac213'
+ # Construct a dict representation of a DedicatedHostPrototypeDedicatedHostByGroup model
+ dedicated_host_prototype_model = {}
+ dedicated_host_prototype_model['instance_placement_enabled'] = True
+ dedicated_host_prototype_model['name'] = 'my-host'
+ dedicated_host_prototype_model['profile'] = dedicated_host_profile_identity_model
+ dedicated_host_prototype_model['resource_group'] = resource_group_identity_model
+ dedicated_host_prototype_model['group'] = dedicated_host_group_identity_model
# Set up parameter values
- instance_id = 'testString'
- cluster_network_interface = instance_cluster_network_attachment_prototype_cluster_network_interface_model
- before = instance_cluster_network_attachment_before_prototype_model
- name = 'my-instance-network-attachment'
+ dedicated_host_prototype = dedicated_host_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "cluster_network_interface": cluster_network_interface,
+ "dedicated_host_prototype": dedicated_host_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_cluster_network_attachment(**req_copy)
+ _service.create_dedicated_host(**req_copy)
- def test_create_cluster_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_create_cluster_network_attachment_value_error.
+ def test_create_dedicated_host_value_error_with_retries(self):
+ # Enable retries and run test_create_dedicated_host_value_error.
_service.enable_retries()
- self.test_create_cluster_network_attachment_value_error()
+ self.test_create_dedicated_host_value_error()
- # Disable retries and run test_create_cluster_network_attachment_value_error.
+ # Disable retries and run test_create_dedicated_host_value_error.
_service.disable_retries()
- self.test_create_cluster_network_attachment_value_error()
+ self.test_create_dedicated_host_value_error()
-class TestDeleteInstanceClusterNetworkAttachment:
+class TestListDedicatedHostDisks:
"""
- Test Class for delete_instance_cluster_network_attachment
+ Test Class for list_dedicated_host_disks
"""
@responses.activate
- def test_delete_instance_cluster_network_attachment_all_params(self):
+ def test_list_dedicated_host_disks_all_params(self):
"""
- delete_instance_cluster_network_attachment()
+ list_dedicated_host_disks()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts/testString/disks')
+ mock_response = '{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ dedicated_host_id = 'testString'
# Invoke method
- response = _service.delete_instance_cluster_network_attachment(
- instance_id,
- id,
+ response = _service.list_dedicated_host_disks(
+ dedicated_host_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_instance_cluster_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_cluster_network_attachment_all_params.
+ def test_list_dedicated_host_disks_all_params_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_disks_all_params.
_service.enable_retries()
- self.test_delete_instance_cluster_network_attachment_all_params()
+ self.test_list_dedicated_host_disks_all_params()
- # Disable retries and run test_delete_instance_cluster_network_attachment_all_params.
+ # Disable retries and run test_list_dedicated_host_disks_all_params.
_service.disable_retries()
- self.test_delete_instance_cluster_network_attachment_all_params()
+ self.test_list_dedicated_host_disks_all_params()
@responses.activate
- def test_delete_instance_cluster_network_attachment_value_error(self):
+ def test_list_dedicated_host_disks_value_error(self):
"""
- test_delete_instance_cluster_network_attachment_value_error()
+ test_list_dedicated_host_disks_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts/testString/disks')
+ mock_response = '{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ dedicated_host_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "id": id,
+ "dedicated_host_id": dedicated_host_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_instance_cluster_network_attachment(**req_copy)
+ _service.list_dedicated_host_disks(**req_copy)
- def test_delete_instance_cluster_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_cluster_network_attachment_value_error.
+ def test_list_dedicated_host_disks_value_error_with_retries(self):
+ # Enable retries and run test_list_dedicated_host_disks_value_error.
_service.enable_retries()
- self.test_delete_instance_cluster_network_attachment_value_error()
+ self.test_list_dedicated_host_disks_value_error()
- # Disable retries and run test_delete_instance_cluster_network_attachment_value_error.
+ # Disable retries and run test_list_dedicated_host_disks_value_error.
_service.disable_retries()
- self.test_delete_instance_cluster_network_attachment_value_error()
+ self.test_list_dedicated_host_disks_value_error()
-class TestGetInstanceClusterNetworkAttachment:
+class TestGetDedicatedHostDisk:
"""
- Test Class for get_instance_cluster_network_attachment
+ Test Class for get_dedicated_host_disk
"""
@responses.activate
- def test_get_instance_cluster_network_attachment_all_params(self):
+ def test_get_dedicated_host_disk_all_params(self):
"""
- get_instance_cluster_network_attachment()
+ get_dedicated_host_disk()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts/testString/disks/testString')
+ mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
responses.add(
responses.GET,
url,
@@ -11270,12 +10230,12 @@ def test_get_instance_cluster_network_attachment_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
+ dedicated_host_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_instance_cluster_network_attachment(
- instance_id,
+ response = _service.get_dedicated_host_disk(
+ dedicated_host_id,
id,
headers={},
)
@@ -11284,23 +10244,23 @@ def test_get_instance_cluster_network_attachment_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_cluster_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_get_instance_cluster_network_attachment_all_params.
+ def test_get_dedicated_host_disk_all_params_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_disk_all_params.
_service.enable_retries()
- self.test_get_instance_cluster_network_attachment_all_params()
+ self.test_get_dedicated_host_disk_all_params()
- # Disable retries and run test_get_instance_cluster_network_attachment_all_params.
+ # Disable retries and run test_get_dedicated_host_disk_all_params.
_service.disable_retries()
- self.test_get_instance_cluster_network_attachment_all_params()
+ self.test_get_dedicated_host_disk_all_params()
@responses.activate
- def test_get_instance_cluster_network_attachment_value_error(self):
+ def test_get_dedicated_host_disk_value_error(self):
"""
- test_get_instance_cluster_network_attachment_value_error()
+ test_get_dedicated_host_disk_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts/testString/disks/testString')
+ mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
responses.add(
responses.GET,
url,
@@ -11310,42 +10270,42 @@ def test_get_instance_cluster_network_attachment_value_error(self):
)
# Set up parameter values
- instance_id = 'testString'
+ dedicated_host_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
+ "dedicated_host_id": dedicated_host_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_instance_cluster_network_attachment(**req_copy)
+ _service.get_dedicated_host_disk(**req_copy)
- def test_get_instance_cluster_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_get_instance_cluster_network_attachment_value_error.
+ def test_get_dedicated_host_disk_value_error_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_disk_value_error.
_service.enable_retries()
- self.test_get_instance_cluster_network_attachment_value_error()
+ self.test_get_dedicated_host_disk_value_error()
- # Disable retries and run test_get_instance_cluster_network_attachment_value_error.
+ # Disable retries and run test_get_dedicated_host_disk_value_error.
_service.disable_retries()
- self.test_get_instance_cluster_network_attachment_value_error()
+ self.test_get_dedicated_host_disk_value_error()
-class TestUpdateInstanceClusterNetworkAttachment:
+class TestUpdateDedicatedHostDisk:
"""
- Test Class for update_instance_cluster_network_attachment
+ Test Class for update_dedicated_host_disk
"""
@responses.activate
- def test_update_instance_cluster_network_attachment_all_params(self):
+ def test_update_dedicated_host_disk_all_params(self):
"""
- update_instance_cluster_network_attachment()
+ update_dedicated_host_disk()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts/testString/disks/testString')
+ mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
responses.add(
responses.PATCH,
url,
@@ -11354,20 +10314,20 @@ def test_update_instance_cluster_network_attachment_all_params(self):
status=200,
)
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPatch model
- instance_cluster_network_attachment_patch_model = {}
- instance_cluster_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
+ # Construct a dict representation of a DedicatedHostDiskPatch model
+ dedicated_host_disk_patch_model = {}
+ dedicated_host_disk_patch_model['name'] = 'my-dedicated-host-disk-updated'
# Set up parameter values
- instance_id = 'testString'
+ dedicated_host_id = 'testString'
id = 'testString'
- instance_cluster_network_attachment_patch = instance_cluster_network_attachment_patch_model
+ dedicated_host_disk_patch = dedicated_host_disk_patch_model
# Invoke method
- response = _service.update_instance_cluster_network_attachment(
- instance_id,
+ response = _service.update_dedicated_host_disk(
+ dedicated_host_id,
id,
- instance_cluster_network_attachment_patch,
+ dedicated_host_disk_patch,
headers={},
)
@@ -11376,25 +10336,25 @@ def test_update_instance_cluster_network_attachment_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 == instance_cluster_network_attachment_patch
+ assert req_body == dedicated_host_disk_patch
- def test_update_instance_cluster_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_update_instance_cluster_network_attachment_all_params.
+ def test_update_dedicated_host_disk_all_params_with_retries(self):
+ # Enable retries and run test_update_dedicated_host_disk_all_params.
_service.enable_retries()
- self.test_update_instance_cluster_network_attachment_all_params()
+ self.test_update_dedicated_host_disk_all_params()
- # Disable retries and run test_update_instance_cluster_network_attachment_all_params.
+ # Disable retries and run test_update_dedicated_host_disk_all_params.
_service.disable_retries()
- self.test_update_instance_cluster_network_attachment_all_params()
+ self.test_update_dedicated_host_disk_all_params()
@responses.activate
- def test_update_instance_cluster_network_attachment_value_error(self):
+ def test_update_dedicated_host_disk_value_error(self):
"""
- test_update_instance_cluster_network_attachment_value_error()
+ test_update_dedicated_host_disk_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
- mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
+ url = preprocess_url('/dedicated_hosts/testString/disks/testString')
+ mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
responses.add(
responses.PATCH,
url,
@@ -11403,141 +10363,124 @@ def test_update_instance_cluster_network_attachment_value_error(self):
status=200,
)
- # Construct a dict representation of a InstanceClusterNetworkAttachmentPatch model
- instance_cluster_network_attachment_patch_model = {}
- instance_cluster_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
+ # Construct a dict representation of a DedicatedHostDiskPatch model
+ dedicated_host_disk_patch_model = {}
+ dedicated_host_disk_patch_model['name'] = 'my-dedicated-host-disk-updated'
# Set up parameter values
- instance_id = 'testString'
+ dedicated_host_id = 'testString'
id = 'testString'
- instance_cluster_network_attachment_patch = instance_cluster_network_attachment_patch_model
+ dedicated_host_disk_patch = dedicated_host_disk_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
+ "dedicated_host_id": dedicated_host_id,
"id": id,
- "instance_cluster_network_attachment_patch": instance_cluster_network_attachment_patch,
+ "dedicated_host_disk_patch": dedicated_host_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_instance_cluster_network_attachment(**req_copy)
+ _service.update_dedicated_host_disk(**req_copy)
- def test_update_instance_cluster_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_update_instance_cluster_network_attachment_value_error.
+ def test_update_dedicated_host_disk_value_error_with_retries(self):
+ # Enable retries and run test_update_dedicated_host_disk_value_error.
_service.enable_retries()
- self.test_update_instance_cluster_network_attachment_value_error()
+ self.test_update_dedicated_host_disk_value_error()
- # Disable retries and run test_update_instance_cluster_network_attachment_value_error.
+ # Disable retries and run test_update_dedicated_host_disk_value_error.
_service.disable_retries()
- self.test_update_instance_cluster_network_attachment_value_error()
+ self.test_update_dedicated_host_disk_value_error()
-class TestCreateInstanceConsoleAccessToken:
+class TestDeleteDedicatedHost:
"""
- Test Class for create_instance_console_access_token
+ Test Class for delete_dedicated_host
"""
@responses.activate
- def test_create_instance_console_access_token_all_params(self):
+ def test_delete_dedicated_host_all_params(self):
"""
- create_instance_console_access_token()
+ delete_dedicated_host()
"""
# Set up mock
- url = preprocess_url('/instances/testString/console_access_token')
- mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
+ url = preprocess_url('/dedicated_hosts/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- instance_id = 'testString'
- console_type = 'serial'
- force = False
+ id = 'testString'
# Invoke method
- response = _service.create_instance_console_access_token(
- instance_id,
- console_type,
- force=force,
+ response = _service.delete_dedicated_host(
+ 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 == 204
- def test_create_instance_console_access_token_all_params_with_retries(self):
- # Enable retries and run test_create_instance_console_access_token_all_params.
+ def test_delete_dedicated_host_all_params_with_retries(self):
+ # Enable retries and run test_delete_dedicated_host_all_params.
_service.enable_retries()
- self.test_create_instance_console_access_token_all_params()
+ self.test_delete_dedicated_host_all_params()
- # Disable retries and run test_create_instance_console_access_token_all_params.
+ # Disable retries and run test_delete_dedicated_host_all_params.
_service.disable_retries()
- self.test_create_instance_console_access_token_all_params()
+ self.test_delete_dedicated_host_all_params()
@responses.activate
- def test_create_instance_console_access_token_value_error(self):
+ def test_delete_dedicated_host_value_error(self):
"""
- test_create_instance_console_access_token_value_error()
+ test_delete_dedicated_host_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/console_access_token')
- mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
+ url = preprocess_url('/dedicated_hosts/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- instance_id = 'testString'
- console_type = 'serial'
- force = False
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_console_access_token(**req_copy)
+ _service.delete_dedicated_host(**req_copy)
- def test_create_instance_console_access_token_value_error_with_retries(self):
- # Enable retries and run test_create_instance_console_access_token_value_error.
+ def test_delete_dedicated_host_value_error_with_retries(self):
+ # Enable retries and run test_delete_dedicated_host_value_error.
_service.enable_retries()
- self.test_create_instance_console_access_token_value_error()
+ self.test_delete_dedicated_host_value_error()
- # Disable retries and run test_create_instance_console_access_token_value_error.
+ # Disable retries and run test_delete_dedicated_host_value_error.
_service.disable_retries()
- self.test_create_instance_console_access_token_value_error()
+ self.test_delete_dedicated_host_value_error()
-class TestListInstanceDisks:
+class TestGetDedicatedHost:
"""
- Test Class for list_instance_disks
+ Test Class for get_dedicated_host
"""
@responses.activate
- def test_list_instance_disks_all_params(self):
+ def test_get_dedicated_host_all_params(self):
"""
- list_instance_disks()
+ get_dedicated_host()
"""
# Set up mock
- url = preprocess_url('/instances/testString/disks')
- mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}'
+ url = preprocess_url('/dedicated_hosts/testString')
+ mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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,
@@ -11547,11 +10490,11 @@ def test_list_instance_disks_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_instance_disks(
- instance_id,
+ response = _service.get_dedicated_host(
+ id,
headers={},
)
@@ -11559,23 +10502,23 @@ def test_list_instance_disks_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_disks_all_params_with_retries(self):
- # Enable retries and run test_list_instance_disks_all_params.
+ def test_get_dedicated_host_all_params_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_all_params.
_service.enable_retries()
- self.test_list_instance_disks_all_params()
+ self.test_get_dedicated_host_all_params()
- # Disable retries and run test_list_instance_disks_all_params.
+ # Disable retries and run test_get_dedicated_host_all_params.
_service.disable_retries()
- self.test_list_instance_disks_all_params()
+ self.test_get_dedicated_host_all_params()
@responses.activate
- def test_list_instance_disks_value_error(self):
+ def test_get_dedicated_host_value_error(self):
"""
- test_list_instance_disks_value_error()
+ test_get_dedicated_host_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/disks')
- mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}'
+ url = preprocess_url('/dedicated_hosts/testString')
+ mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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,
@@ -11585,306 +10528,415 @@ def test_list_instance_disks_value_error(self):
)
# Set up parameter values
- instance_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_disks(**req_copy)
+ _service.get_dedicated_host(**req_copy)
- def test_list_instance_disks_value_error_with_retries(self):
- # Enable retries and run test_list_instance_disks_value_error.
+ def test_get_dedicated_host_value_error_with_retries(self):
+ # Enable retries and run test_get_dedicated_host_value_error.
_service.enable_retries()
- self.test_list_instance_disks_value_error()
+ self.test_get_dedicated_host_value_error()
- # Disable retries and run test_list_instance_disks_value_error.
+ # Disable retries and run test_get_dedicated_host_value_error.
_service.disable_retries()
- self.test_list_instance_disks_value_error()
+ self.test_get_dedicated_host_value_error()
-class TestGetInstanceDisk:
+class TestUpdateDedicatedHost:
"""
- Test Class for get_instance_disk
+ Test Class for update_dedicated_host
"""
@responses.activate
- def test_get_instance_disk_all_params(self):
+ def test_update_dedicated_host_all_params(self):
"""
- get_instance_disk()
+ update_dedicated_host()
"""
# Set up mock
- url = preprocess_url('/instances/testString/disks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
+ url = preprocess_url('/dedicated_hosts/testString')
+ mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a DedicatedHostPatch model
+ dedicated_host_patch_model = {}
+ dedicated_host_patch_model['instance_placement_enabled'] = False
+ dedicated_host_patch_model['name'] = 'my-host'
+
# Set up parameter values
- instance_id = 'testString'
id = 'testString'
+ dedicated_host_patch = dedicated_host_patch_model
# Invoke method
- response = _service.get_instance_disk(
- instance_id,
+ response = _service.update_dedicated_host(
id,
+ dedicated_host_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 == dedicated_host_patch
- def test_get_instance_disk_all_params_with_retries(self):
- # Enable retries and run test_get_instance_disk_all_params.
+ def test_update_dedicated_host_all_params_with_retries(self):
+ # Enable retries and run test_update_dedicated_host_all_params.
_service.enable_retries()
- self.test_get_instance_disk_all_params()
+ self.test_update_dedicated_host_all_params()
- # Disable retries and run test_get_instance_disk_all_params.
+ # Disable retries and run test_update_dedicated_host_all_params.
_service.disable_retries()
- self.test_get_instance_disk_all_params()
+ self.test_update_dedicated_host_all_params()
@responses.activate
- def test_get_instance_disk_value_error(self):
+ def test_update_dedicated_host_value_error(self):
"""
- test_get_instance_disk_value_error()
+ test_update_dedicated_host_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/disks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
+ url = preprocess_url('/dedicated_hosts/testString')
+ mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a DedicatedHostPatch model
+ dedicated_host_patch_model = {}
+ dedicated_host_patch_model['instance_placement_enabled'] = False
+ dedicated_host_patch_model['name'] = 'my-host'
+
# Set up parameter values
- instance_id = 'testString'
id = 'testString'
+ dedicated_host_patch = dedicated_host_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
"id": id,
+ "dedicated_host_patch": dedicated_host_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_instance_disk(**req_copy)
+ _service.update_dedicated_host(**req_copy)
- def test_get_instance_disk_value_error_with_retries(self):
- # Enable retries and run test_get_instance_disk_value_error.
+ def test_update_dedicated_host_value_error_with_retries(self):
+ # Enable retries and run test_update_dedicated_host_value_error.
_service.enable_retries()
- self.test_get_instance_disk_value_error()
+ self.test_update_dedicated_host_value_error()
- # Disable retries and run test_get_instance_disk_value_error.
+ # Disable retries and run test_update_dedicated_host_value_error.
_service.disable_retries()
- self.test_get_instance_disk_value_error()
+ self.test_update_dedicated_host_value_error()
-class TestUpdateInstanceDisk:
+# endregion
+##############################################################################
+# End of Service: DedicatedHosts
+##############################################################################
+
+##############################################################################
+# Start of Service: EndpointGateways
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for update_instance_disk
+ 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 TestListEndpointGateways:
+ """
+ Test Class for list_endpoint_gateways
"""
@responses.activate
- def test_update_instance_disk_all_params(self):
+ def test_list_endpoint_gateways_all_params(self):
"""
- update_instance_disk()
+ list_endpoint_gateways()
"""
# Set up mock
- url = preprocess_url('/instances/testString/disks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
+ url = preprocess_url('/endpoint_gateways')
+ mock_response = '{"endpoint_gateways": [{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceDiskPatch model
- instance_disk_patch_model = {}
- instance_disk_patch_model['name'] = 'my-instance-disk-updated'
-
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
- instance_disk_patch = instance_disk_patch_model
+ name = 'my-name'
+ start = 'testString'
+ limit = 50
+ resource_group_id = 'testString'
+ lifecycle_state = ['stable']
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
+ allow_dns_resolution_binding = True
# Invoke method
- response = _service.update_instance_disk(
- instance_id,
- id,
- instance_disk_patch,
+ response = _service.list_endpoint_gateways(
+ name=name,
+ start=start,
+ limit=limit,
+ resource_group_id=resource_group_id,
+ lifecycle_state=lifecycle_state,
+ vpc_id=vpc_id,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
+ allow_dns_resolution_binding=allow_dns_resolution_binding,
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 == instance_disk_patch
+ # 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 'lifecycle_state={}'.format(','.join(lifecycle_state)) 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 'allow_dns_resolution_binding={}'.format('true' if allow_dns_resolution_binding else 'false') in query_string
- def test_update_instance_disk_all_params_with_retries(self):
- # Enable retries and run test_update_instance_disk_all_params.
+ def test_list_endpoint_gateways_all_params_with_retries(self):
+ # Enable retries and run test_list_endpoint_gateways_all_params.
_service.enable_retries()
- self.test_update_instance_disk_all_params()
+ self.test_list_endpoint_gateways_all_params()
- # Disable retries and run test_update_instance_disk_all_params.
+ # Disable retries and run test_list_endpoint_gateways_all_params.
_service.disable_retries()
- self.test_update_instance_disk_all_params()
+ self.test_list_endpoint_gateways_all_params()
@responses.activate
- def test_update_instance_disk_value_error(self):
+ def test_list_endpoint_gateways_required_params(self):
"""
- test_update_instance_disk_value_error()
+ test_list_endpoint_gateways_required_params()
"""
# Set up mock
- url = preprocess_url('/instances/testString/disks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
+ url = preprocess_url('/endpoint_gateways')
+ mock_response = '{"endpoint_gateways": [{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceDiskPatch model
- instance_disk_patch_model = {}
- instance_disk_patch_model['name'] = 'my-instance-disk-updated'
+ # Invoke method
+ response = _service.list_endpoint_gateways()
- # Set up parameter values
- instance_id = 'testString'
- id = 'testString'
- instance_disk_patch = instance_disk_patch_model
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_endpoint_gateways_required_params_with_retries(self):
+ # Enable retries and run test_list_endpoint_gateways_required_params.
+ _service.enable_retries()
+ self.test_list_endpoint_gateways_required_params()
+
+ # Disable retries and run test_list_endpoint_gateways_required_params.
+ _service.disable_retries()
+ self.test_list_endpoint_gateways_required_params()
+
+ @responses.activate
+ def test_list_endpoint_gateways_value_error(self):
+ """
+ test_list_endpoint_gateways_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/endpoint_gateways')
+ mock_response = '{"endpoint_gateways": [{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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 = {
- "instance_id": instance_id,
- "id": id,
- "instance_disk_patch": instance_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_instance_disk(**req_copy)
+ _service.list_endpoint_gateways(**req_copy)
- def test_update_instance_disk_value_error_with_retries(self):
- # Enable retries and run test_update_instance_disk_value_error.
+ def test_list_endpoint_gateways_value_error_with_retries(self):
+ # Enable retries and run test_list_endpoint_gateways_value_error.
_service.enable_retries()
- self.test_update_instance_disk_value_error()
+ self.test_list_endpoint_gateways_value_error()
- # Disable retries and run test_update_instance_disk_value_error.
+ # Disable retries and run test_list_endpoint_gateways_value_error.
_service.disable_retries()
- self.test_update_instance_disk_value_error()
-
-
-class TestListInstanceNetworkAttachments:
- """
- Test Class for list_instance_network_attachments
- """
+ self.test_list_endpoint_gateways_value_error()
@responses.activate
- def test_list_instance_network_attachments_all_params(self):
+ def test_list_endpoint_gateways_with_pager_get_next(self):
"""
- list_instance_network_attachments()
+ test_list_endpoint_gateways_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/instances/testString/network_attachments')
- mock_response = '{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/endpoint_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response2,
content_type='application/json',
status=200,
)
- # Set up parameter values
- instance_id = 'testString'
-
- # Invoke method
- response = _service.list_instance_network_attachments(
- instance_id,
- headers={},
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = EndpointGatewaysPager(
+ client=_service,
+ name='my-name',
+ limit=10,
+ resource_group_id='testString',
+ lifecycle_state=['stable'],
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ allow_dns_resolution_binding=True,
)
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_instance_network_attachments_all_params_with_retries(self):
- # Enable retries and run test_list_instance_network_attachments_all_params.
- _service.enable_retries()
- self.test_list_instance_network_attachments_all_params()
-
- # Disable retries and run test_list_instance_network_attachments_all_params.
- _service.disable_retries()
- self.test_list_instance_network_attachments_all_params()
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_list_instance_network_attachments_value_error(self):
+ def test_list_endpoint_gateways_with_pager_get_all(self):
"""
- test_list_instance_network_attachments_value_error()
+ test_list_endpoint_gateways_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/instances/testString/network_attachments')
- mock_response = '{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/endpoint_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
content_type='application/json',
status=200,
)
- # Set up parameter values
- instance_id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "instance_id": instance_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_instance_network_attachments(**req_copy)
-
- def test_list_instance_network_attachments_value_error_with_retries(self):
- # Enable retries and run test_list_instance_network_attachments_value_error.
- _service.enable_retries()
- self.test_list_instance_network_attachments_value_error()
-
- # Disable retries and run test_list_instance_network_attachments_value_error.
- _service.disable_retries()
- self.test_list_instance_network_attachments_value_error()
+ # Exercise the pager class for this operation
+ pager = EndpointGatewaysPager(
+ client=_service,
+ name='my-name',
+ limit=10,
+ resource_group_id='testString',
+ lifecycle_state=['stable'],
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ allow_dns_resolution_binding=True,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestCreateInstanceNetworkAttachment:
+class TestCreateEndpointGateway:
"""
- Test Class for create_instance_network_attachment
+ Test Class for create_endpoint_gateway
"""
@responses.activate
- def test_create_instance_network_attachment_all_params(self):
+ def test_create_endpoint_gateway_all_params(self):
"""
- create_instance_network_attachment()
+ create_endpoint_gateway()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
+ url = preprocess_url('/endpoint_gateways')
+ mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -11893,17 +10945,18 @@ def test_create_instance_network_attachment_all_params(self):
status=201,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a dict representation of a EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype model
+ endpoint_gateway_target_prototype_model = {}
+ endpoint_gateway_target_prototype_model['name'] = 'ibm-ntp-server'
+ endpoint_gateway_target_prototype_model['resource_type'] = 'provider_infrastructure_service'
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.7'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a EndpointGatewayReservedIPReservedIPIdentityById model
+ endpoint_gateway_reserved_ip_model = {}
+ endpoint_gateway_reserved_ip_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
@@ -11913,33 +10966,24 @@ def test_create_instance_network_attachment_all_params(self):
security_group_identity_model = {}
security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
- instance_network_attachment_prototype_virtual_network_interface_model = {}
- instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
# Set up parameter values
- instance_id = 'testString'
- virtual_network_interface = instance_network_attachment_prototype_virtual_network_interface_model
+ target = endpoint_gateway_target_prototype_model
+ vpc = vpc_identity_model
+ allow_dns_resolution_binding = True
+ ips = [endpoint_gateway_reserved_ip_model]
name = 'testString'
+ resource_group = resource_group_identity_model
+ security_groups = [security_group_identity_model]
# Invoke method
- response = _service.create_instance_network_attachment(
- instance_id,
- virtual_network_interface,
+ response = _service.create_endpoint_gateway(
+ target,
+ vpc,
+ allow_dns_resolution_binding=allow_dns_resolution_binding,
+ ips=ips,
name=name,
+ resource_group=resource_group,
+ security_groups=security_groups,
headers={},
)
@@ -11948,26 +10992,31 @@ def test_create_instance_network_attachment_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['virtual_network_interface'] == instance_network_attachment_prototype_virtual_network_interface_model
+ assert req_body['target'] == endpoint_gateway_target_prototype_model
+ assert req_body['vpc'] == vpc_identity_model
+ assert req_body['allow_dns_resolution_binding'] == True
+ assert req_body['ips'] == [endpoint_gateway_reserved_ip_model]
assert req_body['name'] == 'testString'
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['security_groups'] == [security_group_identity_model]
- def test_create_instance_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_create_instance_network_attachment_all_params.
+ def test_create_endpoint_gateway_all_params_with_retries(self):
+ # Enable retries and run test_create_endpoint_gateway_all_params.
_service.enable_retries()
- self.test_create_instance_network_attachment_all_params()
+ self.test_create_endpoint_gateway_all_params()
- # Disable retries and run test_create_instance_network_attachment_all_params.
+ # Disable retries and run test_create_endpoint_gateway_all_params.
_service.disable_retries()
- self.test_create_instance_network_attachment_all_params()
+ self.test_create_endpoint_gateway_all_params()
@responses.activate
- def test_create_instance_network_attachment_value_error(self):
+ def test_create_endpoint_gateway_value_error(self):
"""
- test_create_instance_network_attachment_value_error()
+ test_create_endpoint_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
+ url = preprocess_url('/endpoint_gateways')
+ mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -11976,17 +11025,18 @@ def test_create_instance_network_attachment_value_error(self):
status=201,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a dict representation of a EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype model
+ endpoint_gateway_target_prototype_model = {}
+ endpoint_gateway_target_prototype_model['name'] = 'ibm-ntp-server'
+ endpoint_gateway_target_prototype_model['resource_type'] = 'provider_infrastructure_service'
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.7'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a EndpointGatewayReservedIPReservedIPIdentityById model
+ endpoint_gateway_reserved_ip_model = {}
+ endpoint_gateway_reserved_ip_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
@@ -11996,888 +11046,1138 @@ def test_create_instance_network_attachment_value_error(self):
security_group_identity_model = {}
security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
- instance_network_attachment_prototype_virtual_network_interface_model = {}
- instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
# Set up parameter values
- instance_id = 'testString'
- virtual_network_interface = instance_network_attachment_prototype_virtual_network_interface_model
+ target = endpoint_gateway_target_prototype_model
+ vpc = vpc_identity_model
+ allow_dns_resolution_binding = True
+ ips = [endpoint_gateway_reserved_ip_model]
name = 'testString'
+ 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 = {
- "instance_id": instance_id,
- "virtual_network_interface": virtual_network_interface,
+ "target": target,
+ "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_instance_network_attachment(**req_copy)
+ _service.create_endpoint_gateway(**req_copy)
- def test_create_instance_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_create_instance_network_attachment_value_error.
+ def test_create_endpoint_gateway_value_error_with_retries(self):
+ # Enable retries and run test_create_endpoint_gateway_value_error.
_service.enable_retries()
- self.test_create_instance_network_attachment_value_error()
+ self.test_create_endpoint_gateway_value_error()
- # Disable retries and run test_create_instance_network_attachment_value_error.
+ # Disable retries and run test_create_endpoint_gateway_value_error.
_service.disable_retries()
- self.test_create_instance_network_attachment_value_error()
+ self.test_create_endpoint_gateway_value_error()
-class TestDeleteInstanceNetworkAttachment:
+class TestListEndpointGatewayIps:
"""
- Test Class for delete_instance_network_attachment
+ Test Class for list_endpoint_gateway_ips
"""
@responses.activate
- def test_delete_instance_network_attachment_all_params(self):
+ def test_list_endpoint_gateway_ips_all_params(self):
"""
- delete_instance_network_attachment()
+ list_endpoint_gateway_ips()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments/testString')
+ url = preprocess_url('/endpoint_gateways/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ endpoint_gateway_id = 'testString'
+ start = 'testString'
+ limit = 50
+ sort = 'name'
# Invoke method
- response = _service.delete_instance_network_attachment(
- instance_id,
- id,
+ response = _service.list_endpoint_gateway_ips(
+ endpoint_gateway_id,
+ start=start,
+ limit=limit,
+ sort=sort,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ 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_delete_instance_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_network_attachment_all_params.
+ def test_list_endpoint_gateway_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_endpoint_gateway_ips_all_params.
_service.enable_retries()
- self.test_delete_instance_network_attachment_all_params()
+ self.test_list_endpoint_gateway_ips_all_params()
- # Disable retries and run test_delete_instance_network_attachment_all_params.
+ # Disable retries and run test_list_endpoint_gateway_ips_all_params.
_service.disable_retries()
- self.test_delete_instance_network_attachment_all_params()
+ self.test_list_endpoint_gateway_ips_all_params()
@responses.activate
- def test_delete_instance_network_attachment_value_error(self):
+ def test_list_endpoint_gateway_ips_required_params(self):
"""
- test_delete_instance_network_attachment_value_error()
+ test_list_endpoint_gateway_ips_required_params()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments/testString')
+ url = preprocess_url('/endpoint_gateways/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ endpoint_gateway_id = 'testString'
+
+ # Invoke method
+ response = _service.list_endpoint_gateway_ips(
+ endpoint_gateway_id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_endpoint_gateway_ips_required_params_with_retries(self):
+ # Enable retries and run test_list_endpoint_gateway_ips_required_params.
+ _service.enable_retries()
+ self.test_list_endpoint_gateway_ips_required_params()
+
+ # Disable retries and run test_list_endpoint_gateway_ips_required_params.
+ _service.disable_retries()
+ self.test_list_endpoint_gateway_ips_required_params()
+
+ @responses.activate
+ def test_list_endpoint_gateway_ips_value_error(self):
+ """
+ test_list_endpoint_gateway_ips_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/endpoint_gateways/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ endpoint_gateway_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "id": id,
+ "endpoint_gateway_id": endpoint_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.delete_instance_network_attachment(**req_copy)
+ _service.list_endpoint_gateway_ips(**req_copy)
- def test_delete_instance_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_network_attachment_value_error.
+ def test_list_endpoint_gateway_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_endpoint_gateway_ips_value_error.
_service.enable_retries()
- self.test_delete_instance_network_attachment_value_error()
+ self.test_list_endpoint_gateway_ips_value_error()
- # Disable retries and run test_delete_instance_network_attachment_value_error.
+ # Disable retries and run test_list_endpoint_gateway_ips_value_error.
_service.disable_retries()
- self.test_delete_instance_network_attachment_value_error()
+ self.test_list_endpoint_gateway_ips_value_error()
+
+ @responses.activate
+ def test_list_endpoint_gateway_ips_with_pager_get_next(self):
+ """
+ test_list_endpoint_gateway_ips_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/endpoint_gateways/testString/ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = EndpointGatewayIpsPager(
+ client=_service,
+ endpoint_gateway_id='testString',
+ limit=10,
+ sort='name',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestGetInstanceNetworkAttachment:
+ @responses.activate
+ def test_list_endpoint_gateway_ips_with_pager_get_all(self):
+ """
+ test_list_endpoint_gateway_ips_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/endpoint_gateways/testString/ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = EndpointGatewayIpsPager(
+ client=_service,
+ endpoint_gateway_id='testString',
+ limit=10,
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestRemoveEndpointGatewayIp:
"""
- Test Class for get_instance_network_attachment
+ Test Class for remove_endpoint_gateway_ip
"""
@responses.activate
- def test_get_instance_network_attachment_all_params(self):
+ def test_remove_endpoint_gateway_ip_all_params(self):
"""
- get_instance_network_attachment()
+ remove_endpoint_gateway_ip()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
+ url = preprocess_url('/endpoint_gateways/testString/ips/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- instance_id = 'testString'
+ endpoint_gateway_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_instance_network_attachment(
- instance_id,
+ response = _service.remove_endpoint_gateway_ip(
+ endpoint_gateway_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_instance_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_get_instance_network_attachment_all_params.
+ def test_remove_endpoint_gateway_ip_all_params_with_retries(self):
+ # Enable retries and run test_remove_endpoint_gateway_ip_all_params.
_service.enable_retries()
- self.test_get_instance_network_attachment_all_params()
+ self.test_remove_endpoint_gateway_ip_all_params()
- # Disable retries and run test_get_instance_network_attachment_all_params.
+ # Disable retries and run test_remove_endpoint_gateway_ip_all_params.
_service.disable_retries()
- self.test_get_instance_network_attachment_all_params()
+ self.test_remove_endpoint_gateway_ip_all_params()
@responses.activate
- def test_get_instance_network_attachment_value_error(self):
+ def test_remove_endpoint_gateway_ip_value_error(self):
"""
- test_get_instance_network_attachment_value_error()
+ test_remove_endpoint_gateway_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
+ url = preprocess_url('/endpoint_gateways/testString/ips/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- instance_id = 'testString'
+ endpoint_gateway_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
+ "endpoint_gateway_id": endpoint_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_instance_network_attachment(**req_copy)
+ _service.remove_endpoint_gateway_ip(**req_copy)
- def test_get_instance_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_get_instance_network_attachment_value_error.
+ def test_remove_endpoint_gateway_ip_value_error_with_retries(self):
+ # Enable retries and run test_remove_endpoint_gateway_ip_value_error.
_service.enable_retries()
- self.test_get_instance_network_attachment_value_error()
+ self.test_remove_endpoint_gateway_ip_value_error()
- # Disable retries and run test_get_instance_network_attachment_value_error.
+ # Disable retries and run test_remove_endpoint_gateway_ip_value_error.
_service.disable_retries()
- self.test_get_instance_network_attachment_value_error()
+ self.test_remove_endpoint_gateway_ip_value_error()
-class TestUpdateInstanceNetworkAttachment:
+class TestGetEndpointGatewayIp:
"""
- Test Class for update_instance_network_attachment
+ Test Class for get_endpoint_gateway_ip
"""
@responses.activate
- def test_update_instance_network_attachment_all_params(self):
+ def test_get_endpoint_gateway_ip_all_params(self):
"""
- update_instance_network_attachment()
+ get_endpoint_gateway_ip()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
+ url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceNetworkAttachmentPatch model
- instance_network_attachment_patch_model = {}
- instance_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
-
# Set up parameter values
- instance_id = 'testString'
+ endpoint_gateway_id = 'testString'
id = 'testString'
- instance_network_attachment_patch = instance_network_attachment_patch_model
# Invoke method
- response = _service.update_instance_network_attachment(
- instance_id,
+ response = _service.get_endpoint_gateway_ip(
+ endpoint_gateway_id,
id,
- instance_network_attachment_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 == instance_network_attachment_patch
- def test_update_instance_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_update_instance_network_attachment_all_params.
+ def test_get_endpoint_gateway_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_endpoint_gateway_ip_all_params.
_service.enable_retries()
- self.test_update_instance_network_attachment_all_params()
+ self.test_get_endpoint_gateway_ip_all_params()
- # Disable retries and run test_update_instance_network_attachment_all_params.
+ # Disable retries and run test_get_endpoint_gateway_ip_all_params.
_service.disable_retries()
- self.test_update_instance_network_attachment_all_params()
+ self.test_get_endpoint_gateway_ip_all_params()
@responses.activate
- def test_update_instance_network_attachment_value_error(self):
+ def test_get_endpoint_gateway_ip_value_error(self):
"""
- test_update_instance_network_attachment_value_error()
+ test_get_endpoint_gateway_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
+ url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceNetworkAttachmentPatch model
- instance_network_attachment_patch_model = {}
- instance_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
-
# Set up parameter values
- instance_id = 'testString'
+ endpoint_gateway_id = 'testString'
id = 'testString'
- instance_network_attachment_patch = instance_network_attachment_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
+ "endpoint_gateway_id": endpoint_gateway_id,
"id": id,
- "instance_network_attachment_patch": instance_network_attachment_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_instance_network_attachment(**req_copy)
+ _service.get_endpoint_gateway_ip(**req_copy)
- def test_update_instance_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_update_instance_network_attachment_value_error.
+ def test_get_endpoint_gateway_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_endpoint_gateway_ip_value_error.
_service.enable_retries()
- self.test_update_instance_network_attachment_value_error()
+ self.test_get_endpoint_gateway_ip_value_error()
- # Disable retries and run test_update_instance_network_attachment_value_error.
+ # Disable retries and run test_get_endpoint_gateway_ip_value_error.
_service.disable_retries()
- self.test_update_instance_network_attachment_value_error()
+ self.test_get_endpoint_gateway_ip_value_error()
-class TestListInstanceNetworkInterfaces:
+class TestAddEndpointGatewayIp:
"""
- Test Class for list_instance_network_interfaces
+ Test Class for add_endpoint_gateway_ip
"""
@responses.activate
- def test_list_instance_network_interfaces_all_params(self):
+ def test_add_endpoint_gateway_ip_all_params(self):
"""
- list_instance_network_interfaces()
+ add_endpoint_gateway_ip()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces')
- mock_response = '{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}'
+ url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.GET,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
# Set up parameter values
- instance_id = 'testString'
+ endpoint_gateway_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_instance_network_interfaces(
- instance_id,
+ response = _service.add_endpoint_gateway_ip(
+ endpoint_gateway_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 201
- def test_list_instance_network_interfaces_all_params_with_retries(self):
- # Enable retries and run test_list_instance_network_interfaces_all_params.
+ def test_add_endpoint_gateway_ip_all_params_with_retries(self):
+ # Enable retries and run test_add_endpoint_gateway_ip_all_params.
_service.enable_retries()
- self.test_list_instance_network_interfaces_all_params()
+ self.test_add_endpoint_gateway_ip_all_params()
- # Disable retries and run test_list_instance_network_interfaces_all_params.
+ # Disable retries and run test_add_endpoint_gateway_ip_all_params.
_service.disable_retries()
- self.test_list_instance_network_interfaces_all_params()
+ self.test_add_endpoint_gateway_ip_all_params()
@responses.activate
- def test_list_instance_network_interfaces_value_error(self):
+ def test_add_endpoint_gateway_ip_value_error(self):
"""
- test_list_instance_network_interfaces_value_error()
+ test_add_endpoint_gateway_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces')
- mock_response = '{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}'
+ url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.GET,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
# Set up parameter values
- instance_id = 'testString'
+ endpoint_gateway_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
+ "endpoint_gateway_id": endpoint_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_instance_network_interfaces(**req_copy)
+ _service.add_endpoint_gateway_ip(**req_copy)
- def test_list_instance_network_interfaces_value_error_with_retries(self):
- # Enable retries and run test_list_instance_network_interfaces_value_error.
+ def test_add_endpoint_gateway_ip_value_error_with_retries(self):
+ # Enable retries and run test_add_endpoint_gateway_ip_value_error.
_service.enable_retries()
- self.test_list_instance_network_interfaces_value_error()
+ self.test_add_endpoint_gateway_ip_value_error()
- # Disable retries and run test_list_instance_network_interfaces_value_error.
+ # Disable retries and run test_add_endpoint_gateway_ip_value_error.
_service.disable_retries()
- self.test_list_instance_network_interfaces_value_error()
+ self.test_add_endpoint_gateway_ip_value_error()
-class TestCreateInstanceNetworkInterface:
+class TestDeleteEndpointGateway:
"""
- Test Class for create_instance_network_interface
+ Test Class for delete_endpoint_gateway
"""
@responses.activate
- def test_create_instance_network_interface_all_params(self):
+ def test_delete_endpoint_gateway_all_params(self):
"""
- create_instance_network_interface()
+ delete_endpoint_gateway()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces')
- mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
+ url = preprocess_url('/endpoint_gateways/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=204,
)
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
# Set up parameter values
- instance_id = 'testString'
- subnet = subnet_identity_model
- allow_ip_spoofing = True
- name = 'my-instance-network-interface'
- primary_ip = network_interface_ip_prototype_model
- security_groups = [security_group_identity_model]
+ id = 'testString'
# Invoke method
- response = _service.create_instance_network_interface(
- instance_id,
- subnet,
- allow_ip_spoofing=allow_ip_spoofing,
- name=name,
- primary_ip=primary_ip,
- security_groups=security_groups,
+ response = _service.delete_endpoint_gateway(
+ id,
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['subnet'] == subnet_identity_model
- assert req_body['allow_ip_spoofing'] == True
- assert req_body['name'] == 'my-instance-network-interface'
- assert req_body['primary_ip'] == network_interface_ip_prototype_model
- assert req_body['security_groups'] == [security_group_identity_model]
+ assert response.status_code == 204
- def test_create_instance_network_interface_all_params_with_retries(self):
- # Enable retries and run test_create_instance_network_interface_all_params.
+ def test_delete_endpoint_gateway_all_params_with_retries(self):
+ # Enable retries and run test_delete_endpoint_gateway_all_params.
_service.enable_retries()
- self.test_create_instance_network_interface_all_params()
+ self.test_delete_endpoint_gateway_all_params()
- # Disable retries and run test_create_instance_network_interface_all_params.
+ # Disable retries and run test_delete_endpoint_gateway_all_params.
_service.disable_retries()
- self.test_create_instance_network_interface_all_params()
+ self.test_delete_endpoint_gateway_all_params()
@responses.activate
- def test_create_instance_network_interface_value_error(self):
+ def test_delete_endpoint_gateway_value_error(self):
"""
- test_create_instance_network_interface_value_error()
+ test_delete_endpoint_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces')
- mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
+ url = preprocess_url('/endpoint_gateways/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=204,
)
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
# Set up parameter values
- instance_id = 'testString'
- subnet = subnet_identity_model
- allow_ip_spoofing = True
- name = 'my-instance-network-interface'
- primary_ip = network_interface_ip_prototype_model
- security_groups = [security_group_identity_model]
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "subnet": subnet,
+ "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_instance_network_interface(**req_copy)
+ _service.delete_endpoint_gateway(**req_copy)
- def test_create_instance_network_interface_value_error_with_retries(self):
- # Enable retries and run test_create_instance_network_interface_value_error.
+ def test_delete_endpoint_gateway_value_error_with_retries(self):
+ # Enable retries and run test_delete_endpoint_gateway_value_error.
_service.enable_retries()
- self.test_create_instance_network_interface_value_error()
+ self.test_delete_endpoint_gateway_value_error()
- # Disable retries and run test_create_instance_network_interface_value_error.
+ # Disable retries and run test_delete_endpoint_gateway_value_error.
_service.disable_retries()
- self.test_create_instance_network_interface_value_error()
+ self.test_delete_endpoint_gateway_value_error()
-class TestDeleteInstanceNetworkInterface:
+class TestGetEndpointGateway:
"""
- Test Class for delete_instance_network_interface
+ Test Class for get_endpoint_gateway
"""
@responses.activate
- def test_delete_instance_network_interface_all_params(self):
+ def test_get_endpoint_gateway_all_params(self):
"""
- delete_instance_network_interface()
+ get_endpoint_gateway()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString')
+ url = preprocess_url('/endpoint_gateways/testString')
+ mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_instance_network_interface(
- instance_id,
+ response = _service.get_endpoint_gateway(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_instance_network_interface_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_network_interface_all_params.
+ def test_get_endpoint_gateway_all_params_with_retries(self):
+ # Enable retries and run test_get_endpoint_gateway_all_params.
_service.enable_retries()
- self.test_delete_instance_network_interface_all_params()
+ self.test_get_endpoint_gateway_all_params()
- # Disable retries and run test_delete_instance_network_interface_all_params.
+ # Disable retries and run test_get_endpoint_gateway_all_params.
_service.disable_retries()
- self.test_delete_instance_network_interface_all_params()
+ self.test_get_endpoint_gateway_all_params()
@responses.activate
- def test_delete_instance_network_interface_value_error(self):
+ def test_get_endpoint_gateway_value_error(self):
"""
- test_delete_instance_network_interface_value_error()
+ test_get_endpoint_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString')
+ url = preprocess_url('/endpoint_gateways/testString')
+ mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_network_interface(**req_copy)
+ _service.get_endpoint_gateway(**req_copy)
- def test_delete_instance_network_interface_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_network_interface_value_error.
+ def test_get_endpoint_gateway_value_error_with_retries(self):
+ # Enable retries and run test_get_endpoint_gateway_value_error.
_service.enable_retries()
- self.test_delete_instance_network_interface_value_error()
+ self.test_get_endpoint_gateway_value_error()
- # Disable retries and run test_delete_instance_network_interface_value_error.
+ # Disable retries and run test_get_endpoint_gateway_value_error.
_service.disable_retries()
- self.test_delete_instance_network_interface_value_error()
+ self.test_get_endpoint_gateway_value_error()
-class TestGetInstanceNetworkInterface:
+class TestUpdateEndpointGateway:
"""
- Test Class for get_instance_network_interface
+ Test Class for update_endpoint_gateway
"""
@responses.activate
- def test_get_instance_network_interface_all_params(self):
+ def test_update_endpoint_gateway_all_params(self):
"""
- get_instance_network_interface()
+ update_endpoint_gateway()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
+ url = preprocess_url('/endpoint_gateways/testString')
+ mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a EndpointGatewayPatch model
+ endpoint_gateway_patch_model = {}
+ endpoint_gateway_patch_model['allow_dns_resolution_binding'] = False
+ endpoint_gateway_patch_model['name'] = 'my-endpoint-gateway'
+
# Set up parameter values
- instance_id = 'testString'
id = 'testString'
+ endpoint_gateway_patch = endpoint_gateway_patch_model
# Invoke method
- response = _service.get_instance_network_interface(
- instance_id,
+ response = _service.update_endpoint_gateway(
id,
+ endpoint_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 == endpoint_gateway_patch
- def test_get_instance_network_interface_all_params_with_retries(self):
- # Enable retries and run test_get_instance_network_interface_all_params.
+ def test_update_endpoint_gateway_all_params_with_retries(self):
+ # Enable retries and run test_update_endpoint_gateway_all_params.
_service.enable_retries()
- self.test_get_instance_network_interface_all_params()
+ self.test_update_endpoint_gateway_all_params()
- # Disable retries and run test_get_instance_network_interface_all_params.
+ # Disable retries and run test_update_endpoint_gateway_all_params.
_service.disable_retries()
- self.test_get_instance_network_interface_all_params()
+ self.test_update_endpoint_gateway_all_params()
@responses.activate
- def test_get_instance_network_interface_value_error(self):
+ def test_update_endpoint_gateway_value_error(self):
"""
- test_get_instance_network_interface_value_error()
+ test_update_endpoint_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
+ url = preprocess_url('/endpoint_gateways/testString')
+ mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a EndpointGatewayPatch model
+ endpoint_gateway_patch_model = {}
+ endpoint_gateway_patch_model['allow_dns_resolution_binding'] = False
+ endpoint_gateway_patch_model['name'] = 'my-endpoint-gateway'
+
# Set up parameter values
- instance_id = 'testString'
id = 'testString'
+ endpoint_gateway_patch = endpoint_gateway_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
"id": id,
+ "endpoint_gateway_patch": endpoint_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.get_instance_network_interface(**req_copy)
+ _service.update_endpoint_gateway(**req_copy)
- def test_get_instance_network_interface_value_error_with_retries(self):
- # Enable retries and run test_get_instance_network_interface_value_error.
+ def test_update_endpoint_gateway_value_error_with_retries(self):
+ # Enable retries and run test_update_endpoint_gateway_value_error.
_service.enable_retries()
- self.test_get_instance_network_interface_value_error()
+ self.test_update_endpoint_gateway_value_error()
- # Disable retries and run test_get_instance_network_interface_value_error.
+ # Disable retries and run test_update_endpoint_gateway_value_error.
_service.disable_retries()
- self.test_get_instance_network_interface_value_error()
+ self.test_update_endpoint_gateway_value_error()
-class TestUpdateInstanceNetworkInterface:
+# endregion
+##############################################################################
+# End of Service: EndpointGateways
+##############################################################################
+
+##############################################################################
+# Start of Service: FloatingIPs
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for update_instance_network_interface
+ 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 TestListFloatingIps:
+ """
+ Test Class for list_floating_ips
"""
@responses.activate
- def test_update_instance_network_interface_all_params(self):
+ def test_list_floating_ips_all_params(self):
"""
- update_instance_network_interface()
+ list_floating_ips()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
+ url = preprocess_url('/floating_ips')
+ mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a NetworkInterfacePatch model
- network_interface_patch_model = {}
- network_interface_patch_model['allow_ip_spoofing'] = True
- network_interface_patch_model['name'] = 'my-network-interface-updated'
-
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
- network_interface_patch = network_interface_patch_model
+ start = 'testString'
+ limit = 50
+ resource_group_id = 'testString'
+ sort = 'name'
+ target_id = 'testString'
+ target_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+ target_name = 'my-resource'
+ target_resource_type = 'testString'
+
+ # Invoke method
+ response = _service.list_floating_ips(
+ start=start,
+ limit=limit,
+ resource_group_id=resource_group_id,
+ sort=sort,
+ target_id=target_id,
+ target_crn=target_crn,
+ target_name=target_name,
+ target_resource_type=target_resource_type,
+ 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 'sort={}'.format(sort) in query_string
+ assert 'target.id={}'.format(target_id) in query_string
+ assert 'target.crn={}'.format(target_crn) in query_string
+ assert 'target.name={}'.format(target_name) in query_string
+ assert 'target.resource_type={}'.format(target_resource_type) in query_string
+
+ 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_floating_ips_all_params()
+
+ # Disable retries and run test_list_floating_ips_all_params.
+ _service.disable_retries()
+ self.test_list_floating_ips_all_params()
+
+ @responses.activate
+ def test_list_floating_ips_required_params(self):
+ """
+ test_list_floating_ips_required_params()
+ """
+ # Set up mock
+ url = preprocess_url('/floating_ips')
+ mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
# Invoke method
- response = _service.update_instance_network_interface(
- instance_id,
- id,
- network_interface_patch,
- headers={},
- )
+ response = _service.list_floating_ips()
# 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_interface_patch
- def test_update_instance_network_interface_all_params_with_retries(self):
- # Enable retries and run test_update_instance_network_interface_all_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_update_instance_network_interface_all_params()
+ self.test_list_floating_ips_required_params()
- # Disable retries and run test_update_instance_network_interface_all_params.
+ # Disable retries and run test_list_floating_ips_required_params.
_service.disable_retries()
- self.test_update_instance_network_interface_all_params()
+ self.test_list_floating_ips_required_params()
@responses.activate
- def test_update_instance_network_interface_value_error(self):
+ def test_list_floating_ips_value_error(self):
"""
- test_update_instance_network_interface_value_error()
+ test_list_floating_ips_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
+ url = preprocess_url('/floating_ips')
+ mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a NetworkInterfacePatch model
- network_interface_patch_model = {}
- network_interface_patch_model['allow_ip_spoofing'] = True
- network_interface_patch_model['name'] = 'my-network-interface-updated'
-
- # Set up parameter values
- instance_id = 'testString'
- id = 'testString'
- network_interface_patch = network_interface_patch_model
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "id": id,
- "network_interface_patch": 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_instance_network_interface(**req_copy)
+ _service.list_floating_ips(**req_copy)
- def test_update_instance_network_interface_value_error_with_retries(self):
- # Enable retries and run test_update_instance_network_interface_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_update_instance_network_interface_value_error()
+ self.test_list_floating_ips_value_error()
- # Disable retries and run test_update_instance_network_interface_value_error.
+ # Disable retries and run test_list_floating_ips_value_error.
_service.disable_retries()
- self.test_update_instance_network_interface_value_error()
+ self.test_list_floating_ips_value_error()
+
+ @responses.activate
+ def test_list_floating_ips_with_pager_get_next(self):
+ """
+ test_list_floating_ips_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/floating_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = FloatingIpsPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ sort='name',
+ target_id='testString',
+ target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
+ target_name='my-resource',
+ target_resource_type='testString',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+ @responses.activate
+ def test_list_floating_ips_with_pager_get_all(self):
+ """
+ test_list_floating_ips_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/floating_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestListInstanceNetworkInterfaceFloatingIps:
+ # Exercise the pager class for this operation
+ pager = FloatingIpsPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ sort='name',
+ target_id='testString',
+ target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
+ target_name='my-resource',
+ target_resource_type='testString',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateFloatingIp:
"""
- Test Class for list_instance_network_interface_floating_ips
+ Test Class for create_floating_ip
"""
@responses.activate
- def test_list_instance_network_interface_floating_ips_all_params(self):
+ def test_create_floating_ip_all_params(self):
"""
- list_instance_network_interface_floating_ips()
+ create_floating_ip()
"""
# Set up mock
- url = preprocess_url('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ 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 FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
+ floating_ip_target_prototype_model = {}
+ floating_ip_target_prototype_model['id'] = '0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
+
+ # Construct a dict representation of a FloatingIPPrototypeFloatingIPByTarget 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['target'] = floating_ip_target_prototype_model
+
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
+ floating_ip_prototype = floating_ip_prototype_model
# Invoke method
- response = _service.list_instance_network_interface_floating_ips(
- instance_id,
- network_interface_id,
+ response = _service.create_floating_ip(
+ floating_ip_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 == floating_ip_prototype
- def test_list_instance_network_interface_floating_ips_all_params_with_retries(self):
- # Enable retries and run test_list_instance_network_interface_floating_ips_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_list_instance_network_interface_floating_ips_all_params()
+ self.test_create_floating_ip_all_params()
- # Disable retries and run test_list_instance_network_interface_floating_ips_all_params.
+ # Disable retries and run test_create_floating_ip_all_params.
_service.disable_retries()
- self.test_list_instance_network_interface_floating_ips_all_params()
+ self.test_create_floating_ip_all_params()
@responses.activate
- def test_list_instance_network_interface_floating_ips_value_error(self):
+ def test_create_floating_ip_value_error(self):
"""
- test_list_instance_network_interface_floating_ips_value_error()
+ test_create_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ 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 FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
+ floating_ip_target_prototype_model = {}
+ floating_ip_target_prototype_model['id'] = '0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
+
+ # Construct a dict representation of a FloatingIPPrototypeFloatingIPByTarget 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['target'] = floating_ip_target_prototype_model
+
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
+ floating_ip_prototype = floating_ip_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "network_interface_id": network_interface_id,
+ "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.list_instance_network_interface_floating_ips(**req_copy)
+ _service.create_floating_ip(**req_copy)
- def test_list_instance_network_interface_floating_ips_value_error_with_retries(self):
- # Enable retries and run test_list_instance_network_interface_floating_ips_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_list_instance_network_interface_floating_ips_value_error()
+ self.test_create_floating_ip_value_error()
- # Disable retries and run test_list_instance_network_interface_floating_ips_value_error.
+ # Disable retries and run test_create_floating_ip_value_error.
_service.disable_retries()
- self.test_list_instance_network_interface_floating_ips_value_error()
+ self.test_create_floating_ip_value_error()
-class TestRemoveInstanceNetworkInterfaceFloatingIp:
+class TestDeleteFloatingIp:
"""
- Test Class for remove_instance_network_interface_floating_ip
+ Test Class for delete_floating_ip
"""
@responses.activate
- def test_remove_instance_network_interface_floating_ip_all_params(self):
+ def test_delete_floating_ip_all_params(self):
"""
- remove_instance_network_interface_floating_ip()
+ delete_floating_ip()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
+ url = preprocess_url('/floating_ips/testString')
responses.add(
responses.DELETE,
url,
@@ -12885,14 +12185,10 @@ def test_remove_instance_network_interface_floating_ip_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.remove_instance_network_interface_floating_ip(
- instance_id,
- network_interface_id,
+ response = _service.delete_floating_ip(
id,
headers={},
)
@@ -12901,22 +12197,22 @@ def test_remove_instance_network_interface_floating_ip_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_remove_instance_network_interface_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_remove_instance_network_interface_floating_ip_all_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_remove_instance_network_interface_floating_ip_all_params()
+ self.test_delete_floating_ip_all_params()
- # Disable retries and run test_remove_instance_network_interface_floating_ip_all_params.
+ # Disable retries and run test_delete_floating_ip_all_params.
_service.disable_retries()
- self.test_remove_instance_network_interface_floating_ip_all_params()
+ self.test_delete_floating_ip_all_params()
@responses.activate
- def test_remove_instance_network_interface_floating_ip_value_error(self):
+ def test_delete_floating_ip_value_error(self):
"""
- test_remove_instance_network_interface_floating_ip_value_error()
+ test_delete_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
+ url = preprocess_url('/floating_ips/testString')
responses.add(
responses.DELETE,
url,
@@ -12924,43 +12220,39 @@ def test_remove_instance_network_interface_floating_ip_value_error(self):
)
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_network_interface_floating_ip(**req_copy)
+ _service.delete_floating_ip(**req_copy)
- def test_remove_instance_network_interface_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_remove_instance_network_interface_floating_ip_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_remove_instance_network_interface_floating_ip_value_error()
+ self.test_delete_floating_ip_value_error()
- # Disable retries and run test_remove_instance_network_interface_floating_ip_value_error.
+ # Disable retries and run test_delete_floating_ip_value_error.
_service.disable_retries()
- self.test_remove_instance_network_interface_floating_ip_value_error()
+ self.test_delete_floating_ip_value_error()
-class TestGetInstanceNetworkInterfaceFloatingIp:
+class TestGetFloatingIp:
"""
- Test Class for get_instance_network_interface_floating_ip
+ Test Class for get_floating_ip
"""
@responses.activate
- def test_get_instance_network_interface_floating_ip_all_params(self):
+ def test_get_floating_ip_all_params(self):
"""
- get_instance_network_interface_floating_ip()
+ get_floating_ip()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -12971,14 +12263,10 @@ def test_get_instance_network_interface_floating_ip_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_instance_network_interface_floating_ip(
- instance_id,
- network_interface_id,
+ response = _service.get_floating_ip(
id,
headers={},
)
@@ -12987,22 +12275,22 @@ def test_get_instance_network_interface_floating_ip_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_network_interface_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_get_instance_network_interface_floating_ip_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_instance_network_interface_floating_ip_all_params()
+ self.test_get_floating_ip_all_params()
- # Disable retries and run test_get_instance_network_interface_floating_ip_all_params.
+ # Disable retries and run test_get_floating_ip_all_params.
_service.disable_retries()
- self.test_get_instance_network_interface_floating_ip_all_params()
+ self.test_get_floating_ip_all_params()
@responses.activate
- def test_get_instance_network_interface_floating_ip_value_error(self):
+ def test_get_floating_ip_value_error(self):
"""
- test_get_instance_network_interface_floating_ip_value_error()
+ test_get_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -13013,133 +12301,203 @@ def test_get_instance_network_interface_floating_ip_value_error(self):
)
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_network_interface_floating_ip(**req_copy)
+ _service.get_floating_ip(**req_copy)
- def test_get_instance_network_interface_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_get_instance_network_interface_floating_ip_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_instance_network_interface_floating_ip_value_error()
+ self.test_get_floating_ip_value_error()
- # Disable retries and run test_get_instance_network_interface_floating_ip_value_error.
+ # Disable retries and run test_get_floating_ip_value_error.
_service.disable_retries()
- self.test_get_instance_network_interface_floating_ip_value_error()
+ self.test_get_floating_ip_value_error()
-class TestAddInstanceNetworkInterfaceFloatingIp:
+class TestUpdateFloatingIp:
"""
- Test Class for add_instance_network_interface_floating_ip
+ Test Class for update_floating_ip
"""
@responses.activate
- def test_add_instance_network_interface_floating_ip_all_params(self):
+ def test_update_floating_ip_all_params(self):
"""
- add_instance_network_interface_floating_ip()
+ update_floating_ip()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
+ # Construct a dict representation of a FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
+ floating_ip_target_patch_model = {}
+ floating_ip_target_patch_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
+
+ # 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
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
+ floating_ip_patch = floating_ip_patch_model
# Invoke method
- response = _service.add_instance_network_interface_floating_ip(
- instance_id,
- network_interface_id,
+ response = _service.update_floating_ip(
id,
+ floating_ip_patch,
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 == floating_ip_patch
- def test_add_instance_network_interface_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_add_instance_network_interface_floating_ip_all_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_add_instance_network_interface_floating_ip_all_params()
+ self.test_update_floating_ip_all_params()
- # Disable retries and run test_add_instance_network_interface_floating_ip_all_params.
+ # Disable retries and run test_update_floating_ip_all_params.
_service.disable_retries()
- self.test_add_instance_network_interface_floating_ip_all_params()
+ self.test_update_floating_ip_all_params()
@responses.activate
- def test_add_instance_network_interface_floating_ip_value_error(self):
+ def test_update_floating_ip_value_error(self):
"""
- test_add_instance_network_interface_floating_ip_value_error()
+ test_update_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
+ # Construct a dict representation of a FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
+ floating_ip_target_patch_model = {}
+ floating_ip_target_patch_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
+
+ # 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
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
+ floating_ip_patch = floating_ip_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "network_interface_id": network_interface_id,
"id": id,
+ "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.add_instance_network_interface_floating_ip(**req_copy)
+ _service.update_floating_ip(**req_copy)
- def test_add_instance_network_interface_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_add_instance_network_interface_floating_ip_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_add_instance_network_interface_floating_ip_value_error()
+ self.test_update_floating_ip_value_error()
- # Disable retries and run test_add_instance_network_interface_floating_ip_value_error.
+ # Disable retries and run test_update_floating_ip_value_error.
_service.disable_retries()
- self.test_add_instance_network_interface_floating_ip_value_error()
+ self.test_update_floating_ip_value_error()
-class TestListInstanceNetworkInterfaceIps:
+# endregion
+##############################################################################
+# End of Service: FloatingIPs
+##############################################################################
+
+##############################################################################
+# Start of Service: FlowLogCollectors
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_instance_network_interface_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 TestListFlowLogCollectors:
+ """
+ Test Class for list_flow_log_collectors
"""
@responses.activate
- def test_list_instance_network_interface_ips_all_params(self):
+ def test_list_flow_log_collectors_all_params(self):
"""
- list_instance_network_interface_ips()
+ list_flow_log_collectors()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response = '{"first": {"href": "href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -13149,17 +12507,27 @@ def test_list_instance_network_interface_ips_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
start = 'testString'
limit = 50
+ resource_group_id = 'testString'
+ name = 'my-name'
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
+ target_id = 'testString'
+ target_resource_type = 'testString'
# Invoke method
- response = _service.list_instance_network_interface_ips(
- instance_id,
- network_interface_id,
+ response = _service.list_flow_log_collectors(
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,
headers={},
)
@@ -13171,24 +12539,31 @@ def test_list_instance_network_interface_ips_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 '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 'target.id={}'.format(target_id) in query_string
+ assert 'target.resource_type={}'.format(target_resource_type) in query_string
- def test_list_instance_network_interface_ips_all_params_with_retries(self):
- # Enable retries and run test_list_instance_network_interface_ips_all_params.
+ def test_list_flow_log_collectors_all_params_with_retries(self):
+ # Enable retries and run test_list_flow_log_collectors_all_params.
_service.enable_retries()
- self.test_list_instance_network_interface_ips_all_params()
+ self.test_list_flow_log_collectors_all_params()
- # Disable retries and run test_list_instance_network_interface_ips_all_params.
+ # Disable retries and run test_list_flow_log_collectors_all_params.
_service.disable_retries()
- self.test_list_instance_network_interface_ips_all_params()
+ self.test_list_flow_log_collectors_all_params()
@responses.activate
- def test_list_instance_network_interface_ips_required_params(self):
+ def test_list_flow_log_collectors_required_params(self):
"""
- test_list_instance_network_interface_ips_required_params()
+ test_list_flow_log_collectors_required_params()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response = '{"first": {"href": "href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -13197,38 +12572,30 @@ def test_list_instance_network_interface_ips_required_params(self):
status=200,
)
- # Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
-
# Invoke method
- response = _service.list_instance_network_interface_ips(
- instance_id,
- network_interface_id,
- headers={},
- )
+ response = _service.list_flow_log_collectors()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_network_interface_ips_required_params_with_retries(self):
- # Enable retries and run test_list_instance_network_interface_ips_required_params.
+ def test_list_flow_log_collectors_required_params_with_retries(self):
+ # Enable retries and run test_list_flow_log_collectors_required_params.
_service.enable_retries()
- self.test_list_instance_network_interface_ips_required_params()
+ self.test_list_flow_log_collectors_required_params()
- # Disable retries and run test_list_instance_network_interface_ips_required_params.
+ # Disable retries and run test_list_flow_log_collectors_required_params.
_service.disable_retries()
- self.test_list_instance_network_interface_ips_required_params()
+ self.test_list_flow_log_collectors_required_params()
@responses.activate
- def test_list_instance_network_interface_ips_value_error(self):
+ def test_list_flow_log_collectors_value_error(self):
"""
- test_list_instance_network_interface_ips_value_error()
+ test_list_flow_log_collectors_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response = '{"first": {"href": "href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -13237,38 +12604,32 @@ def test_list_instance_network_interface_ips_value_error(self):
status=200,
)
- # Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_network_interface_ips(**req_copy)
+ _service.list_flow_log_collectors(**req_copy)
- def test_list_instance_network_interface_ips_value_error_with_retries(self):
- # Enable retries and run test_list_instance_network_interface_ips_value_error.
+ def test_list_flow_log_collectors_value_error_with_retries(self):
+ # Enable retries and run test_list_flow_log_collectors_value_error.
_service.enable_retries()
- self.test_list_instance_network_interface_ips_value_error()
+ self.test_list_flow_log_collectors_value_error()
- # Disable retries and run test_list_instance_network_interface_ips_value_error.
+ # Disable retries and run test_list_flow_log_collectors_value_error.
_service.disable_retries()
- self.test_list_instance_network_interface_ips_value_error()
+ self.test_list_flow_log_collectors_value_error()
@responses.activate
- def test_list_instance_network_interface_ips_with_pager_get_next(self):
+ def test_list_flow_log_collectors_with_pager_get_next(self):
"""
- test_list_instance_network_interface_ips_with_pager_get_next()
+ test_list_flow_log_collectors_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -13286,11 +12647,16 @@ def test_list_instance_network_interface_ips_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = InstanceNetworkInterfaceIpsPager(
+ pager = FlowLogCollectorsPager(
client=_service,
- instance_id='testString',
- network_interface_id='testString',
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ target_id='testString',
+ target_resource_type='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -13299,14 +12665,14 @@ def test_list_instance_network_interface_ips_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_instance_network_interface_ips_with_pager_get_all(self):
+ def test_list_flow_log_collectors_with_pager_get_all(self):
"""
- test_list_instance_network_interface_ips_with_pager_get_all()
+ test_list_flow_log_collectors_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -13323,119 +12689,235 @@ def test_list_instance_network_interface_ips_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = InstanceNetworkInterfaceIpsPager(
+ pager = FlowLogCollectorsPager(
client=_service,
- instance_id='testString',
- network_interface_id='testString',
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ target_id='testString',
+ target_resource_type='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestGetInstanceNetworkInterfaceIp:
+class TestCreateFlowLogCollector:
"""
- Test Class for get_instance_network_interface_ip
+ Test Class for create_flow_log_collector
"""
@responses.activate
- def test_get_instance_network_interface_ip_all_params(self):
+ def test_create_flow_log_collector_all_params(self):
"""
- get_instance_network_interface_ip()
+ create_flow_log_collector()
"""
# Set up mock
- url = preprocess_url('/instances/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
+ legacy_cloud_object_storage_bucket_identity_model = {}
+ legacy_cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+
+ # Construct a dict representation of a FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityById model
+ flow_log_collector_target_prototype_model = {}
+ flow_log_collector_target_prototype_model['id'] = '0717-d54eb633-98ea-459d-aa00-6a8e780175a7'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
- id = 'testString'
+ storage_bucket = legacy_cloud_object_storage_bucket_identity_model
+ target = flow_log_collector_target_prototype_model
+ active = False
+ name = 'my-flow-log-collector'
+ resource_group = resource_group_identity_model
# Invoke method
- response = _service.get_instance_network_interface_ip(
- instance_id,
- network_interface_id,
- id,
+ response = _service.create_flow_log_collector(
+ storage_bucket,
+ target,
+ active=active,
+ name=name,
+ resource_group=resource_group,
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['storage_bucket'] == legacy_cloud_object_storage_bucket_identity_model
+ assert req_body['target'] == flow_log_collector_target_prototype_model
+ assert req_body['active'] == False
+ assert req_body['name'] == 'my-flow-log-collector'
+ assert req_body['resource_group'] == resource_group_identity_model
- def test_get_instance_network_interface_ip_all_params_with_retries(self):
- # Enable retries and run test_get_instance_network_interface_ip_all_params.
+ def test_create_flow_log_collector_all_params_with_retries(self):
+ # Enable retries and run test_create_flow_log_collector_all_params.
_service.enable_retries()
- self.test_get_instance_network_interface_ip_all_params()
+ self.test_create_flow_log_collector_all_params()
- # Disable retries and run test_get_instance_network_interface_ip_all_params.
+ # Disable retries and run test_create_flow_log_collector_all_params.
_service.disable_retries()
- self.test_get_instance_network_interface_ip_all_params()
+ self.test_create_flow_log_collector_all_params()
@responses.activate
- def test_get_instance_network_interface_ip_value_error(self):
+ def test_create_flow_log_collector_value_error(self):
"""
- test_get_instance_network_interface_ip_value_error()
+ test_create_flow_log_collector_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/flow_log_collectors')
+ mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
+ )
+
+ # Construct a dict representation of a LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
+ legacy_cloud_object_storage_bucket_identity_model = {}
+ legacy_cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+
+ # Construct a dict representation of a FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityById model
+ flow_log_collector_target_prototype_model = {}
+ flow_log_collector_target_prototype_model['id'] = '0717-d54eb633-98ea-459d-aa00-6a8e780175a7'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Set up parameter values
+ storage_bucket = legacy_cloud_object_storage_bucket_identity_model
+ target = flow_log_collector_target_prototype_model
+ active = False
+ name = 'my-flow-log-collector'
+ resource_group = resource_group_identity_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "storage_bucket": storage_bucket,
+ "target": target,
+ }
+ 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_flow_log_collector(**req_copy)
+
+ def test_create_flow_log_collector_value_error_with_retries(self):
+ # Enable retries and run test_create_flow_log_collector_value_error.
+ _service.enable_retries()
+ self.test_create_flow_log_collector_value_error()
+
+ # Disable retries and run test_create_flow_log_collector_value_error.
+ _service.disable_retries()
+ self.test_create_flow_log_collector_value_error()
+
+
+class TestDeleteFlowLogCollector:
+ """
+ Test Class for delete_flow_log_collector
+ """
+
+ @responses.activate
+ def test_delete_flow_log_collector_all_params(self):
+ """
+ delete_flow_log_collector()
+ """
+ # Set up mock
+ url = preprocess_url('/flow_log_collectors/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_flow_log_collector(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 204
+
+ def test_delete_flow_log_collector_all_params_with_retries(self):
+ # Enable retries and run test_delete_flow_log_collector_all_params.
+ _service.enable_retries()
+ self.test_delete_flow_log_collector_all_params()
+
+ # Disable retries and run test_delete_flow_log_collector_all_params.
+ _service.disable_retries()
+ self.test_delete_flow_log_collector_all_params()
+
+ @responses.activate
+ def test_delete_flow_log_collector_value_error(self):
+ """
+ test_delete_flow_log_collector_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/flow_log_collectors/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
)
# Set up parameter values
- instance_id = 'testString'
- network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_network_interface_ip(**req_copy)
+ _service.delete_flow_log_collector(**req_copy)
- def test_get_instance_network_interface_ip_value_error_with_retries(self):
- # Enable retries and run test_get_instance_network_interface_ip_value_error.
+ def test_delete_flow_log_collector_value_error_with_retries(self):
+ # Enable retries and run test_delete_flow_log_collector_value_error.
_service.enable_retries()
- self.test_get_instance_network_interface_ip_value_error()
+ self.test_delete_flow_log_collector_value_error()
- # Disable retries and run test_get_instance_network_interface_ip_value_error.
+ # Disable retries and run test_delete_flow_log_collector_value_error.
_service.disable_retries()
- self.test_get_instance_network_interface_ip_value_error()
+ self.test_delete_flow_log_collector_value_error()
-class TestListInstanceVolumeAttachments:
+class TestGetFlowLogCollector:
"""
- Test Class for list_instance_volume_attachments
+ Test Class for get_flow_log_collector
"""
@responses.activate
- def test_list_instance_volume_attachments_all_params(self):
+ def test_get_flow_log_collector_all_params(self):
"""
- list_instance_volume_attachments()
+ get_flow_log_collector()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments')
- mock_response = '{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}'
+ url = preprocess_url('/flow_log_collectors/testString')
+ mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -13445,11 +12927,11 @@ def test_list_instance_volume_attachments_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_instance_volume_attachments(
- instance_id,
+ response = _service.get_flow_log_collector(
+ id,
headers={},
)
@@ -13457,23 +12939,23 @@ def test_list_instance_volume_attachments_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_volume_attachments_all_params_with_retries(self):
- # Enable retries and run test_list_instance_volume_attachments_all_params.
+ def test_get_flow_log_collector_all_params_with_retries(self):
+ # Enable retries and run test_get_flow_log_collector_all_params.
_service.enable_retries()
- self.test_list_instance_volume_attachments_all_params()
+ self.test_get_flow_log_collector_all_params()
- # Disable retries and run test_list_instance_volume_attachments_all_params.
+ # Disable retries and run test_get_flow_log_collector_all_params.
_service.disable_retries()
- self.test_list_instance_volume_attachments_all_params()
+ self.test_get_flow_log_collector_all_params()
@responses.activate
- def test_list_instance_volume_attachments_value_error(self):
+ def test_get_flow_log_collector_value_error(self):
"""
- test_list_instance_volume_attachments_value_error()
+ test_get_flow_log_collector_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments')
- mock_response = '{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}'
+ url = preprocess_url('/flow_log_collectors/testString')
+ mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -13483,223 +12965,347 @@ def test_list_instance_volume_attachments_value_error(self):
)
# Set up parameter values
- instance_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_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_instance_volume_attachments(**req_copy)
+ _service.get_flow_log_collector(**req_copy)
- def test_list_instance_volume_attachments_value_error_with_retries(self):
- # Enable retries and run test_list_instance_volume_attachments_value_error.
+ def test_get_flow_log_collector_value_error_with_retries(self):
+ # Enable retries and run test_get_flow_log_collector_value_error.
_service.enable_retries()
- self.test_list_instance_volume_attachments_value_error()
+ self.test_get_flow_log_collector_value_error()
- # Disable retries and run test_list_instance_volume_attachments_value_error.
+ # Disable retries and run test_get_flow_log_collector_value_error.
_service.disable_retries()
- self.test_list_instance_volume_attachments_value_error()
+ self.test_get_flow_log_collector_value_error()
-class TestCreateInstanceVolumeAttachment:
+class TestUpdateFlowLogCollector:
"""
- Test Class for create_instance_volume_attachment
+ Test Class for update_flow_log_collector
"""
@responses.activate
- def test_create_instance_volume_attachment_all_params(self):
+ def test_update_flow_log_collector_all_params(self):
"""
- create_instance_volume_attachment()
+ update_flow_log_collector()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments')
- mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
+ url = preprocess_url('/flow_log_collectors/testString')
+ mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
- volume_attachment_prototype_volume_model = {}
- volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+ # Construct a dict representation of a FlowLogCollectorPatch model
+ flow_log_collector_patch_model = {}
+ flow_log_collector_patch_model['active'] = False
+ flow_log_collector_patch_model['name'] = 'my-flow-log-collector'
# Set up parameter values
- instance_id = 'testString'
- volume = volume_attachment_prototype_volume_model
- delete_volume_on_instance_delete = False
- name = 'my-volume-attachment'
+ id = 'testString'
+ flow_log_collector_patch = flow_log_collector_patch_model
+
+ # Invoke method
+ response = _service.update_flow_log_collector(
+ id,
+ flow_log_collector_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 == flow_log_collector_patch
+
+ def test_update_flow_log_collector_all_params_with_retries(self):
+ # Enable retries and run test_update_flow_log_collector_all_params.
+ _service.enable_retries()
+ self.test_update_flow_log_collector_all_params()
+
+ # Disable retries and run test_update_flow_log_collector_all_params.
+ _service.disable_retries()
+ self.test_update_flow_log_collector_all_params()
+
+ @responses.activate
+ def test_update_flow_log_collector_value_error(self):
+ """
+ test_update_flow_log_collector_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/flow_log_collectors/testString')
+ mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 FlowLogCollectorPatch model
+ flow_log_collector_patch_model = {}
+ flow_log_collector_patch_model['active'] = False
+ flow_log_collector_patch_model['name'] = 'my-flow-log-collector'
+
+ # Set up parameter values
+ id = 'testString'
+ flow_log_collector_patch = flow_log_collector_patch_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "flow_log_collector_patch": flow_log_collector_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_flow_log_collector(**req_copy)
+
+ def test_update_flow_log_collector_value_error_with_retries(self):
+ # Enable retries and run test_update_flow_log_collector_value_error.
+ _service.enable_retries()
+ self.test_update_flow_log_collector_value_error()
+
+ # Disable retries and run test_update_flow_log_collector_value_error.
+ _service.disable_retries()
+ self.test_update_flow_log_collector_value_error()
+
+
+# endregion
+##############################################################################
+# End of Service: FlowLogCollectors
+##############################################################################
+
+##############################################################################
+# Start of Service: Geography
+##############################################################################
+# 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 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": "https://us-south.iaas.cloud.ibm.com", "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.create_instance_volume_attachment(
- instance_id,
- volume,
- delete_volume_on_instance_delete=delete_volume_on_instance_delete,
- name=name,
- headers={},
- )
+ response = _service.list_regions()
# 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'] == volume_attachment_prototype_volume_model
- assert req_body['delete_volume_on_instance_delete'] == False
- assert req_body['name'] == 'my-volume-attachment'
+ assert response.status_code == 200
- def test_create_instance_volume_attachment_all_params_with_retries(self):
- # Enable retries and run test_create_instance_volume_attachment_all_params.
+ def test_list_regions_all_params_with_retries(self):
+ # Enable retries and run test_list_regions_all_params.
_service.enable_retries()
- self.test_create_instance_volume_attachment_all_params()
+ self.test_list_regions_all_params()
- # Disable retries and run test_create_instance_volume_attachment_all_params.
+ # Disable retries and run test_list_regions_all_params.
_service.disable_retries()
- self.test_create_instance_volume_attachment_all_params()
+ self.test_list_regions_all_params()
@responses.activate
- def test_create_instance_volume_attachment_value_error(self):
+ def test_list_regions_value_error(self):
"""
- test_create_instance_volume_attachment_value_error()
+ test_list_regions_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments')
- mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
+ url = preprocess_url('/regions')
+ mock_response = '{"regions": [{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
- volume_attachment_prototype_volume_model = {}
- volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
-
- # Set up parameter values
- instance_id = 'testString'
- volume = volume_attachment_prototype_volume_model
- delete_volume_on_instance_delete = False
- name = 'my-volume-attachment'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "volume": volume,
}
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_instance_volume_attachment(**req_copy)
+ _service.list_regions(**req_copy)
- def test_create_instance_volume_attachment_value_error_with_retries(self):
- # Enable retries and run test_create_instance_volume_attachment_value_error.
+ def test_list_regions_value_error_with_retries(self):
+ # Enable retries and run test_list_regions_value_error.
_service.enable_retries()
- self.test_create_instance_volume_attachment_value_error()
+ self.test_list_regions_value_error()
- # Disable retries and run test_create_instance_volume_attachment_value_error.
+ # Disable retries and run test_list_regions_value_error.
_service.disable_retries()
- self.test_create_instance_volume_attachment_value_error()
+ self.test_list_regions_value_error()
-class TestDeleteInstanceVolumeAttachment:
+class TestGetRegion:
"""
- Test Class for delete_instance_volume_attachment
+ Test Class for get_region
"""
@responses.activate
- def test_delete_instance_volume_attachment_all_params(self):
+ def test_get_region_all_params(self):
"""
- delete_instance_volume_attachment()
+ get_region()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments/testString')
+ url = preprocess_url('/regions/us-south')
+ mock_response = '{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ name = 'us-south'
# Invoke method
- response = _service.delete_instance_volume_attachment(
- instance_id,
- id,
+ response = _service.get_region(
+ name,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_instance_volume_attachment_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_volume_attachment_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_delete_instance_volume_attachment_all_params()
+ self.test_get_region_all_params()
- # Disable retries and run test_delete_instance_volume_attachment_all_params.
+ # Disable retries and run test_get_region_all_params.
_service.disable_retries()
- self.test_delete_instance_volume_attachment_all_params()
+ self.test_get_region_all_params()
@responses.activate
- def test_delete_instance_volume_attachment_value_error(self):
+ def test_get_region_value_error(self):
"""
- test_delete_instance_volume_attachment_value_error()
+ test_get_region_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments/testString')
+ url = preprocess_url('/regions/us-south')
+ mock_response = '{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ name = 'us-south'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "id": id,
+ "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.delete_instance_volume_attachment(**req_copy)
+ _service.get_region(**req_copy)
- def test_delete_instance_volume_attachment_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_volume_attachment_value_error.
+ def test_get_region_value_error_with_retries(self):
+ # Enable retries and run test_get_region_value_error.
_service.enable_retries()
- self.test_delete_instance_volume_attachment_value_error()
+ self.test_get_region_value_error()
- # Disable retries and run test_delete_instance_volume_attachment_value_error.
+ # Disable retries and run test_get_region_value_error.
_service.disable_retries()
- self.test_delete_instance_volume_attachment_value_error()
+ self.test_get_region_value_error()
-class TestGetInstanceVolumeAttachment:
+class TestListRegionZones:
"""
- Test Class for get_instance_volume_attachment
+ Test Class for list_region_zones
"""
@responses.activate
- def test_get_instance_volume_attachment_all_params(self):
+ def test_list_region_zones_all_params(self):
"""
- get_instance_volume_attachment()
+ list_region_zones()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments/testString')
- mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
+ url = preprocess_url('/regions/us-south/zones')
+ mock_response = '{"zones": [{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}]}'
responses.add(
responses.GET,
url,
@@ -13709,13 +13315,11 @@ def test_get_instance_volume_attachment_all_params(self):
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ region_name = 'us-south'
# Invoke method
- response = _service.get_instance_volume_attachment(
- instance_id,
- id,
+ response = _service.list_region_zones(
+ region_name,
headers={},
)
@@ -13723,23 +13327,23 @@ def test_get_instance_volume_attachment_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_volume_attachment_all_params_with_retries(self):
- # Enable retries and run test_get_instance_volume_attachment_all_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_get_instance_volume_attachment_all_params()
+ self.test_list_region_zones_all_params()
- # Disable retries and run test_get_instance_volume_attachment_all_params.
+ # Disable retries and run test_list_region_zones_all_params.
_service.disable_retries()
- self.test_get_instance_volume_attachment_all_params()
+ self.test_list_region_zones_all_params()
@responses.activate
- def test_get_instance_volume_attachment_value_error(self):
+ def test_list_region_zones_value_error(self):
"""
- test_get_instance_volume_attachment_value_error()
+ test_list_region_zones_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments/testString')
- mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
+ url = preprocess_url('/regions/us-south/zones')
+ mock_response = '{"zones": [{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}]}'
responses.add(
responses.GET,
url,
@@ -13749,138 +13353,119 @@ def test_get_instance_volume_attachment_value_error(self):
)
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
+ region_name = 'us-south'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "id": id,
+ "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.get_instance_volume_attachment(**req_copy)
+ _service.list_region_zones(**req_copy)
- def test_get_instance_volume_attachment_value_error_with_retries(self):
- # Enable retries and run test_get_instance_volume_attachment_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_get_instance_volume_attachment_value_error()
+ self.test_list_region_zones_value_error()
- # Disable retries and run test_get_instance_volume_attachment_value_error.
+ # Disable retries and run test_list_region_zones_value_error.
_service.disable_retries()
- self.test_get_instance_volume_attachment_value_error()
+ self.test_list_region_zones_value_error()
-class TestUpdateInstanceVolumeAttachment:
+class TestGetRegionZone:
"""
- Test Class for update_instance_volume_attachment
+ Test Class for get_region_zone
"""
@responses.activate
- def test_update_instance_volume_attachment_all_params(self):
+ def test_get_region_zone_all_params(self):
"""
- update_instance_volume_attachment()
+ get_region_zone()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments/testString')
- mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
+ url = preprocess_url('/regions/us-south/zones/us-south-1')
+ mock_response = '{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a VolumeAttachmentPatch model
- volume_attachment_patch_model = {}
- volume_attachment_patch_model['delete_volume_on_instance_delete'] = True
- volume_attachment_patch_model['name'] = 'my-volume-attachment'
-
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
- volume_attachment_patch = volume_attachment_patch_model
+ region_name = 'us-south'
+ name = 'us-south-1'
# Invoke method
- response = _service.update_instance_volume_attachment(
- instance_id,
- id,
- volume_attachment_patch,
+ response = _service.get_region_zone(
+ region_name,
+ name,
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_attachment_patch
- def test_update_instance_volume_attachment_all_params_with_retries(self):
- # Enable retries and run test_update_instance_volume_attachment_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_update_instance_volume_attachment_all_params()
+ self.test_get_region_zone_all_params()
- # Disable retries and run test_update_instance_volume_attachment_all_params.
+ # Disable retries and run test_get_region_zone_all_params.
_service.disable_retries()
- self.test_update_instance_volume_attachment_all_params()
+ self.test_get_region_zone_all_params()
@responses.activate
- def test_update_instance_volume_attachment_value_error(self):
+ def test_get_region_zone_value_error(self):
"""
- test_update_instance_volume_attachment_value_error()
+ test_get_region_zone_value_error()
"""
# Set up mock
- url = preprocess_url('/instances/testString/volume_attachments/testString')
- mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
+ url = preprocess_url('/regions/us-south/zones/us-south-1')
+ mock_response = '{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a VolumeAttachmentPatch model
- volume_attachment_patch_model = {}
- volume_attachment_patch_model['delete_volume_on_instance_delete'] = True
- volume_attachment_patch_model['name'] = 'my-volume-attachment'
-
# Set up parameter values
- instance_id = 'testString'
- id = 'testString'
- volume_attachment_patch = volume_attachment_patch_model
+ region_name = 'us-south'
+ name = 'us-south-1'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_id": instance_id,
- "id": id,
- "volume_attachment_patch": volume_attachment_patch,
+ "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.update_instance_volume_attachment(**req_copy)
+ _service.get_region_zone(**req_copy)
- def test_update_instance_volume_attachment_value_error_with_retries(self):
- # Enable retries and run test_update_instance_volume_attachment_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_update_instance_volume_attachment_value_error()
+ self.test_get_region_zone_value_error()
- # Disable retries and run test_update_instance_volume_attachment_value_error.
+ # Disable retries and run test_get_region_zone_value_error.
_service.disable_retries()
- self.test_update_instance_volume_attachment_value_error()
+ self.test_get_region_zone_value_error()
# endregion
##############################################################################
-# End of Service: Instances
+# End of Service: Geography
##############################################################################
##############################################################################
-# Start of Service: InstanceGroups
+# Start of Service: Images
##############################################################################
# region
@@ -13931,19 +13516,19 @@ def test_new_instance_required_param_none(self):
)
-class TestListInstanceGroups:
+class TestListImages:
"""
- Test Class for list_instance_groups
+ Test Class for list_images
"""
@responses.activate
- def test_list_instance_groups_all_params(self):
+ def test_list_images_all_params(self):
"""
- list_instance_groups()
+ list_images()
"""
# Set up mock
- url = preprocess_url('/instance_groups')
- mock_response = '{"first": {"href": "href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images')
+ mock_response = '{"first": {"href": "href"}, "images": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -13955,11 +13540,23 @@ def test_list_instance_groups_all_params(self):
# Set up parameter values
start = 'testString'
limit = 50
+ resource_group_id = 'testString'
+ name = 'my-name'
+ status = ['available']
+ visibility = 'private'
+ user_data_format = ['cloud_init']
+ remote_account_id = 'bb1b52262f7441a586f49068482f1e60'
# Invoke method
- response = _service.list_instance_groups(
+ response = _service.list_images(
start=start,
limit=limit,
+ resource_group_id=resource_group_id,
+ name=name,
+ status=status,
+ visibility=visibility,
+ user_data_format=user_data_format,
+ remote_account_id=remote_account_id,
headers={},
)
@@ -13971,24 +13568,30 @@ def test_list_instance_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 'status={}'.format(','.join(status)) in query_string
+ assert 'visibility={}'.format(visibility) in query_string
+ assert 'user_data_format={}'.format(','.join(user_data_format)) in query_string
+ assert 'remote.account.id={}'.format(remote_account_id) in query_string
- def test_list_instance_groups_all_params_with_retries(self):
- # Enable retries and run test_list_instance_groups_all_params.
+ def test_list_images_all_params_with_retries(self):
+ # Enable retries and run test_list_images_all_params.
_service.enable_retries()
- self.test_list_instance_groups_all_params()
+ self.test_list_images_all_params()
- # Disable retries and run test_list_instance_groups_all_params.
+ # Disable retries and run test_list_images_all_params.
_service.disable_retries()
- self.test_list_instance_groups_all_params()
+ self.test_list_images_all_params()
@responses.activate
- def test_list_instance_groups_required_params(self):
+ def test_list_images_required_params(self):
"""
- test_list_instance_groups_required_params()
+ test_list_images_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups')
- mock_response = '{"first": {"href": "href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images')
+ mock_response = '{"first": {"href": "href"}, "images": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -13998,29 +13601,29 @@ def test_list_instance_groups_required_params(self):
)
# Invoke method
- response = _service.list_instance_groups()
+ response = _service.list_images()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_groups_required_params_with_retries(self):
- # Enable retries and run test_list_instance_groups_required_params.
+ def test_list_images_required_params_with_retries(self):
+ # Enable retries and run test_list_images_required_params.
_service.enable_retries()
- self.test_list_instance_groups_required_params()
+ self.test_list_images_required_params()
- # Disable retries and run test_list_instance_groups_required_params.
+ # Disable retries and run test_list_images_required_params.
_service.disable_retries()
- self.test_list_instance_groups_required_params()
+ self.test_list_images_required_params()
@responses.activate
- def test_list_instance_groups_value_error(self):
+ def test_list_images_value_error(self):
"""
- test_list_instance_groups_value_error()
+ test_list_images_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups')
- mock_response = '{"first": {"href": "href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images')
+ mock_response = '{"first": {"href": "href"}, "images": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -14035,26 +13638,26 @@ def test_list_instance_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_instance_groups(**req_copy)
+ _service.list_images(**req_copy)
- def test_list_instance_groups_value_error_with_retries(self):
- # Enable retries and run test_list_instance_groups_value_error.
+ def test_list_images_value_error_with_retries(self):
+ # Enable retries and run test_list_images_value_error.
_service.enable_retries()
- self.test_list_instance_groups_value_error()
+ self.test_list_images_value_error()
- # Disable retries and run test_list_instance_groups_value_error.
+ # Disable retries and run test_list_images_value_error.
_service.disable_retries()
- self.test_list_instance_groups_value_error()
+ self.test_list_images_value_error()
@responses.activate
- def test_list_instance_groups_with_pager_get_next(self):
+ def test_list_images_with_pager_get_next(self):
"""
- test_list_instance_groups_with_pager_get_next()
+ test_list_images_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ url = preprocess_url('/images')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"images":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"images":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -14072,9 +13675,15 @@ def test_list_instance_groups_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = InstanceGroupsPager(
+ pager = ImagesPager(
client=_service,
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ status=['available'],
+ visibility='private',
+ user_data_format=['cloud_init'],
+ remote_account_id='bb1b52262f7441a586f49068482f1e60',
)
while pager.has_next():
next_page = pager.get_next()
@@ -14083,14 +13692,14 @@ def test_list_instance_groups_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_instance_groups_with_pager_get_all(self):
+ def test_list_images_with_pager_get_all(self):
"""
- test_list_instance_groups_with_pager_get_all()
+ test_list_images_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ url = preprocess_url('/images')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"images":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"images":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deprecation_at":"2019-01-01T12:00:00.000Z","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"file":{"checksums":{"sha256":"e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"},"size":1},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":24,"name":"my-image","obsolescence_at":"2019-01-01T12:00:00.000Z","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"}},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"image","source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"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_data_format":"cloud_init","visibility":"private"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -14107,28 +13716,34 @@ def test_list_instance_groups_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = InstanceGroupsPager(
+ pager = ImagesPager(
client=_service,
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ status=['available'],
+ visibility='private',
+ user_data_format=['cloud_init'],
+ remote_account_id='bb1b52262f7441a586f49068482f1e60',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateInstanceGroup:
+class TestCreateImage:
"""
- Test Class for create_instance_group
+ Test Class for create_image
"""
@responses.activate
- def test_create_instance_group_all_params(self):
+ def test_create_image_all_params(self):
"""
- create_instance_group()
+ create_image()
"""
# Set up mock
- url = preprocess_url('/instance_groups')
- mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/images')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
responses.add(
responses.POST,
url,
@@ -14137,46 +13752,46 @@ def test_create_instance_group_all_params(self):
status=201,
)
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+ # Construct a dict representation of a ImageAllowedUsePrototype model
+ image_allowed_use_prototype_model = {}
+ image_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ image_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a ImageFilePrototype model
+ image_file_prototype_model = {}
+ image_file_prototype_model['href'] = 'cos://us-south/my-bucket/my-image.qcow2'
+
+ # Construct a dict representation of a OperatingSystemIdentityByName model
+ operating_system_identity_model = {}
+ operating_system_identity_model['name'] = 'debian-9-amd64'
+
+ # Construct a dict representation of a ImagePrototypeImageByFile model
+ image_prototype_model = {}
+ image_prototype_model['allowed_use'] = image_allowed_use_prototype_model
+ image_prototype_model['deprecation_at'] = '2019-01-01T12:00:00Z'
+ image_prototype_model['name'] = 'my-image'
+ image_prototype_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
+ image_prototype_model['resource_group'] = resource_group_identity_model
+ image_prototype_model['encrypted_data_key'] = 'testString'
+ image_prototype_model['encryption_key'] = encryption_key_identity_model
+ image_prototype_model['file'] = image_file_prototype_model
+ image_prototype_model['operating_system'] = operating_system_identity_model
+
# Set up parameter values
- instance_template = instance_template_identity_model
- subnets = [subnet_identity_model]
- application_port = 22
- load_balancer = load_balancer_identity_model
- load_balancer_pool = load_balancer_pool_identity_model
- membership_count = 10
- name = 'my-instance-group'
- resource_group = resource_group_identity_model
+ image_prototype = image_prototype_model
# Invoke method
- response = _service.create_instance_group(
- instance_template,
- subnets,
- application_port=application_port,
- load_balancer=load_balancer,
- load_balancer_pool=load_balancer_pool,
- membership_count=membership_count,
- name=name,
- resource_group=resource_group,
+ response = _service.create_image(
+ image_prototype,
headers={},
)
@@ -14185,32 +13800,25 @@ def test_create_instance_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['instance_template'] == instance_template_identity_model
- assert req_body['subnets'] == [subnet_identity_model]
- assert req_body['application_port'] == 22
- assert req_body['load_balancer'] == load_balancer_identity_model
- assert req_body['load_balancer_pool'] == load_balancer_pool_identity_model
- assert req_body['membership_count'] == 10
- assert req_body['name'] == 'my-instance-group'
- assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body == image_prototype
- def test_create_instance_group_all_params_with_retries(self):
- # Enable retries and run test_create_instance_group_all_params.
+ def test_create_image_all_params_with_retries(self):
+ # Enable retries and run test_create_image_all_params.
_service.enable_retries()
- self.test_create_instance_group_all_params()
+ self.test_create_image_all_params()
- # Disable retries and run test_create_instance_group_all_params.
+ # Disable retries and run test_create_image_all_params.
_service.disable_retries()
- self.test_create_instance_group_all_params()
+ self.test_create_image_all_params()
@responses.activate
- def test_create_instance_group_value_error(self):
+ def test_create_image_value_error(self):
"""
- test_create_instance_group_value_error()
+ test_create_image_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups')
- mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/images')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
responses.add(
responses.POST,
url,
@@ -14219,107 +13827,113 @@ def test_create_instance_group_value_error(self):
status=201,
)
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+ # Construct a dict representation of a ImageAllowedUsePrototype model
+ image_allowed_use_prototype_model = {}
+ image_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ image_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a ImageFilePrototype model
+ image_file_prototype_model = {}
+ image_file_prototype_model['href'] = 'cos://us-south/my-bucket/my-image.qcow2'
+
+ # Construct a dict representation of a OperatingSystemIdentityByName model
+ operating_system_identity_model = {}
+ operating_system_identity_model['name'] = 'debian-9-amd64'
+
+ # Construct a dict representation of a ImagePrototypeImageByFile model
+ image_prototype_model = {}
+ image_prototype_model['allowed_use'] = image_allowed_use_prototype_model
+ image_prototype_model['deprecation_at'] = '2019-01-01T12:00:00Z'
+ image_prototype_model['name'] = 'my-image'
+ image_prototype_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
+ image_prototype_model['resource_group'] = resource_group_identity_model
+ image_prototype_model['encrypted_data_key'] = 'testString'
+ image_prototype_model['encryption_key'] = encryption_key_identity_model
+ image_prototype_model['file'] = image_file_prototype_model
+ image_prototype_model['operating_system'] = operating_system_identity_model
+
# Set up parameter values
- instance_template = instance_template_identity_model
- subnets = [subnet_identity_model]
- application_port = 22
- load_balancer = load_balancer_identity_model
- load_balancer_pool = load_balancer_pool_identity_model
- membership_count = 10
- name = 'my-instance-group'
- resource_group = resource_group_identity_model
+ image_prototype = image_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_template": instance_template,
- "subnets": subnets,
+ "image_prototype": image_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_instance_group(**req_copy)
+ _service.create_image(**req_copy)
- def test_create_instance_group_value_error_with_retries(self):
- # Enable retries and run test_create_instance_group_value_error.
+ def test_create_image_value_error_with_retries(self):
+ # Enable retries and run test_create_image_value_error.
_service.enable_retries()
- self.test_create_instance_group_value_error()
+ self.test_create_image_value_error()
- # Disable retries and run test_create_instance_group_value_error.
+ # Disable retries and run test_create_image_value_error.
_service.disable_retries()
- self.test_create_instance_group_value_error()
+ self.test_create_image_value_error()
-class TestDeleteInstanceGroup:
+class TestDeleteImage:
"""
- Test Class for delete_instance_group
+ Test Class for delete_image
"""
@responses.activate
- def test_delete_instance_group_all_params(self):
+ def test_delete_image_all_params(self):
"""
- delete_instance_group()
+ delete_image()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString')
+ url = preprocess_url('/images/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
id = 'testString'
# Invoke method
- response = _service.delete_instance_group(
+ response = _service.delete_image(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 202
- def test_delete_instance_group_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_all_params.
+ def test_delete_image_all_params_with_retries(self):
+ # Enable retries and run test_delete_image_all_params.
_service.enable_retries()
- self.test_delete_instance_group_all_params()
+ self.test_delete_image_all_params()
- # Disable retries and run test_delete_instance_group_all_params.
+ # Disable retries and run test_delete_image_all_params.
_service.disable_retries()
- self.test_delete_instance_group_all_params()
+ self.test_delete_image_all_params()
@responses.activate
- def test_delete_instance_group_value_error(self):
+ def test_delete_image_value_error(self):
"""
- test_delete_instance_group_value_error()
+ test_delete_image_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString')
+ url = preprocess_url('/images/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
@@ -14332,31 +13946,31 @@ def test_delete_instance_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_instance_group(**req_copy)
+ _service.delete_image(**req_copy)
- def test_delete_instance_group_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_value_error.
+ def test_delete_image_value_error_with_retries(self):
+ # Enable retries and run test_delete_image_value_error.
_service.enable_retries()
- self.test_delete_instance_group_value_error()
+ self.test_delete_image_value_error()
- # Disable retries and run test_delete_instance_group_value_error.
+ # Disable retries and run test_delete_image_value_error.
_service.disable_retries()
- self.test_delete_instance_group_value_error()
+ self.test_delete_image_value_error()
-class TestGetInstanceGroup:
+class TestGetImage:
"""
- Test Class for get_instance_group
+ Test Class for get_image
"""
@responses.activate
- def test_get_instance_group_all_params(self):
+ def test_get_image_all_params(self):
"""
- get_instance_group()
+ get_image()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString')
- mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/images/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
responses.add(
responses.GET,
url,
@@ -14369,7 +13983,7 @@ def test_get_instance_group_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_instance_group(
+ response = _service.get_image(
id,
headers={},
)
@@ -14378,23 +13992,23 @@ def test_get_instance_group_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_group_all_params_with_retries(self):
- # Enable retries and run test_get_instance_group_all_params.
+ def test_get_image_all_params_with_retries(self):
+ # Enable retries and run test_get_image_all_params.
_service.enable_retries()
- self.test_get_instance_group_all_params()
+ self.test_get_image_all_params()
- # Disable retries and run test_get_instance_group_all_params.
+ # Disable retries and run test_get_image_all_params.
_service.disable_retries()
- self.test_get_instance_group_all_params()
+ self.test_get_image_all_params()
@responses.activate
- def test_get_instance_group_value_error(self):
+ def test_get_image_value_error(self):
"""
- test_get_instance_group_value_error()
+ test_get_image_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString')
- mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/images/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
responses.add(
responses.GET,
url,
@@ -14413,31 +14027,31 @@ def test_get_instance_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.get_instance_group(**req_copy)
+ _service.get_image(**req_copy)
- def test_get_instance_group_value_error_with_retries(self):
- # Enable retries and run test_get_instance_group_value_error.
+ def test_get_image_value_error_with_retries(self):
+ # Enable retries and run test_get_image_value_error.
_service.enable_retries()
- self.test_get_instance_group_value_error()
+ self.test_get_image_value_error()
- # Disable retries and run test_get_instance_group_value_error.
+ # Disable retries and run test_get_image_value_error.
_service.disable_retries()
- self.test_get_instance_group_value_error()
+ self.test_get_image_value_error()
-class TestUpdateInstanceGroup:
+class TestUpdateImage:
"""
- Test Class for update_instance_group
+ Test Class for update_image
"""
@responses.activate
- def test_update_instance_group_all_params(self):
+ def test_update_image_all_params(self):
"""
- update_instance_group()
+ update_image()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString')
- mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/images/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
responses.add(
responses.PATCH,
url,
@@ -14446,40 +14060,27 @@ def test_update_instance_group_all_params(self):
status=200,
)
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # Construct a dict representation of a ImageAllowedUsePatch model
+ image_allowed_use_patch_model = {}
+ image_allowed_use_patch_model['api_version'] = '2024-06-23'
+ image_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
- # Construct a dict representation of a InstanceGroupPatch model
- instance_group_patch_model = {}
- instance_group_patch_model['application_port'] = 22
- instance_group_patch_model['instance_template'] = instance_template_identity_model
- instance_group_patch_model['load_balancer'] = load_balancer_identity_model
- instance_group_patch_model['load_balancer_pool'] = load_balancer_pool_identity_model
- instance_group_patch_model['membership_count'] = 20
- instance_group_patch_model['name'] = 'my-instance-group'
- instance_group_patch_model['subnets'] = [subnet_identity_model]
+ # Construct a dict representation of a ImagePatch model
+ image_patch_model = {}
+ image_patch_model['allowed_use'] = image_allowed_use_patch_model
+ image_patch_model['deprecation_at'] = '2019-01-01T12:00:00Z'
+ image_patch_model['name'] = 'my-image'
+ image_patch_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
# Set up parameter values
id = 'testString'
- instance_group_patch = instance_group_patch_model
+ image_patch = image_patch_model
# Invoke method
- response = _service.update_instance_group(
+ response = _service.update_image(
id,
- instance_group_patch,
+ image_patch,
headers={},
)
@@ -14488,25 +14089,25 @@ def test_update_instance_group_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 == instance_group_patch
+ assert req_body == image_patch
- def test_update_instance_group_all_params_with_retries(self):
- # Enable retries and run test_update_instance_group_all_params.
+ def test_update_image_all_params_with_retries(self):
+ # Enable retries and run test_update_image_all_params.
_service.enable_retries()
- self.test_update_instance_group_all_params()
+ self.test_update_image_all_params()
- # Disable retries and run test_update_instance_group_all_params.
+ # Disable retries and run test_update_image_all_params.
_service.disable_retries()
- self.test_update_instance_group_all_params()
+ self.test_update_image_all_params()
@responses.activate
- def test_update_instance_group_value_error(self):
+ def test_update_image_value_error(self):
"""
- test_update_instance_group_value_error()
+ test_update_image_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString')
- mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/images/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 24, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "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_data_format": "cloud_init", "visibility": "private"}'
responses.add(
responses.PATCH,
url,
@@ -14515,144 +14116,56 @@ def test_update_instance_group_value_error(self):
status=200,
)
- # Construct a dict representation of a InstanceTemplateIdentityById model
- instance_template_identity_model = {}
- instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
-
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # Construct a dict representation of a ImageAllowedUsePatch model
+ image_allowed_use_patch_model = {}
+ image_allowed_use_patch_model['api_version'] = '2024-06-23'
+ image_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
- # Construct a dict representation of a InstanceGroupPatch model
- instance_group_patch_model = {}
- instance_group_patch_model['application_port'] = 22
- instance_group_patch_model['instance_template'] = instance_template_identity_model
- instance_group_patch_model['load_balancer'] = load_balancer_identity_model
- instance_group_patch_model['load_balancer_pool'] = load_balancer_pool_identity_model
- instance_group_patch_model['membership_count'] = 20
- instance_group_patch_model['name'] = 'my-instance-group'
- instance_group_patch_model['subnets'] = [subnet_identity_model]
+ # Construct a dict representation of a ImagePatch model
+ image_patch_model = {}
+ image_patch_model['allowed_use'] = image_allowed_use_patch_model
+ image_patch_model['deprecation_at'] = '2019-01-01T12:00:00Z'
+ image_patch_model['name'] = 'my-image'
+ image_patch_model['obsolescence_at'] = '2019-01-01T12:00:00Z'
# Set up parameter values
id = 'testString'
- instance_group_patch = instance_group_patch_model
+ image_patch = image_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "instance_group_patch": instance_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_instance_group(**req_copy)
-
- def test_update_instance_group_value_error_with_retries(self):
- # Enable retries and run test_update_instance_group_value_error.
- _service.enable_retries()
- self.test_update_instance_group_value_error()
-
- # Disable retries and run test_update_instance_group_value_error.
- _service.disable_retries()
- self.test_update_instance_group_value_error()
-
-
-class TestDeleteInstanceGroupLoadBalancer:
- """
- Test Class for delete_instance_group_load_balancer
- """
-
- @responses.activate
- def test_delete_instance_group_load_balancer_all_params(self):
- """
- delete_instance_group_load_balancer()
- """
- # Set up mock
- url = preprocess_url('/instance_groups/testString/load_balancer')
- responses.add(
- responses.DELETE,
- url,
- status=204,
- )
-
- # Set up parameter values
- instance_group_id = 'testString'
-
- # Invoke method
- response = _service.delete_instance_group_load_balancer(
- instance_group_id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_delete_instance_group_load_balancer_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_load_balancer_all_params.
- _service.enable_retries()
- self.test_delete_instance_group_load_balancer_all_params()
-
- # Disable retries and run test_delete_instance_group_load_balancer_all_params.
- _service.disable_retries()
- self.test_delete_instance_group_load_balancer_all_params()
-
- @responses.activate
- def test_delete_instance_group_load_balancer_value_error(self):
- """
- test_delete_instance_group_load_balancer_value_error()
- """
- # Set up mock
- url = preprocess_url('/instance_groups/testString/load_balancer')
- responses.add(
- responses.DELETE,
- url,
- status=204,
- )
-
- # Set up parameter values
- instance_group_id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "instance_group_id": instance_group_id,
+ "image_patch": image_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_instance_group_load_balancer(**req_copy)
+ _service.update_image(**req_copy)
- def test_delete_instance_group_load_balancer_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_load_balancer_value_error.
+ def test_update_image_value_error_with_retries(self):
+ # Enable retries and run test_update_image_value_error.
_service.enable_retries()
- self.test_delete_instance_group_load_balancer_value_error()
+ self.test_update_image_value_error()
- # Disable retries and run test_delete_instance_group_load_balancer_value_error.
+ # Disable retries and run test_update_image_value_error.
_service.disable_retries()
- self.test_delete_instance_group_load_balancer_value_error()
+ self.test_update_image_value_error()
-class TestListInstanceGroupManagers:
+class TestListImageBareMetalServerProfiles:
"""
- Test Class for list_instance_group_managers
+ Test Class for list_image_bare_metal_server_profiles
"""
@responses.activate
- def test_list_instance_group_managers_all_params(self):
+ def test_list_image_bare_metal_server_profiles_all_params(self):
"""
- list_instance_group_managers()
+ list_image_bare_metal_server_profiles()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images/testString/bare_metal_server_profiles')
+ mock_response = '{"bare_metal_server_profiles": [{"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"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -14662,13 +14175,13 @@ def test_list_instance_group_managers_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
+ id = 'testString'
start = 'testString'
limit = 50
# Invoke method
- response = _service.list_instance_group_managers(
- instance_group_id,
+ response = _service.list_image_bare_metal_server_profiles(
+ id,
start=start,
limit=limit,
headers={},
@@ -14683,23 +14196,23 @@ def test_list_instance_group_managers_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- def test_list_instance_group_managers_all_params_with_retries(self):
- # Enable retries and run test_list_instance_group_managers_all_params.
+ def test_list_image_bare_metal_server_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_image_bare_metal_server_profiles_all_params.
_service.enable_retries()
- self.test_list_instance_group_managers_all_params()
+ self.test_list_image_bare_metal_server_profiles_all_params()
- # Disable retries and run test_list_instance_group_managers_all_params.
+ # Disable retries and run test_list_image_bare_metal_server_profiles_all_params.
_service.disable_retries()
- self.test_list_instance_group_managers_all_params()
+ self.test_list_image_bare_metal_server_profiles_all_params()
@responses.activate
- def test_list_instance_group_managers_required_params(self):
+ def test_list_image_bare_metal_server_profiles_required_params(self):
"""
- test_list_instance_group_managers_required_params()
+ test_list_image_bare_metal_server_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images/testString/bare_metal_server_profiles')
+ mock_response = '{"bare_metal_server_profiles": [{"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"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -14709,11 +14222,11 @@ def test_list_instance_group_managers_required_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_instance_group_managers(
- instance_group_id,
+ response = _service.list_image_bare_metal_server_profiles(
+ id,
headers={},
)
@@ -14721,23 +14234,23 @@ def test_list_instance_group_managers_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_group_managers_required_params_with_retries(self):
- # Enable retries and run test_list_instance_group_managers_required_params.
+ def test_list_image_bare_metal_server_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_image_bare_metal_server_profiles_required_params.
_service.enable_retries()
- self.test_list_instance_group_managers_required_params()
+ self.test_list_image_bare_metal_server_profiles_required_params()
- # Disable retries and run test_list_instance_group_managers_required_params.
+ # Disable retries and run test_list_image_bare_metal_server_profiles_required_params.
_service.disable_retries()
- self.test_list_instance_group_managers_required_params()
+ self.test_list_image_bare_metal_server_profiles_required_params()
@responses.activate
- def test_list_instance_group_managers_value_error(self):
+ def test_list_image_bare_metal_server_profiles_value_error(self):
"""
- test_list_instance_group_managers_value_error()
+ test_list_image_bare_metal_server_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images/testString/bare_metal_server_profiles')
+ mock_response = '{"bare_metal_server_profiles": [{"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"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -14747,35 +14260,35 @@ def test_list_instance_group_managers_value_error(self):
)
# Set up parameter values
- instance_group_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_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.list_instance_group_managers(**req_copy)
+ _service.list_image_bare_metal_server_profiles(**req_copy)
- def test_list_instance_group_managers_value_error_with_retries(self):
- # Enable retries and run test_list_instance_group_managers_value_error.
+ def test_list_image_bare_metal_server_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_image_bare_metal_server_profiles_value_error.
_service.enable_retries()
- self.test_list_instance_group_managers_value_error()
+ self.test_list_image_bare_metal_server_profiles_value_error()
- # Disable retries and run test_list_instance_group_managers_value_error.
+ # Disable retries and run test_list_image_bare_metal_server_profiles_value_error.
_service.disable_retries()
- self.test_list_instance_group_managers_value_error()
+ self.test_list_image_bare_metal_server_profiles_value_error()
@responses.activate
- def test_list_instance_group_managers_with_pager_get_next(self):
+ def test_list_image_bare_metal_server_profiles_with_pager_get_next(self):
"""
- test_list_instance_group_managers_with_pager_get_next()
+ test_list_image_bare_metal_server_profiles_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
+ url = preprocess_url('/images/testString/bare_metal_server_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"bare_metal_server_profiles":[{"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"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"bare_metal_server_profiles":[{"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"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -14793,9 +14306,9 @@ def test_list_instance_group_managers_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = InstanceGroupManagersPager(
+ pager = ImageBareMetalServerProfilesPager(
client=_service,
- instance_group_id='testString',
+ id='testString',
limit=10,
)
while pager.has_next():
@@ -14805,14 +14318,14 @@ def test_list_instance_group_managers_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_instance_group_managers_with_pager_get_all(self):
+ def test_list_image_bare_metal_server_profiles_with_pager_get_all(self):
"""
- test_list_instance_group_managers_with_pager_get_all()
+ test_list_image_bare_metal_server_profiles_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
+ url = preprocess_url('/images/testString/bare_metal_server_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"bare_metal_server_profiles":[{"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"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"bare_metal_server_profiles":[{"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"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -14829,9 +14342,9 @@ def test_list_instance_group_managers_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = InstanceGroupManagersPager(
+ pager = ImageBareMetalServerProfilesPager(
client=_service,
- instance_group_id='testString',
+ id='testString',
limit=10,
)
all_results = pager.get_all()
@@ -14839,206 +14352,141 @@ def test_list_instance_group_managers_with_pager_get_all(self):
assert len(all_results) == 2
-class TestCreateInstanceGroupManager:
+class TestDeprecateImage:
"""
- Test Class for create_instance_group_manager
+ Test Class for deprecate_image
"""
@responses.activate
- def test_create_instance_group_manager_all_params(self):
+ def test_deprecate_image_all_params(self):
"""
- create_instance_group_manager()
+ deprecate_image()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ url = preprocess_url('/images/testString/deprecate')
responses.add(
responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=204,
)
- # Construct a dict representation of a InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model
- instance_group_manager_prototype_model = {}
- instance_group_manager_prototype_model['management_enabled'] = True
- instance_group_manager_prototype_model['name'] = 'my-instance-group-manager'
- instance_group_manager_prototype_model['aggregation_window'] = 120
- instance_group_manager_prototype_model['cooldown'] = 210
- instance_group_manager_prototype_model['manager_type'] = 'autoscale'
- instance_group_manager_prototype_model['max_membership_count'] = 10
- instance_group_manager_prototype_model['min_membership_count'] = 10
-
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_prototype = instance_group_manager_prototype_model
+ id = 'testString'
# Invoke method
- response = _service.create_instance_group_manager(
- instance_group_id,
- instance_group_manager_prototype,
+ response = _service.deprecate_image(
+ id,
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 == instance_group_manager_prototype
+ assert response.status_code == 204
- def test_create_instance_group_manager_all_params_with_retries(self):
- # Enable retries and run test_create_instance_group_manager_all_params.
+ def test_deprecate_image_all_params_with_retries(self):
+ # Enable retries and run test_deprecate_image_all_params.
_service.enable_retries()
- self.test_create_instance_group_manager_all_params()
+ self.test_deprecate_image_all_params()
- # Disable retries and run test_create_instance_group_manager_all_params.
+ # Disable retries and run test_deprecate_image_all_params.
_service.disable_retries()
- self.test_create_instance_group_manager_all_params()
+ self.test_deprecate_image_all_params()
@responses.activate
- def test_create_instance_group_manager_value_error(self):
+ def test_deprecate_image_value_error(self):
"""
- test_create_instance_group_manager_value_error()
+ test_deprecate_image_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ url = preprocess_url('/images/testString/deprecate')
responses.add(
responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=204,
)
- # Construct a dict representation of a InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model
- instance_group_manager_prototype_model = {}
- instance_group_manager_prototype_model['management_enabled'] = True
- instance_group_manager_prototype_model['name'] = 'my-instance-group-manager'
- instance_group_manager_prototype_model['aggregation_window'] = 120
- instance_group_manager_prototype_model['cooldown'] = 210
- instance_group_manager_prototype_model['manager_type'] = 'autoscale'
- instance_group_manager_prototype_model['max_membership_count'] = 10
- instance_group_manager_prototype_model['min_membership_count'] = 10
-
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_prototype = instance_group_manager_prototype_model
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_prototype": instance_group_manager_prototype,
+ "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_instance_group_manager(**req_copy)
+ _service.deprecate_image(**req_copy)
- def test_create_instance_group_manager_value_error_with_retries(self):
- # Enable retries and run test_create_instance_group_manager_value_error.
+ def test_deprecate_image_value_error_with_retries(self):
+ # Enable retries and run test_deprecate_image_value_error.
_service.enable_retries()
- self.test_create_instance_group_manager_value_error()
+ self.test_deprecate_image_value_error()
- # Disable retries and run test_create_instance_group_manager_value_error.
+ # Disable retries and run test_deprecate_image_value_error.
_service.disable_retries()
- self.test_create_instance_group_manager_value_error()
+ self.test_deprecate_image_value_error()
-class TestDeleteInstanceGroupManager:
+class TestListImageInstanceProfiles:
"""
- Test Class for delete_instance_group_manager
+ Test Class for list_image_instance_profiles
"""
@responses.activate
- def test_delete_instance_group_manager_all_params(self):
+ def test_list_image_instance_profiles_all_params(self):
"""
- delete_instance_group_manager()
+ list_image_instance_profiles()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString')
+ url = preprocess_url('/images/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- instance_group_id = 'testString'
id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.delete_instance_group_manager(
- instance_group_id,
+ response = _service.list_image_instance_profiles(
id,
+ start=start,
+ limit=limit,
headers={},
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_delete_instance_group_manager_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_manager_all_params.
- _service.enable_retries()
- self.test_delete_instance_group_manager_all_params()
-
- # Disable retries and run test_delete_instance_group_manager_all_params.
- _service.disable_retries()
- self.test_delete_instance_group_manager_all_params()
-
- @responses.activate
- def test_delete_instance_group_manager_value_error(self):
- """
- test_delete_instance_group_manager_value_error()
- """
- # Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString')
- responses.add(
- responses.DELETE,
- url,
- status=204,
- )
-
- # Set up parameter values
- instance_group_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "instance_group_id": instance_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_instance_group_manager(**req_copy)
+ # 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_delete_instance_group_manager_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_manager_value_error.
+ def test_list_image_instance_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_image_instance_profiles_all_params.
_service.enable_retries()
- self.test_delete_instance_group_manager_value_error()
+ self.test_list_image_instance_profiles_all_params()
- # Disable retries and run test_delete_instance_group_manager_value_error.
+ # Disable retries and run test_list_image_instance_profiles_all_params.
_service.disable_retries()
- self.test_delete_instance_group_manager_value_error()
-
-
-class TestGetInstanceGroupManager:
- """
- Test Class for get_instance_group_manager
- """
+ self.test_list_image_instance_profiles_all_params()
@responses.activate
- def test_get_instance_group_manager_all_params(self):
+ def test_list_image_instance_profiles_required_params(self):
"""
- get_instance_group_manager()
+ test_list_image_instance_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ url = preprocess_url('/images/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15048,12 +14496,10 @@ def test_get_instance_group_manager_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_instance_group_manager(
- instance_group_id,
+ response = _service.list_image_instance_profiles(
id,
headers={},
)
@@ -15062,23 +14508,23 @@ def test_get_instance_group_manager_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_group_manager_all_params_with_retries(self):
- # Enable retries and run test_get_instance_group_manager_all_params.
+ def test_list_image_instance_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_image_instance_profiles_required_params.
_service.enable_retries()
- self.test_get_instance_group_manager_all_params()
+ self.test_list_image_instance_profiles_required_params()
- # Disable retries and run test_get_instance_group_manager_all_params.
+ # Disable retries and run test_list_image_instance_profiles_required_params.
_service.disable_retries()
- self.test_get_instance_group_manager_all_params()
+ self.test_list_image_instance_profiles_required_params()
@responses.activate
- def test_get_instance_group_manager_value_error(self):
+ def test_list_image_instance_profiles_value_error(self):
"""
- test_get_instance_group_manager_value_error()
+ test_list_image_instance_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ url = preprocess_url('/images/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15088,152 +14534,186 @@ def test_get_instance_group_manager_value_error(self):
)
# Set up parameter values
- instance_group_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_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_instance_group_manager(**req_copy)
+ _service.list_image_instance_profiles(**req_copy)
- def test_get_instance_group_manager_value_error_with_retries(self):
- # Enable retries and run test_get_instance_group_manager_value_error.
+ def test_list_image_instance_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_image_instance_profiles_value_error.
_service.enable_retries()
- self.test_get_instance_group_manager_value_error()
+ self.test_list_image_instance_profiles_value_error()
- # Disable retries and run test_get_instance_group_manager_value_error.
+ # Disable retries and run test_list_image_instance_profiles_value_error.
_service.disable_retries()
- self.test_get_instance_group_manager_value_error()
+ self.test_list_image_instance_profiles_value_error()
+ @responses.activate
+ def test_list_image_instance_profiles_with_pager_get_next(self):
+ """
+ test_list_image_instance_profiles_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/images/testString/instance_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestUpdateInstanceGroupManager:
- """
- Test Class for update_instance_group_manager
- """
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = ImageInstanceProfilesPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_update_instance_group_manager_all_params(self):
+ def test_list_image_instance_profiles_with_pager_get_all(self):
"""
- update_instance_group_manager()
+ test_list_image_instance_profiles_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/images/testString/instance_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceGroupManagerPatch model
- instance_group_manager_patch_model = {}
- instance_group_manager_patch_model['aggregation_window'] = 120
- instance_group_manager_patch_model['cooldown'] = 210
- instance_group_manager_patch_model['management_enabled'] = False
- instance_group_manager_patch_model['max_membership_count'] = 10
- instance_group_manager_patch_model['min_membership_count'] = 10
- instance_group_manager_patch_model['name'] = 'my-instance-group-manager'
+ # Exercise the pager class for this operation
+ pager = ImageInstanceProfilesPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestObsoleteImage:
+ """
+ Test Class for obsolete_image
+ """
+
+ @responses.activate
+ def test_obsolete_image_all_params(self):
+ """
+ obsolete_image()
+ """
+ # Set up mock
+ url = preprocess_url('/images/testString/obsolete')
+ responses.add(
+ responses.POST,
+ url,
+ status=204,
+ )
# Set up parameter values
- instance_group_id = 'testString'
id = 'testString'
- instance_group_manager_patch = instance_group_manager_patch_model
# Invoke method
- response = _service.update_instance_group_manager(
- instance_group_id,
+ response = _service.obsolete_image(
id,
- instance_group_manager_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 == instance_group_manager_patch
+ assert response.status_code == 204
- def test_update_instance_group_manager_all_params_with_retries(self):
- # Enable retries and run test_update_instance_group_manager_all_params.
+ def test_obsolete_image_all_params_with_retries(self):
+ # Enable retries and run test_obsolete_image_all_params.
_service.enable_retries()
- self.test_update_instance_group_manager_all_params()
+ self.test_obsolete_image_all_params()
- # Disable retries and run test_update_instance_group_manager_all_params.
+ # Disable retries and run test_obsolete_image_all_params.
_service.disable_retries()
- self.test_update_instance_group_manager_all_params()
+ self.test_obsolete_image_all_params()
@responses.activate
- def test_update_instance_group_manager_value_error(self):
+ def test_obsolete_image_value_error(self):
"""
- test_update_instance_group_manager_value_error()
+ test_obsolete_image_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ url = preprocess_url('/images/testString/obsolete')
responses.add(
- responses.PATCH,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a InstanceGroupManagerPatch model
- instance_group_manager_patch_model = {}
- instance_group_manager_patch_model['aggregation_window'] = 120
- instance_group_manager_patch_model['cooldown'] = 210
- instance_group_manager_patch_model['management_enabled'] = False
- instance_group_manager_patch_model['max_membership_count'] = 10
- instance_group_manager_patch_model['min_membership_count'] = 10
- instance_group_manager_patch_model['name'] = 'my-instance-group-manager'
-
# Set up parameter values
- instance_group_id = 'testString'
id = 'testString'
- instance_group_manager_patch = instance_group_manager_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
"id": id,
- "instance_group_manager_patch": instance_group_manager_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_instance_group_manager(**req_copy)
+ _service.obsolete_image(**req_copy)
- def test_update_instance_group_manager_value_error_with_retries(self):
- # Enable retries and run test_update_instance_group_manager_value_error.
+ def test_obsolete_image_value_error_with_retries(self):
+ # Enable retries and run test_obsolete_image_value_error.
_service.enable_retries()
- self.test_update_instance_group_manager_value_error()
+ self.test_obsolete_image_value_error()
- # Disable retries and run test_update_instance_group_manager_value_error.
+ # Disable retries and run test_obsolete_image_value_error.
_service.disable_retries()
- self.test_update_instance_group_manager_value_error()
+ self.test_obsolete_image_value_error()
-class TestListInstanceGroupManagerActions:
+class TestListImageExportJobs:
"""
- Test Class for list_instance_group_manager_actions
+ Test Class for list_image_export_jobs
"""
@responses.activate
- def test_list_instance_group_manager_actions_all_params(self):
+ def test_list_image_export_jobs_all_params(self):
"""
- list_instance_group_manager_actions()
+ list_image_export_jobs()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response = '{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images/testString/export_jobs')
+ mock_response = '{"export_jobs": [{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}]}'
responses.add(
responses.GET,
url,
@@ -15243,17 +14723,13 @@ def test_list_instance_group_manager_actions_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- start = 'testString'
- limit = 50
+ image_id = 'testString'
+ name = 'my-name'
# Invoke method
- response = _service.list_instance_group_manager_actions(
- instance_group_id,
- instance_group_manager_id,
- start=start,
- limit=limit,
+ response = _service.list_image_export_jobs(
+ image_id,
+ name=name,
headers={},
)
@@ -15263,26 +14739,25 @@ def test_list_instance_group_manager_actions_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 'name={}'.format(name) in query_string
- def test_list_instance_group_manager_actions_all_params_with_retries(self):
- # Enable retries and run test_list_instance_group_manager_actions_all_params.
+ def test_list_image_export_jobs_all_params_with_retries(self):
+ # Enable retries and run test_list_image_export_jobs_all_params.
_service.enable_retries()
- self.test_list_instance_group_manager_actions_all_params()
+ self.test_list_image_export_jobs_all_params()
- # Disable retries and run test_list_instance_group_manager_actions_all_params.
+ # Disable retries and run test_list_image_export_jobs_all_params.
_service.disable_retries()
- self.test_list_instance_group_manager_actions_all_params()
+ self.test_list_image_export_jobs_all_params()
@responses.activate
- def test_list_instance_group_manager_actions_required_params(self):
+ def test_list_image_export_jobs_required_params(self):
"""
- test_list_instance_group_manager_actions_required_params()
+ test_list_image_export_jobs_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response = '{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images/testString/export_jobs')
+ mock_response = '{"export_jobs": [{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}]}'
responses.add(
responses.GET,
url,
@@ -15292,13 +14767,11 @@ def test_list_instance_group_manager_actions_required_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
+ image_id = 'testString'
# Invoke method
- response = _service.list_instance_group_manager_actions(
- instance_group_id,
- instance_group_manager_id,
+ response = _service.list_image_export_jobs(
+ image_id,
headers={},
)
@@ -15306,23 +14779,23 @@ def test_list_instance_group_manager_actions_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_group_manager_actions_required_params_with_retries(self):
- # Enable retries and run test_list_instance_group_manager_actions_required_params.
+ def test_list_image_export_jobs_required_params_with_retries(self):
+ # Enable retries and run test_list_image_export_jobs_required_params.
_service.enable_retries()
- self.test_list_instance_group_manager_actions_required_params()
+ self.test_list_image_export_jobs_required_params()
- # Disable retries and run test_list_instance_group_manager_actions_required_params.
+ # Disable retries and run test_list_image_export_jobs_required_params.
_service.disable_retries()
- self.test_list_instance_group_manager_actions_required_params()
+ self.test_list_image_export_jobs_required_params()
@responses.activate
- def test_list_instance_group_manager_actions_value_error(self):
+ def test_list_image_export_jobs_value_error(self):
"""
- test_list_instance_group_manager_actions_value_error()
+ test_list_image_export_jobs_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response = '{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/images/testString/export_jobs')
+ mock_response = '{"export_jobs": [{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}]}'
responses.add(
responses.GET,
url,
@@ -15332,310 +14805,408 @@ def test_list_instance_group_manager_actions_value_error(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
+ image_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_id,
+ "image_id": image_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_instance_group_manager_actions(**req_copy)
+ _service.list_image_export_jobs(**req_copy)
- def test_list_instance_group_manager_actions_value_error_with_retries(self):
- # Enable retries and run test_list_instance_group_manager_actions_value_error.
+ def test_list_image_export_jobs_value_error_with_retries(self):
+ # Enable retries and run test_list_image_export_jobs_value_error.
_service.enable_retries()
- self.test_list_instance_group_manager_actions_value_error()
+ self.test_list_image_export_jobs_value_error()
- # Disable retries and run test_list_instance_group_manager_actions_value_error.
+ # Disable retries and run test_list_image_export_jobs_value_error.
_service.disable_retries()
- self.test_list_instance_group_manager_actions_value_error()
+ self.test_list_image_export_jobs_value_error()
+
+
+class TestCreateImageExportJob:
+ """
+ Test Class for create_image_export_job
+ """
@responses.activate
- def test_list_instance_group_manager_actions_with_pager_get_next(self):
+ def test_create_image_export_job_all_params(self):
"""
- test_list_instance_group_manager_actions_with_pager_get_next()
+ create_image_export_job()
"""
- # Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
+ # Set up mock
+ url = preprocess_url('/images/testString/export_jobs')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response1,
+ body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
+ )
+
+ # Construct a dict representation of a CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
+ cloud_object_storage_bucket_identity_model = {}
+ cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+
+ # Set up parameter values
+ image_id = 'testString'
+ storage_bucket = cloud_object_storage_bucket_identity_model
+ format = 'qcow2'
+ name = 'my-image-export'
+
+ # Invoke method
+ response = _service.create_image_export_job(
+ image_id,
+ storage_bucket,
+ format=format,
+ name=name,
+ 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['storage_bucket'] == cloud_object_storage_bucket_identity_model
+ assert req_body['format'] == 'qcow2'
+ assert req_body['name'] == 'my-image-export'
+
+ def test_create_image_export_job_all_params_with_retries(self):
+ # Enable retries and run test_create_image_export_job_all_params.
+ _service.enable_retries()
+ self.test_create_image_export_job_all_params()
+
+ # Disable retries and run test_create_image_export_job_all_params.
+ _service.disable_retries()
+ self.test_create_image_export_job_all_params()
+
+ @responses.activate
+ def test_create_image_export_job_value_error(self):
+ """
+ test_create_image_export_job_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/images/testString/export_jobs')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = InstanceGroupManagerActionsPager(
- client=_service,
- instance_group_id='testString',
- instance_group_manager_id='testString',
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+ # Construct a dict representation of a CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
+ cloud_object_storage_bucket_identity_model = {}
+ cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+
+ # Set up parameter values
+ image_id = 'testString'
+ storage_bucket = cloud_object_storage_bucket_identity_model
+ format = 'qcow2'
+ name = 'my-image-export'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "image_id": image_id,
+ "storage_bucket": storage_bucket,
+ }
+ 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_image_export_job(**req_copy)
+
+ def test_create_image_export_job_value_error_with_retries(self):
+ # Enable retries and run test_create_image_export_job_value_error.
+ _service.enable_retries()
+ self.test_create_image_export_job_value_error()
+
+ # Disable retries and run test_create_image_export_job_value_error.
+ _service.disable_retries()
+ self.test_create_image_export_job_value_error()
+
+
+class TestDeleteImageExportJob:
+ """
+ Test Class for delete_image_export_job
+ """
@responses.activate
- def test_list_instance_group_manager_actions_with_pager_get_all(self):
+ def test_delete_image_export_job_all_params(self):
"""
- test_list_instance_group_manager_actions_with_pager_get_all()
+ delete_image_export_job()
"""
- # Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
+ # Set up mock
+ url = preprocess_url('/images/testString/export_jobs/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response1,
- content_type='application/json',
- status=200,
+ status=202,
)
+
+ # Set up parameter values
+ image_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_image_export_job(
+ image_id,
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_image_export_job_all_params_with_retries(self):
+ # Enable retries and run test_delete_image_export_job_all_params.
+ _service.enable_retries()
+ self.test_delete_image_export_job_all_params()
+
+ # Disable retries and run test_delete_image_export_job_all_params.
+ _service.disable_retries()
+ self.test_delete_image_export_job_all_params()
+
+ @responses.activate
+ def test_delete_image_export_job_value_error(self):
+ """
+ test_delete_image_export_job_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/images/testString/export_jobs/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response2,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Exercise the pager class for this operation
- pager = InstanceGroupManagerActionsPager(
- client=_service,
- instance_group_id='testString',
- instance_group_manager_id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Set up parameter values
+ image_id = 'testString'
+ id = 'testString'
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "image_id": image_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_image_export_job(**req_copy)
-class TestCreateInstanceGroupManagerAction:
+ def test_delete_image_export_job_value_error_with_retries(self):
+ # Enable retries and run test_delete_image_export_job_value_error.
+ _service.enable_retries()
+ self.test_delete_image_export_job_value_error()
+
+ # Disable retries and run test_delete_image_export_job_value_error.
+ _service.disable_retries()
+ self.test_delete_image_export_job_value_error()
+
+
+class TestGetImageExportJob:
"""
- Test Class for create_instance_group_manager_action
+ Test Class for get_image_export_job
"""
@responses.activate
- def test_create_instance_group_manager_action_all_params(self):
+ def test_get_image_export_job_all_params(self):
"""
- create_instance_group_manager_action()
+ get_image_export_job()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
+ url = preprocess_url('/images/testString/export_jobs/testString')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
- )
-
- # Construct a dict representation of a InstanceGroupManagerScheduledActionGroupPrototype model
- instance_group_manager_scheduled_action_group_prototype_model = {}
- instance_group_manager_scheduled_action_group_prototype_model['membership_count'] = 10
-
- # Construct a dict representation of a InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model
- instance_group_manager_action_prototype_model = {}
- instance_group_manager_action_prototype_model['name'] = 'my-instance-group-manager-action'
- instance_group_manager_action_prototype_model['run_at'] = '2019-01-01T12:00:00Z'
- instance_group_manager_action_prototype_model['group'] = instance_group_manager_scheduled_action_group_prototype_model
+ status=200,
+ )
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- instance_group_manager_action_prototype = instance_group_manager_action_prototype_model
+ image_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.create_instance_group_manager_action(
- instance_group_id,
- instance_group_manager_id,
- instance_group_manager_action_prototype,
+ response = _service.get_image_export_job(
+ image_id,
+ id,
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 == instance_group_manager_action_prototype
+ assert response.status_code == 200
- def test_create_instance_group_manager_action_all_params_with_retries(self):
- # Enable retries and run test_create_instance_group_manager_action_all_params.
+ def test_get_image_export_job_all_params_with_retries(self):
+ # Enable retries and run test_get_image_export_job_all_params.
_service.enable_retries()
- self.test_create_instance_group_manager_action_all_params()
+ self.test_get_image_export_job_all_params()
- # Disable retries and run test_create_instance_group_manager_action_all_params.
+ # Disable retries and run test_get_image_export_job_all_params.
_service.disable_retries()
- self.test_create_instance_group_manager_action_all_params()
+ self.test_get_image_export_job_all_params()
@responses.activate
- def test_create_instance_group_manager_action_value_error(self):
+ def test_get_image_export_job_value_error(self):
"""
- test_create_instance_group_manager_action_value_error()
+ test_get_image_export_job_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions')
- mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
+ url = preprocess_url('/images/testString/export_jobs/testString')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a InstanceGroupManagerScheduledActionGroupPrototype model
- instance_group_manager_scheduled_action_group_prototype_model = {}
- instance_group_manager_scheduled_action_group_prototype_model['membership_count'] = 10
-
- # Construct a dict representation of a InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model
- instance_group_manager_action_prototype_model = {}
- instance_group_manager_action_prototype_model['name'] = 'my-instance-group-manager-action'
- instance_group_manager_action_prototype_model['run_at'] = '2019-01-01T12:00:00Z'
- instance_group_manager_action_prototype_model['group'] = instance_group_manager_scheduled_action_group_prototype_model
-
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- instance_group_manager_action_prototype = instance_group_manager_action_prototype_model
+ image_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_id,
- "instance_group_manager_action_prototype": instance_group_manager_action_prototype,
+ "image_id": image_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_instance_group_manager_action(**req_copy)
+ _service.get_image_export_job(**req_copy)
- def test_create_instance_group_manager_action_value_error_with_retries(self):
- # Enable retries and run test_create_instance_group_manager_action_value_error.
+ def test_get_image_export_job_value_error_with_retries(self):
+ # Enable retries and run test_get_image_export_job_value_error.
_service.enable_retries()
- self.test_create_instance_group_manager_action_value_error()
+ self.test_get_image_export_job_value_error()
- # Disable retries and run test_create_instance_group_manager_action_value_error.
+ # Disable retries and run test_get_image_export_job_value_error.
_service.disable_retries()
- self.test_create_instance_group_manager_action_value_error()
+ self.test_get_image_export_job_value_error()
-class TestDeleteInstanceGroupManagerAction:
+class TestUpdateImageExportJob:
"""
- Test Class for delete_instance_group_manager_action
+ Test Class for update_image_export_job
"""
@responses.activate
- def test_delete_instance_group_manager_action_all_params(self):
+ def test_update_image_export_job_all_params(self):
"""
- delete_instance_group_manager_action()
+ update_image_export_job()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
+ url = preprocess_url('/images/testString/export_jobs/testString')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
responses.add(
- responses.DELETE,
+ responses.PATCH,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
+ # Construct a dict representation of a ImageExportJobPatch model
+ image_export_job_patch_model = {}
+ image_export_job_patch_model['name'] = 'my-image-export-job-updated'
+
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
+ image_id = 'testString'
id = 'testString'
+ image_export_job_patch = image_export_job_patch_model
# Invoke method
- response = _service.delete_instance_group_manager_action(
- instance_group_id,
- instance_group_manager_id,
+ response = _service.update_image_export_job(
+ image_id,
id,
+ image_export_job_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 == image_export_job_patch
- def test_delete_instance_group_manager_action_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_manager_action_all_params.
+ def test_update_image_export_job_all_params_with_retries(self):
+ # Enable retries and run test_update_image_export_job_all_params.
_service.enable_retries()
- self.test_delete_instance_group_manager_action_all_params()
+ self.test_update_image_export_job_all_params()
- # Disable retries and run test_delete_instance_group_manager_action_all_params.
+ # Disable retries and run test_update_image_export_job_all_params.
_service.disable_retries()
- self.test_delete_instance_group_manager_action_all_params()
+ self.test_update_image_export_job_all_params()
@responses.activate
- def test_delete_instance_group_manager_action_value_error(self):
+ def test_update_image_export_job_value_error(self):
"""
- test_delete_instance_group_manager_action_value_error()
+ test_update_image_export_job_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
+ url = preprocess_url('/images/testString/export_jobs/testString')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "encrypted_data_key": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "format": "qcow2", "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8/export_jobs/r006-095e9baf-01d4-4e29-986e-20d26606b82a", "id": "r006-095e9baf-01d4-4e29-986e-20d26606b82a", "name": "my-image-export-job", "resource_type": "image_export_job", "started_at": "2019-01-01T12:00:00.000Z", "status": "deleting", "status_reasons": [{"code": "cannot_access_storage_bucket", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-object-storage-prereq"}], "storage_bucket": {"crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:bucket-27200-lwx4cfvcue", "name": "bucket-27200-lwx4cfvcue"}, "storage_href": "cos://us-south/bucket-27200-lwx4cfvcue/my-image-export.qcow2", "storage_object": {"name": "my-object"}}'
responses.add(
- responses.DELETE,
+ responses.PATCH,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
+ # Construct a dict representation of a ImageExportJobPatch model
+ image_export_job_patch_model = {}
+ image_export_job_patch_model['name'] = 'my-image-export-job-updated'
+
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
+ image_id = 'testString'
id = 'testString'
+ image_export_job_patch = image_export_job_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_id,
+ "image_id": image_id,
"id": id,
+ "image_export_job_patch": image_export_job_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_instance_group_manager_action(**req_copy)
+ _service.update_image_export_job(**req_copy)
- def test_delete_instance_group_manager_action_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_manager_action_value_error.
+ def test_update_image_export_job_value_error_with_retries(self):
+ # Enable retries and run test_update_image_export_job_value_error.
_service.enable_retries()
- self.test_delete_instance_group_manager_action_value_error()
+ self.test_update_image_export_job_value_error()
- # Disable retries and run test_delete_instance_group_manager_action_value_error.
+ # Disable retries and run test_update_image_export_job_value_error.
_service.disable_retries()
- self.test_delete_instance_group_manager_action_value_error()
+ self.test_update_image_export_job_value_error()
-class TestGetInstanceGroupManagerAction:
+class TestListOperatingSystems:
"""
- Test Class for get_instance_group_manager_action
+ Test Class for list_operating_systems
"""
@responses.activate
- def test_get_instance_group_manager_action_all_params(self):
+ def test_list_operating_systems_all_params(self):
"""
- get_instance_group_manager_action()
+ list_operating_systems()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
- mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
+ url = preprocess_url('/operating_systems')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "operating_systems": [{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15645,39 +15216,42 @@ def test_get_instance_group_manager_action_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.get_instance_group_manager_action(
- instance_group_id,
- instance_group_manager_id,
- id,
+ response = _service.list_operating_systems(
+ 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_get_instance_group_manager_action_all_params_with_retries(self):
- # Enable retries and run test_get_instance_group_manager_action_all_params.
+ def test_list_operating_systems_all_params_with_retries(self):
+ # Enable retries and run test_list_operating_systems_all_params.
_service.enable_retries()
- self.test_get_instance_group_manager_action_all_params()
+ self.test_list_operating_systems_all_params()
- # Disable retries and run test_get_instance_group_manager_action_all_params.
+ # Disable retries and run test_list_operating_systems_all_params.
_service.disable_retries()
- self.test_get_instance_group_manager_action_all_params()
+ self.test_list_operating_systems_all_params()
@responses.activate
- def test_get_instance_group_manager_action_value_error(self):
+ def test_list_operating_systems_required_params(self):
"""
- test_get_instance_group_manager_action_value_error()
+ test_list_operating_systems_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
- mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
+ url = preprocess_url('/operating_systems')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "operating_systems": [{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15686,179 +15260,276 @@ def test_get_instance_group_manager_action_value_error(self):
status=200,
)
- # Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- id = 'testString'
+ # Invoke method
+ response = _service.list_operating_systems()
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_operating_systems_required_params_with_retries(self):
+ # Enable retries and run test_list_operating_systems_required_params.
+ _service.enable_retries()
+ self.test_list_operating_systems_required_params()
+
+ # Disable retries and run test_list_operating_systems_required_params.
+ _service.disable_retries()
+ self.test_list_operating_systems_required_params()
+
+ @responses.activate
+ def test_list_operating_systems_value_error(self):
+ """
+ test_list_operating_systems_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/operating_systems')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "operating_systems": [{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "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 = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_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_instance_group_manager_action(**req_copy)
+ _service.list_operating_systems(**req_copy)
- def test_get_instance_group_manager_action_value_error_with_retries(self):
- # Enable retries and run test_get_instance_group_manager_action_value_error.
+ def test_list_operating_systems_value_error_with_retries(self):
+ # Enable retries and run test_list_operating_systems_value_error.
_service.enable_retries()
- self.test_get_instance_group_manager_action_value_error()
+ self.test_list_operating_systems_value_error()
- # Disable retries and run test_get_instance_group_manager_action_value_error.
+ # Disable retries and run test_list_operating_systems_value_error.
_service.disable_retries()
- self.test_get_instance_group_manager_action_value_error()
+ self.test_list_operating_systems_value_error()
+
+ @responses.activate
+ def test_list_operating_systems_with_pager_get_next(self):
+ """
+ test_list_operating_systems_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/operating_systems')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = OperatingSystemsPager(
+ client=_service,
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+ @responses.activate
+ def test_list_operating_systems_with_pager_get_all(self):
+ """
+ test_list_operating_systems_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/operating_systems')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"operating_systems":[{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestUpdateInstanceGroupManagerAction:
+ # Exercise the pager class for this operation
+ pager = OperatingSystemsPager(
+ client=_service,
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestGetOperatingSystem:
"""
- Test Class for update_instance_group_manager_action
+ Test Class for get_operating_system
"""
@responses.activate
- def test_update_instance_group_manager_action_all_params(self):
+ def test_get_operating_system_all_params(self):
"""
- update_instance_group_manager_action()
+ get_operating_system()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
- mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
+ url = preprocess_url('/operating_systems/red-7-amd64')
+ mock_response = '{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceGroupManagerActionGroupPatch model
- instance_group_manager_action_group_patch_model = {}
- instance_group_manager_action_group_patch_model['membership_count'] = 10
-
- # Construct a dict representation of a InstanceGroupManagerActionManagerPatch model
- instance_group_manager_action_manager_patch_model = {}
- instance_group_manager_action_manager_patch_model['max_membership_count'] = 10
- instance_group_manager_action_manager_patch_model['min_membership_count'] = 10
-
- # Construct a dict representation of a InstanceGroupManagerActionPatch model
- instance_group_manager_action_patch_model = {}
- instance_group_manager_action_patch_model['auto_delete'] = False
- instance_group_manager_action_patch_model['auto_delete_timeout'] = 24
- instance_group_manager_action_patch_model['cron_spec'] = '30 */2 * * 1-5'
- instance_group_manager_action_patch_model['group'] = instance_group_manager_action_group_patch_model
- instance_group_manager_action_patch_model['manager'] = instance_group_manager_action_manager_patch_model
- instance_group_manager_action_patch_model['name'] = 'my-instance-group-manager-action'
- instance_group_manager_action_patch_model['run_at'] = '2019-01-01T12:00:00Z'
-
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- id = 'testString'
- instance_group_manager_action_patch = instance_group_manager_action_patch_model
+ name = 'red-7-amd64'
# Invoke method
- response = _service.update_instance_group_manager_action(
- instance_group_id,
- instance_group_manager_id,
- id,
- instance_group_manager_action_patch,
+ response = _service.get_operating_system(
+ name,
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 == instance_group_manager_action_patch
- def test_update_instance_group_manager_action_all_params_with_retries(self):
- # Enable retries and run test_update_instance_group_manager_action_all_params.
+ def test_get_operating_system_all_params_with_retries(self):
+ # Enable retries and run test_get_operating_system_all_params.
_service.enable_retries()
- self.test_update_instance_group_manager_action_all_params()
+ self.test_get_operating_system_all_params()
- # Disable retries and run test_update_instance_group_manager_action_all_params.
+ # Disable retries and run test_get_operating_system_all_params.
_service.disable_retries()
- self.test_update_instance_group_manager_action_all_params()
+ self.test_get_operating_system_all_params()
@responses.activate
- def test_update_instance_group_manager_action_value_error(self):
+ def test_get_operating_system_value_error(self):
"""
- test_update_instance_group_manager_action_value_error()
+ test_get_operating_system_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
- mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
+ url = preprocess_url('/operating_systems/red-7-amd64')
+ mock_response = '{"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a InstanceGroupManagerActionGroupPatch model
- instance_group_manager_action_group_patch_model = {}
- instance_group_manager_action_group_patch_model['membership_count'] = 10
-
- # Construct a dict representation of a InstanceGroupManagerActionManagerPatch model
- instance_group_manager_action_manager_patch_model = {}
- instance_group_manager_action_manager_patch_model['max_membership_count'] = 10
- instance_group_manager_action_manager_patch_model['min_membership_count'] = 10
-
- # Construct a dict representation of a InstanceGroupManagerActionPatch model
- instance_group_manager_action_patch_model = {}
- instance_group_manager_action_patch_model['auto_delete'] = False
- instance_group_manager_action_patch_model['auto_delete_timeout'] = 24
- instance_group_manager_action_patch_model['cron_spec'] = '30 */2 * * 1-5'
- instance_group_manager_action_patch_model['group'] = instance_group_manager_action_group_patch_model
- instance_group_manager_action_patch_model['manager'] = instance_group_manager_action_manager_patch_model
- instance_group_manager_action_patch_model['name'] = 'my-instance-group-manager-action'
- instance_group_manager_action_patch_model['run_at'] = '2019-01-01T12:00:00Z'
-
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- id = 'testString'
- instance_group_manager_action_patch = instance_group_manager_action_patch_model
+ name = 'red-7-amd64'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_id,
- "id": id,
- "instance_group_manager_action_patch": instance_group_manager_action_patch,
+ "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.update_instance_group_manager_action(**req_copy)
+ _service.get_operating_system(**req_copy)
- def test_update_instance_group_manager_action_value_error_with_retries(self):
- # Enable retries and run test_update_instance_group_manager_action_value_error.
+ def test_get_operating_system_value_error_with_retries(self):
+ # Enable retries and run test_get_operating_system_value_error.
_service.enable_retries()
- self.test_update_instance_group_manager_action_value_error()
+ self.test_get_operating_system_value_error()
- # Disable retries and run test_update_instance_group_manager_action_value_error.
+ # Disable retries and run test_get_operating_system_value_error.
_service.disable_retries()
- self.test_update_instance_group_manager_action_value_error()
+ self.test_get_operating_system_value_error()
-class TestListInstanceGroupManagerPolicies:
+# endregion
+##############################################################################
+# End of Service: Images
+##############################################################################
+
+##############################################################################
+# Start of Service: InstanceGroups
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_instance_group_manager_policies
+ 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 TestListInstanceGroups:
+ """
+ Test Class for list_instance_groups
"""
@responses.activate
- def test_list_instance_group_manager_policies_all_params(self):
+ def test_list_instance_groups_all_params(self):
"""
- list_instance_group_manager_policies()
+ list_instance_groups()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}], "total_count": 132}'
+ url = preprocess_url('/instance_groups')
+ mock_response = '{"first": {"href": "href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15868,15 +15539,11 @@ def test_list_instance_group_manager_policies_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
start = 'testString'
limit = 50
# Invoke method
- response = _service.list_instance_group_manager_policies(
- instance_group_id,
- instance_group_manager_id,
+ response = _service.list_instance_groups(
start=start,
limit=limit,
headers={},
@@ -15891,23 +15558,23 @@ def test_list_instance_group_manager_policies_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- def test_list_instance_group_manager_policies_all_params_with_retries(self):
- # Enable retries and run test_list_instance_group_manager_policies_all_params.
+ def test_list_instance_groups_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_groups_all_params.
_service.enable_retries()
- self.test_list_instance_group_manager_policies_all_params()
+ self.test_list_instance_groups_all_params()
- # Disable retries and run test_list_instance_group_manager_policies_all_params.
+ # Disable retries and run test_list_instance_groups_all_params.
_service.disable_retries()
- self.test_list_instance_group_manager_policies_all_params()
+ self.test_list_instance_groups_all_params()
@responses.activate
- def test_list_instance_group_manager_policies_required_params(self):
+ def test_list_instance_groups_required_params(self):
"""
- test_list_instance_group_manager_policies_required_params()
+ test_list_instance_groups_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}], "total_count": 132}'
+ url = preprocess_url('/instance_groups')
+ mock_response = '{"first": {"href": "href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15916,38 +15583,30 @@ def test_list_instance_group_manager_policies_required_params(self):
status=200,
)
- # Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
-
# Invoke method
- response = _service.list_instance_group_manager_policies(
- instance_group_id,
- instance_group_manager_id,
- headers={},
- )
+ response = _service.list_instance_groups()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_group_manager_policies_required_params_with_retries(self):
- # Enable retries and run test_list_instance_group_manager_policies_required_params.
+ def test_list_instance_groups_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_groups_required_params.
_service.enable_retries()
- self.test_list_instance_group_manager_policies_required_params()
+ self.test_list_instance_groups_required_params()
- # Disable retries and run test_list_instance_group_manager_policies_required_params.
+ # Disable retries and run test_list_instance_groups_required_params.
_service.disable_retries()
- self.test_list_instance_group_manager_policies_required_params()
+ self.test_list_instance_groups_required_params()
@responses.activate
- def test_list_instance_group_manager_policies_value_error(self):
+ def test_list_instance_groups_value_error(self):
"""
- test_list_instance_group_manager_policies_value_error()
+ test_list_instance_groups_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}], "total_count": 132}'
+ url = preprocess_url('/instance_groups')
+ mock_response = '{"first": {"href": "href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -15956,38 +15615,32 @@ def test_list_instance_group_manager_policies_value_error(self):
status=200,
)
- # Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_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_instance_group_manager_policies(**req_copy)
+ _service.list_instance_groups(**req_copy)
- def test_list_instance_group_manager_policies_value_error_with_retries(self):
- # Enable retries and run test_list_instance_group_manager_policies_value_error.
+ def test_list_instance_groups_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_groups_value_error.
_service.enable_retries()
- self.test_list_instance_group_manager_policies_value_error()
+ self.test_list_instance_groups_value_error()
- # Disable retries and run test_list_instance_group_manager_policies_value_error.
+ # Disable retries and run test_list_instance_groups_value_error.
_service.disable_retries()
- self.test_list_instance_group_manager_policies_value_error()
+ self.test_list_instance_groups_value_error()
@responses.activate
- def test_list_instance_group_manager_policies_with_pager_get_next(self):
+ def test_list_instance_groups_with_pager_get_next(self):
"""
- test_list_instance_group_manager_policies_with_pager_get_next()
+ test_list_instance_groups_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
+ url = preprocess_url('/instance_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -16005,10 +15658,8 @@ def test_list_instance_group_manager_policies_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = InstanceGroupManagerPoliciesPager(
+ pager = InstanceGroupsPager(
client=_service,
- instance_group_id='testString',
- instance_group_manager_id='testString',
limit=10,
)
while pager.has_next():
@@ -16018,14 +15669,14 @@ def test_list_instance_group_manager_policies_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_instance_group_manager_policies_with_pager_get_all(self):
+ def test_list_instance_groups_with_pager_get_all(self):
"""
- test_list_instance_group_manager_policies_with_pager_get_all()
+ test_list_instance_groups_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
+ url = preprocess_url('/instance_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","id":"r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -16042,10 +15693,8 @@ def test_list_instance_group_manager_policies_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = InstanceGroupManagerPoliciesPager(
+ pager = InstanceGroupsPager(
client=_service,
- instance_group_id='testString',
- instance_group_manager_id='testString',
limit=10,
)
all_results = pager.get_all()
@@ -16053,19 +15702,19 @@ def test_list_instance_group_manager_policies_with_pager_get_all(self):
assert len(all_results) == 2
-class TestCreateInstanceGroupManagerPolicy:
+class TestCreateInstanceGroup:
"""
- Test Class for create_instance_group_manager_policy
+ Test Class for create_instance_group
"""
@responses.activate
- def test_create_instance_group_manager_policy_all_params(self):
+ def test_create_instance_group_all_params(self):
"""
- create_instance_group_manager_policy()
+ create_instance_group()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ url = preprocess_url('/instance_groups')
+ mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -16074,23 +15723,46 @@ def test_create_instance_group_manager_policy_all_params(self):
status=201,
)
- # Construct a dict representation of a InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model
- instance_group_manager_policy_prototype_model = {}
- instance_group_manager_policy_prototype_model['name'] = 'my-instance-group-manager-policy'
- instance_group_manager_policy_prototype_model['metric_type'] = 'cpu'
- instance_group_manager_policy_prototype_model['metric_value'] = 0
- instance_group_manager_policy_prototype_model['policy_type'] = 'target'
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- instance_group_manager_policy_prototype = instance_group_manager_policy_prototype_model
+ instance_template = instance_template_identity_model
+ subnets = [subnet_identity_model]
+ application_port = 22
+ load_balancer = load_balancer_identity_model
+ load_balancer_pool = load_balancer_pool_identity_model
+ membership_count = 10
+ name = 'my-instance-group'
+ resource_group = resource_group_identity_model
# Invoke method
- response = _service.create_instance_group_manager_policy(
- instance_group_id,
- instance_group_manager_id,
- instance_group_manager_policy_prototype,
+ response = _service.create_instance_group(
+ instance_template,
+ subnets,
+ application_port=application_port,
+ load_balancer=load_balancer,
+ load_balancer_pool=load_balancer_pool,
+ membership_count=membership_count,
+ name=name,
+ resource_group=resource_group,
headers={},
)
@@ -16099,25 +15771,32 @@ def test_create_instance_group_manager_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 == instance_group_manager_policy_prototype
+ assert req_body['instance_template'] == instance_template_identity_model
+ assert req_body['subnets'] == [subnet_identity_model]
+ assert req_body['application_port'] == 22
+ assert req_body['load_balancer'] == load_balancer_identity_model
+ assert req_body['load_balancer_pool'] == load_balancer_pool_identity_model
+ assert req_body['membership_count'] == 10
+ assert req_body['name'] == 'my-instance-group'
+ assert req_body['resource_group'] == resource_group_identity_model
- def test_create_instance_group_manager_policy_all_params_with_retries(self):
- # Enable retries and run test_create_instance_group_manager_policy_all_params.
+ def test_create_instance_group_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_group_all_params.
_service.enable_retries()
- self.test_create_instance_group_manager_policy_all_params()
+ self.test_create_instance_group_all_params()
- # Disable retries and run test_create_instance_group_manager_policy_all_params.
+ # Disable retries and run test_create_instance_group_all_params.
_service.disable_retries()
- self.test_create_instance_group_manager_policy_all_params()
+ self.test_create_instance_group_all_params()
@responses.activate
- def test_create_instance_group_manager_policy_value_error(self):
+ def test_create_instance_group_value_error(self):
"""
- test_create_instance_group_manager_policy_value_error()
+ test_create_instance_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ url = preprocess_url('/instance_groups')
+ mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -16126,51 +15805,68 @@ def test_create_instance_group_manager_policy_value_error(self):
status=201,
)
- # Construct a dict representation of a InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model
- instance_group_manager_policy_prototype_model = {}
- instance_group_manager_policy_prototype_model['name'] = 'my-instance-group-manager-policy'
- instance_group_manager_policy_prototype_model['metric_type'] = 'cpu'
- instance_group_manager_policy_prototype_model['metric_value'] = 0
- instance_group_manager_policy_prototype_model['policy_type'] = 'target'
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
- instance_group_manager_policy_prototype = instance_group_manager_policy_prototype_model
+ instance_template = instance_template_identity_model
+ subnets = [subnet_identity_model]
+ application_port = 22
+ load_balancer = load_balancer_identity_model
+ load_balancer_pool = load_balancer_pool_identity_model
+ membership_count = 10
+ name = 'my-instance-group'
+ resource_group = resource_group_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_id,
- "instance_group_manager_policy_prototype": instance_group_manager_policy_prototype,
+ "instance_template": instance_template,
+ "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_instance_group_manager_policy(**req_copy)
+ _service.create_instance_group(**req_copy)
- def test_create_instance_group_manager_policy_value_error_with_retries(self):
- # Enable retries and run test_create_instance_group_manager_policy_value_error.
+ def test_create_instance_group_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_group_value_error.
_service.enable_retries()
- self.test_create_instance_group_manager_policy_value_error()
+ self.test_create_instance_group_value_error()
- # Disable retries and run test_create_instance_group_manager_policy_value_error.
+ # Disable retries and run test_create_instance_group_value_error.
_service.disable_retries()
- self.test_create_instance_group_manager_policy_value_error()
+ self.test_create_instance_group_value_error()
-class TestDeleteInstanceGroupManagerPolicy:
+class TestDeleteInstanceGroup:
"""
- Test Class for delete_instance_group_manager_policy
+ Test Class for delete_instance_group
"""
@responses.activate
- def test_delete_instance_group_manager_policy_all_params(self):
+ def test_delete_instance_group_all_params(self):
"""
- delete_instance_group_manager_policy()
+ delete_instance_group()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
+ url = preprocess_url('/instance_groups/testString')
responses.add(
responses.DELETE,
url,
@@ -16178,14 +15874,10 @@ def test_delete_instance_group_manager_policy_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_instance_group_manager_policy(
- instance_group_id,
- instance_group_manager_id,
+ response = _service.delete_instance_group(
id,
headers={},
)
@@ -16194,22 +15886,22 @@ def test_delete_instance_group_manager_policy_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_instance_group_manager_policy_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_manager_policy_all_params.
+ def test_delete_instance_group_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_all_params.
_service.enable_retries()
- self.test_delete_instance_group_manager_policy_all_params()
+ self.test_delete_instance_group_all_params()
- # Disable retries and run test_delete_instance_group_manager_policy_all_params.
+ # Disable retries and run test_delete_instance_group_all_params.
_service.disable_retries()
- self.test_delete_instance_group_manager_policy_all_params()
+ self.test_delete_instance_group_all_params()
@responses.activate
- def test_delete_instance_group_manager_policy_value_error(self):
+ def test_delete_instance_group_value_error(self):
"""
- test_delete_instance_group_manager_policy_value_error()
+ test_delete_instance_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
+ url = preprocess_url('/instance_groups/testString')
responses.add(
responses.DELETE,
url,
@@ -16217,44 +15909,40 @@ def test_delete_instance_group_manager_policy_value_error(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_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_instance_group_manager_policy(**req_copy)
+ _service.delete_instance_group(**req_copy)
- def test_delete_instance_group_manager_policy_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_manager_policy_value_error.
+ def test_delete_instance_group_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_value_error.
_service.enable_retries()
- self.test_delete_instance_group_manager_policy_value_error()
+ self.test_delete_instance_group_value_error()
- # Disable retries and run test_delete_instance_group_manager_policy_value_error.
+ # Disable retries and run test_delete_instance_group_value_error.
_service.disable_retries()
- self.test_delete_instance_group_manager_policy_value_error()
+ self.test_delete_instance_group_value_error()
-class TestGetInstanceGroupManagerPolicy:
+class TestGetInstanceGroup:
"""
- Test Class for get_instance_group_manager_policy
+ Test Class for get_instance_group
"""
@responses.activate
- def test_get_instance_group_manager_policy_all_params(self):
+ def test_get_instance_group_all_params(self):
"""
- get_instance_group_manager_policy()
+ get_instance_group()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ url = preprocess_url('/instance_groups/testString')
+ mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -16264,14 +15952,10 @@ def test_get_instance_group_manager_policy_all_params(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_instance_group_manager_policy(
- instance_group_id,
- instance_group_manager_id,
+ response = _service.get_instance_group(
id,
headers={},
)
@@ -16280,23 +15964,23 @@ def test_get_instance_group_manager_policy_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_group_manager_policy_all_params_with_retries(self):
- # Enable retries and run test_get_instance_group_manager_policy_all_params.
+ def test_get_instance_group_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_group_all_params.
_service.enable_retries()
- self.test_get_instance_group_manager_policy_all_params()
+ self.test_get_instance_group_all_params()
- # Disable retries and run test_get_instance_group_manager_policy_all_params.
+ # Disable retries and run test_get_instance_group_all_params.
_service.disable_retries()
- self.test_get_instance_group_manager_policy_all_params()
+ self.test_get_instance_group_all_params()
@responses.activate
- def test_get_instance_group_manager_policy_value_error(self):
+ def test_get_instance_group_value_error(self):
"""
- test_get_instance_group_manager_policy_value_error()
+ test_get_instance_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ url = preprocess_url('/instance_groups/testString')
+ mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -16306,44 +15990,40 @@ def test_get_instance_group_manager_policy_value_error(self):
)
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_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_instance_group_manager_policy(**req_copy)
+ _service.get_instance_group(**req_copy)
- def test_get_instance_group_manager_policy_value_error_with_retries(self):
- # Enable retries and run test_get_instance_group_manager_policy_value_error.
+ def test_get_instance_group_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_group_value_error.
_service.enable_retries()
- self.test_get_instance_group_manager_policy_value_error()
+ self.test_get_instance_group_value_error()
- # Disable retries and run test_get_instance_group_manager_policy_value_error.
+ # Disable retries and run test_get_instance_group_value_error.
_service.disable_retries()
- self.test_get_instance_group_manager_policy_value_error()
+ self.test_get_instance_group_value_error()
-class TestUpdateInstanceGroupManagerPolicy:
+class TestUpdateInstanceGroup:
"""
- Test Class for update_instance_group_manager_policy
+ Test Class for update_instance_group
"""
@responses.activate
- def test_update_instance_group_manager_policy_all_params(self):
+ def test_update_instance_group_all_params(self):
"""
- update_instance_group_manager_policy()
+ update_instance_group()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ url = preprocess_url('/instance_groups/testString')
+ mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.PATCH,
url,
@@ -16352,24 +16032,40 @@ def test_update_instance_group_manager_policy_all_params(self):
status=200,
)
- # Construct a dict representation of a InstanceGroupManagerPolicyPatch model
- instance_group_manager_policy_patch_model = {}
- instance_group_manager_policy_patch_model['metric_type'] = 'cpu'
- instance_group_manager_policy_patch_model['metric_value'] = 75
- instance_group_manager_policy_patch_model['name'] = 'my-instance-group-manager-policy'
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a InstanceGroupPatch model
+ instance_group_patch_model = {}
+ instance_group_patch_model['application_port'] = 22
+ instance_group_patch_model['instance_template'] = instance_template_identity_model
+ instance_group_patch_model['load_balancer'] = load_balancer_identity_model
+ instance_group_patch_model['load_balancer_pool'] = load_balancer_pool_identity_model
+ instance_group_patch_model['membership_count'] = 20
+ instance_group_patch_model['name'] = 'my-instance-group'
+ instance_group_patch_model['subnets'] = [subnet_identity_model]
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
id = 'testString'
- instance_group_manager_policy_patch = instance_group_manager_policy_patch_model
+ instance_group_patch = instance_group_patch_model
# Invoke method
- response = _service.update_instance_group_manager_policy(
- instance_group_id,
- instance_group_manager_id,
+ response = _service.update_instance_group(
id,
- instance_group_manager_policy_patch,
+ instance_group_patch,
headers={},
)
@@ -16378,25 +16074,25 @@ def test_update_instance_group_manager_policy_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 == instance_group_manager_policy_patch
+ assert req_body == instance_group_patch
- def test_update_instance_group_manager_policy_all_params_with_retries(self):
- # Enable retries and run test_update_instance_group_manager_policy_all_params.
+ def test_update_instance_group_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_group_all_params.
_service.enable_retries()
- self.test_update_instance_group_manager_policy_all_params()
+ self.test_update_instance_group_all_params()
- # Disable retries and run test_update_instance_group_manager_policy_all_params.
+ # Disable retries and run test_update_instance_group_all_params.
_service.disable_retries()
- self.test_update_instance_group_manager_policy_all_params()
+ self.test_update_instance_group_all_params()
@responses.activate
- def test_update_instance_group_manager_policy_value_error(self):
+ def test_update_instance_group_value_error(self):
"""
- test_update_instance_group_manager_policy_value_error()
+ test_update_instance_group_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ url = preprocess_url('/instance_groups/testString')
+ mock_response = '{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.PATCH,
url,
@@ -16405,52 +16101,68 @@ def test_update_instance_group_manager_policy_value_error(self):
status=200,
)
- # Construct a dict representation of a InstanceGroupManagerPolicyPatch model
- instance_group_manager_policy_patch_model = {}
- instance_group_manager_policy_patch_model['metric_type'] = 'cpu'
- instance_group_manager_policy_patch_model['metric_value'] = 75
- instance_group_manager_policy_patch_model['name'] = 'my-instance-group-manager-policy'
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a InstanceGroupPatch model
+ instance_group_patch_model = {}
+ instance_group_patch_model['application_port'] = 22
+ instance_group_patch_model['instance_template'] = instance_template_identity_model
+ instance_group_patch_model['load_balancer'] = load_balancer_identity_model
+ instance_group_patch_model['load_balancer_pool'] = load_balancer_pool_identity_model
+ instance_group_patch_model['membership_count'] = 20
+ instance_group_patch_model['name'] = 'my-instance-group'
+ instance_group_patch_model['subnets'] = [subnet_identity_model]
# Set up parameter values
- instance_group_id = 'testString'
- instance_group_manager_id = 'testString'
id = 'testString'
- instance_group_manager_policy_patch = instance_group_manager_policy_patch_model
+ instance_group_patch = instance_group_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "instance_group_id": instance_group_id,
- "instance_group_manager_id": instance_group_manager_id,
"id": id,
- "instance_group_manager_policy_patch": instance_group_manager_policy_patch,
+ "instance_group_patch": instance_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_instance_group_manager_policy(**req_copy)
+ _service.update_instance_group(**req_copy)
- def test_update_instance_group_manager_policy_value_error_with_retries(self):
- # Enable retries and run test_update_instance_group_manager_policy_value_error.
+ def test_update_instance_group_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_group_value_error.
_service.enable_retries()
- self.test_update_instance_group_manager_policy_value_error()
+ self.test_update_instance_group_value_error()
- # Disable retries and run test_update_instance_group_manager_policy_value_error.
+ # Disable retries and run test_update_instance_group_value_error.
_service.disable_retries()
- self.test_update_instance_group_manager_policy_value_error()
+ self.test_update_instance_group_value_error()
-class TestDeleteInstanceGroupMemberships:
+class TestDeleteInstanceGroupLoadBalancer:
"""
- Test Class for delete_instance_group_memberships
+ Test Class for delete_instance_group_load_balancer
"""
@responses.activate
- def test_delete_instance_group_memberships_all_params(self):
+ def test_delete_instance_group_load_balancer_all_params(self):
"""
- delete_instance_group_memberships()
+ delete_instance_group_load_balancer()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships')
+ url = preprocess_url('/instance_groups/testString/load_balancer')
responses.add(
responses.DELETE,
url,
@@ -16461,7 +16173,7 @@ def test_delete_instance_group_memberships_all_params(self):
instance_group_id = 'testString'
# Invoke method
- response = _service.delete_instance_group_memberships(
+ response = _service.delete_instance_group_load_balancer(
instance_group_id,
headers={},
)
@@ -16470,22 +16182,22 @@ def test_delete_instance_group_memberships_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_instance_group_memberships_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_memberships_all_params.
+ def test_delete_instance_group_load_balancer_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_load_balancer_all_params.
_service.enable_retries()
- self.test_delete_instance_group_memberships_all_params()
+ self.test_delete_instance_group_load_balancer_all_params()
- # Disable retries and run test_delete_instance_group_memberships_all_params.
+ # Disable retries and run test_delete_instance_group_load_balancer_all_params.
_service.disable_retries()
- self.test_delete_instance_group_memberships_all_params()
+ self.test_delete_instance_group_load_balancer_all_params()
@responses.activate
- def test_delete_instance_group_memberships_value_error(self):
+ def test_delete_instance_group_load_balancer_value_error(self):
"""
- test_delete_instance_group_memberships_value_error()
+ test_delete_instance_group_load_balancer_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships')
+ url = preprocess_url('/instance_groups/testString/load_balancer')
responses.add(
responses.DELETE,
url,
@@ -16502,31 +16214,31 @@ def test_delete_instance_group_memberships_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_instance_group_memberships(**req_copy)
+ _service.delete_instance_group_load_balancer(**req_copy)
- def test_delete_instance_group_memberships_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_memberships_value_error.
+ def test_delete_instance_group_load_balancer_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_load_balancer_value_error.
_service.enable_retries()
- self.test_delete_instance_group_memberships_value_error()
+ self.test_delete_instance_group_load_balancer_value_error()
- # Disable retries and run test_delete_instance_group_memberships_value_error.
+ # Disable retries and run test_delete_instance_group_load_balancer_value_error.
_service.disable_retries()
- self.test_delete_instance_group_memberships_value_error()
+ self.test_delete_instance_group_load_balancer_value_error()
-class TestListInstanceGroupMemberships:
+class TestListInstanceGroupManagers:
"""
- Test Class for list_instance_group_memberships
+ Test Class for list_instance_group_managers
"""
@responses.activate
- def test_list_instance_group_memberships_all_params(self):
+ def test_list_instance_group_managers_all_params(self):
"""
- list_instance_group_memberships()
+ list_instance_group_managers()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -16541,7 +16253,7 @@ def test_list_instance_group_memberships_all_params(self):
limit = 50
# Invoke method
- response = _service.list_instance_group_memberships(
+ response = _service.list_instance_group_managers(
instance_group_id,
start=start,
limit=limit,
@@ -16557,23 +16269,23 @@ def test_list_instance_group_memberships_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- def test_list_instance_group_memberships_all_params_with_retries(self):
- # Enable retries and run test_list_instance_group_memberships_all_params.
+ def test_list_instance_group_managers_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_managers_all_params.
_service.enable_retries()
- self.test_list_instance_group_memberships_all_params()
+ self.test_list_instance_group_managers_all_params()
- # Disable retries and run test_list_instance_group_memberships_all_params.
+ # Disable retries and run test_list_instance_group_managers_all_params.
_service.disable_retries()
- self.test_list_instance_group_memberships_all_params()
+ self.test_list_instance_group_managers_all_params()
@responses.activate
- def test_list_instance_group_memberships_required_params(self):
+ def test_list_instance_group_managers_required_params(self):
"""
- test_list_instance_group_memberships_required_params()
+ test_list_instance_group_managers_required_params()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -16586,7 +16298,7 @@ def test_list_instance_group_memberships_required_params(self):
instance_group_id = 'testString'
# Invoke method
- response = _service.list_instance_group_memberships(
+ response = _service.list_instance_group_managers(
instance_group_id,
headers={},
)
@@ -16595,23 +16307,23 @@ def test_list_instance_group_memberships_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_instance_group_memberships_required_params_with_retries(self):
- # Enable retries and run test_list_instance_group_memberships_required_params.
+ def test_list_instance_group_managers_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_managers_required_params.
_service.enable_retries()
- self.test_list_instance_group_memberships_required_params()
+ self.test_list_instance_group_managers_required_params()
- # Disable retries and run test_list_instance_group_memberships_required_params.
+ # Disable retries and run test_list_instance_group_managers_required_params.
_service.disable_retries()
- self.test_list_instance_group_memberships_required_params()
+ self.test_list_instance_group_managers_required_params()
@responses.activate
- def test_list_instance_group_memberships_value_error(self):
+ def test_list_instance_group_managers_value_error(self):
"""
- test_list_instance_group_memberships_value_error()
+ test_list_instance_group_managers_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -16630,26 +16342,26 @@ def test_list_instance_group_memberships_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_instance_group_memberships(**req_copy)
+ _service.list_instance_group_managers(**req_copy)
- def test_list_instance_group_memberships_value_error_with_retries(self):
- # Enable retries and run test_list_instance_group_memberships_value_error.
+ def test_list_instance_group_managers_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_group_managers_value_error.
_service.enable_retries()
- self.test_list_instance_group_memberships_value_error()
+ self.test_list_instance_group_managers_value_error()
- # Disable retries and run test_list_instance_group_memberships_value_error.
+ # Disable retries and run test_list_instance_group_managers_value_error.
_service.disable_retries()
- self.test_list_instance_group_memberships_value_error()
+ self.test_list_instance_group_managers_value_error()
@responses.activate
- def test_list_instance_group_memberships_with_pager_get_next(self):
+ def test_list_instance_group_managers_with_pager_get_next(self):
"""
- test_list_instance_group_memberships_with_pager_get_next()
+ test_list_instance_group_managers_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/memberships')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
responses.add(
responses.GET,
url,
@@ -16667,7 +16379,7 @@ def test_list_instance_group_memberships_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = InstanceGroupMembershipsPager(
+ pager = InstanceGroupManagersPager(
client=_service,
instance_group_id='testString',
limit=10,
@@ -16679,14 +16391,14 @@ def test_list_instance_group_memberships_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_instance_group_memberships_with_pager_get_all(self):
+ def test_list_instance_group_managers_with_pager_get_all(self):
"""
- test_list_instance_group_memberships_with_pager_get_all()
+ test_list_instance_group_managers_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/instance_groups/testString/memberships')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea","id":"r006-bd21f31f-8a05-4451-836d-ab0347e91fea","management_enabled":true,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy"}]}]}'
responses.add(
responses.GET,
url,
@@ -16703,7 +16415,7 @@ def test_list_instance_group_memberships_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = InstanceGroupMembershipsPager(
+ pager = InstanceGroupManagersPager(
client=_service,
instance_group_id='testString',
limit=10,
@@ -16713,18 +16425,126 @@ def test_list_instance_group_memberships_with_pager_get_all(self):
assert len(all_results) == 2
-class TestDeleteInstanceGroupMembership:
+class TestCreateInstanceGroupManager:
"""
- Test Class for delete_instance_group_membership
+ Test Class for create_instance_group_manager
"""
@responses.activate
- def test_delete_instance_group_membership_all_params(self):
+ def test_create_instance_group_manager_all_params(self):
"""
- delete_instance_group_membership()
+ create_instance_group_manager()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships/testString')
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ responses.add(
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
+ )
+
+ # Construct a dict representation of a InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model
+ instance_group_manager_prototype_model = {}
+ instance_group_manager_prototype_model['management_enabled'] = True
+ instance_group_manager_prototype_model['name'] = 'my-instance-group-manager'
+ instance_group_manager_prototype_model['aggregation_window'] = 120
+ instance_group_manager_prototype_model['cooldown'] = 210
+ instance_group_manager_prototype_model['manager_type'] = 'autoscale'
+ instance_group_manager_prototype_model['max_membership_count'] = 10
+ instance_group_manager_prototype_model['min_membership_count'] = 10
+
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_prototype = instance_group_manager_prototype_model
+
+ # Invoke method
+ response = _service.create_instance_group_manager(
+ instance_group_id,
+ instance_group_manager_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 == instance_group_manager_prototype
+
+ def test_create_instance_group_manager_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_group_manager_all_params.
+ _service.enable_retries()
+ self.test_create_instance_group_manager_all_params()
+
+ # Disable retries and run test_create_instance_group_manager_all_params.
+ _service.disable_retries()
+ self.test_create_instance_group_manager_all_params()
+
+ @responses.activate
+ def test_create_instance_group_manager_value_error(self):
+ """
+ test_create_instance_group_manager_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/instance_groups/testString/managers')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
+ responses.add(
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
+ )
+
+ # Construct a dict representation of a InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model
+ instance_group_manager_prototype_model = {}
+ instance_group_manager_prototype_model['management_enabled'] = True
+ instance_group_manager_prototype_model['name'] = 'my-instance-group-manager'
+ instance_group_manager_prototype_model['aggregation_window'] = 120
+ instance_group_manager_prototype_model['cooldown'] = 210
+ instance_group_manager_prototype_model['manager_type'] = 'autoscale'
+ instance_group_manager_prototype_model['max_membership_count'] = 10
+ instance_group_manager_prototype_model['min_membership_count'] = 10
+
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_prototype = instance_group_manager_prototype_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_prototype": instance_group_manager_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_instance_group_manager(**req_copy)
+
+ def test_create_instance_group_manager_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_group_manager_value_error.
+ _service.enable_retries()
+ self.test_create_instance_group_manager_value_error()
+
+ # Disable retries and run test_create_instance_group_manager_value_error.
+ _service.disable_retries()
+ self.test_create_instance_group_manager_value_error()
+
+
+class TestDeleteInstanceGroupManager:
+ """
+ Test Class for delete_instance_group_manager
+ """
+
+ @responses.activate
+ def test_delete_instance_group_manager_all_params(self):
+ """
+ delete_instance_group_manager()
+ """
+ # Set up mock
+ url = preprocess_url('/instance_groups/testString/managers/testString')
responses.add(
responses.DELETE,
url,
@@ -16736,7 +16556,7 @@ def test_delete_instance_group_membership_all_params(self):
id = 'testString'
# Invoke method
- response = _service.delete_instance_group_membership(
+ response = _service.delete_instance_group_manager(
instance_group_id,
id,
headers={},
@@ -16746,22 +16566,22 @@ def test_delete_instance_group_membership_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_instance_group_membership_all_params_with_retries(self):
- # Enable retries and run test_delete_instance_group_membership_all_params.
+ def test_delete_instance_group_manager_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_manager_all_params.
_service.enable_retries()
- self.test_delete_instance_group_membership_all_params()
+ self.test_delete_instance_group_manager_all_params()
- # Disable retries and run test_delete_instance_group_membership_all_params.
+ # Disable retries and run test_delete_instance_group_manager_all_params.
_service.disable_retries()
- self.test_delete_instance_group_membership_all_params()
+ self.test_delete_instance_group_manager_all_params()
@responses.activate
- def test_delete_instance_group_membership_value_error(self):
+ def test_delete_instance_group_manager_value_error(self):
"""
- test_delete_instance_group_membership_value_error()
+ test_delete_instance_group_manager_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships/testString')
+ url = preprocess_url('/instance_groups/testString/managers/testString')
responses.add(
responses.DELETE,
url,
@@ -16780,31 +16600,31 @@ def test_delete_instance_group_membership_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_instance_group_membership(**req_copy)
+ _service.delete_instance_group_manager(**req_copy)
- def test_delete_instance_group_membership_value_error_with_retries(self):
- # Enable retries and run test_delete_instance_group_membership_value_error.
+ def test_delete_instance_group_manager_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_manager_value_error.
_service.enable_retries()
- self.test_delete_instance_group_membership_value_error()
+ self.test_delete_instance_group_manager_value_error()
- # Disable retries and run test_delete_instance_group_membership_value_error.
+ # Disable retries and run test_delete_instance_group_manager_value_error.
_service.disable_retries()
- self.test_delete_instance_group_membership_value_error()
+ self.test_delete_instance_group_manager_value_error()
-class TestGetInstanceGroupMembership:
+class TestGetInstanceGroupManager:
"""
- Test Class for get_instance_group_membership
+ Test Class for get_instance_group_manager
"""
@responses.activate
- def test_get_instance_group_membership_all_params(self):
+ def test_get_instance_group_manager_all_params(self):
"""
- get_instance_group_membership()
+ get_instance_group_manager()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
+ url = preprocess_url('/instance_groups/testString/managers/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
responses.add(
responses.GET,
url,
@@ -16818,7 +16638,7 @@ def test_get_instance_group_membership_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_instance_group_membership(
+ response = _service.get_instance_group_manager(
instance_group_id,
id,
headers={},
@@ -16828,23 +16648,23 @@ def test_get_instance_group_membership_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_instance_group_membership_all_params_with_retries(self):
- # Enable retries and run test_get_instance_group_membership_all_params.
+ def test_get_instance_group_manager_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_group_manager_all_params.
_service.enable_retries()
- self.test_get_instance_group_membership_all_params()
+ self.test_get_instance_group_manager_all_params()
- # Disable retries and run test_get_instance_group_membership_all_params.
+ # Disable retries and run test_get_instance_group_manager_all_params.
_service.disable_retries()
- self.test_get_instance_group_membership_all_params()
+ self.test_get_instance_group_manager_all_params()
@responses.activate
- def test_get_instance_group_membership_value_error(self):
+ def test_get_instance_group_manager_value_error(self):
"""
- test_get_instance_group_membership_value_error()
+ test_get_instance_group_manager_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
+ url = preprocess_url('/instance_groups/testString/managers/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
responses.add(
responses.GET,
url,
@@ -16865,31 +16685,31 @@ def test_get_instance_group_membership_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_instance_group_membership(**req_copy)
+ _service.get_instance_group_manager(**req_copy)
- def test_get_instance_group_membership_value_error_with_retries(self):
- # Enable retries and run test_get_instance_group_membership_value_error.
+ def test_get_instance_group_manager_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_group_manager_value_error.
_service.enable_retries()
- self.test_get_instance_group_membership_value_error()
+ self.test_get_instance_group_manager_value_error()
- # Disable retries and run test_get_instance_group_membership_value_error.
+ # Disable retries and run test_get_instance_group_manager_value_error.
_service.disable_retries()
- self.test_get_instance_group_membership_value_error()
+ self.test_get_instance_group_manager_value_error()
-class TestUpdateInstanceGroupMembership:
+class TestUpdateInstanceGroupManager:
"""
- Test Class for update_instance_group_membership
+ Test Class for update_instance_group_manager
"""
@responses.activate
- def test_update_instance_group_membership_all_params(self):
+ def test_update_instance_group_manager_all_params(self):
"""
- update_instance_group_membership()
+ update_instance_group_manager()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
+ url = preprocess_url('/instance_groups/testString/managers/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
responses.add(
responses.PATCH,
url,
@@ -16898,21 +16718,25 @@ def test_update_instance_group_membership_all_params(self):
status=200,
)
- # Construct a dict representation of a InstanceGroupMembershipPatch model
- instance_group_membership_patch_model = {}
- instance_group_membership_patch_model['delete_instance_on_membership_delete'] = False
- instance_group_membership_patch_model['name'] = 'my-instance-group-membership'
+ # Construct a dict representation of a InstanceGroupManagerPatch model
+ instance_group_manager_patch_model = {}
+ instance_group_manager_patch_model['aggregation_window'] = 120
+ instance_group_manager_patch_model['cooldown'] = 210
+ instance_group_manager_patch_model['management_enabled'] = False
+ instance_group_manager_patch_model['max_membership_count'] = 10
+ instance_group_manager_patch_model['min_membership_count'] = 10
+ instance_group_manager_patch_model['name'] = 'my-instance-group-manager'
# Set up parameter values
instance_group_id = 'testString'
id = 'testString'
- instance_group_membership_patch = instance_group_membership_patch_model
+ instance_group_manager_patch = instance_group_manager_patch_model
# Invoke method
- response = _service.update_instance_group_membership(
+ response = _service.update_instance_group_manager(
instance_group_id,
id,
- instance_group_membership_patch,
+ instance_group_manager_patch,
headers={},
)
@@ -16921,25 +16745,25 @@ def test_update_instance_group_membership_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 == instance_group_membership_patch
+ assert req_body == instance_group_manager_patch
- def test_update_instance_group_membership_all_params_with_retries(self):
- # Enable retries and run test_update_instance_group_membership_all_params.
+ def test_update_instance_group_manager_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_group_manager_all_params.
_service.enable_retries()
- self.test_update_instance_group_membership_all_params()
+ self.test_update_instance_group_manager_all_params()
- # Disable retries and run test_update_instance_group_membership_all_params.
+ # Disable retries and run test_update_instance_group_manager_all_params.
_service.disable_retries()
- self.test_update_instance_group_membership_all_params()
+ self.test_update_instance_group_manager_all_params()
@responses.activate
- def test_update_instance_group_membership_value_error(self):
+ def test_update_instance_group_manager_value_error(self):
"""
- test_update_instance_group_membership_value_error()
+ test_update_instance_group_manager_value_error()
"""
# Set up mock
- url = preprocess_url('/instance_groups/testString/memberships/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
+ url = preprocess_url('/instance_groups/testString/managers/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "id": "r006-bd21f31f-8a05-4451-836d-ab0347e91fea", "management_enabled": true, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy"}]}'
responses.add(
responses.PATCH,
url,
@@ -16948,107 +16772,54 @@ def test_update_instance_group_membership_value_error(self):
status=200,
)
- # Construct a dict representation of a InstanceGroupMembershipPatch model
- instance_group_membership_patch_model = {}
- instance_group_membership_patch_model['delete_instance_on_membership_delete'] = False
- instance_group_membership_patch_model['name'] = 'my-instance-group-membership'
+ # Construct a dict representation of a InstanceGroupManagerPatch model
+ instance_group_manager_patch_model = {}
+ instance_group_manager_patch_model['aggregation_window'] = 120
+ instance_group_manager_patch_model['cooldown'] = 210
+ instance_group_manager_patch_model['management_enabled'] = False
+ instance_group_manager_patch_model['max_membership_count'] = 10
+ instance_group_manager_patch_model['min_membership_count'] = 10
+ instance_group_manager_patch_model['name'] = 'my-instance-group-manager'
# Set up parameter values
instance_group_id = 'testString'
id = 'testString'
- instance_group_membership_patch = instance_group_membership_patch_model
+ instance_group_manager_patch = instance_group_manager_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"instance_group_id": instance_group_id,
"id": id,
- "instance_group_membership_patch": instance_group_membership_patch,
+ "instance_group_manager_patch": instance_group_manager_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_instance_group_membership(**req_copy)
+ _service.update_instance_group_manager(**req_copy)
- def test_update_instance_group_membership_value_error_with_retries(self):
- # Enable retries and run test_update_instance_group_membership_value_error.
+ def test_update_instance_group_manager_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_group_manager_value_error.
_service.enable_retries()
- self.test_update_instance_group_membership_value_error()
+ self.test_update_instance_group_manager_value_error()
- # Disable retries and run test_update_instance_group_membership_value_error.
+ # Disable retries and run test_update_instance_group_manager_value_error.
_service.disable_retries()
- self.test_update_instance_group_membership_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: InstanceGroups
-##############################################################################
-
-##############################################################################
-# Start of Service: Reservations
-##############################################################################
-# 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,
- )
+ self.test_update_instance_group_manager_value_error()
-class TestListReservations:
+class TestListInstanceGroupManagerActions:
"""
- Test Class for list_reservations
+ Test Class for list_instance_group_manager_actions
"""
@responses.activate
- def test_list_reservations_all_params(self):
+ def test_list_instance_group_manager_actions_all_params(self):
"""
- list_reservations()
+ list_instance_group_manager_actions()
"""
# Set up mock
- url = preprocess_url('/reservations')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reservations": [{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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('/instance_groups/testString/managers/testString/actions')
+ mock_response = '{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -17058,23 +16829,17 @@ def test_list_reservations_all_params(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
start = 'testString'
limit = 50
- name = 'my-name'
- profile_resource_type = 'testString'
- affinity_policy = 'automatic'
- resource_group_id = 'testString'
- zone_name = 'us-south-1'
# Invoke method
- response = _service.list_reservations(
+ response = _service.list_instance_group_manager_actions(
+ instance_group_id,
+ instance_group_manager_id,
start=start,
limit=limit,
- name=name,
- profile_resource_type=profile_resource_type,
- affinity_policy=affinity_policy,
- resource_group_id=resource_group_id,
- zone_name=zone_name,
headers={},
)
@@ -17086,29 +16851,24 @@ def test_list_reservations_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 'profile.resource_type={}'.format(profile_resource_type) in query_string
- assert 'affinity_policy={}'.format(affinity_policy) in query_string
- assert 'resource_group.id={}'.format(resource_group_id) in query_string
- assert 'zone.name={}'.format(zone_name) in query_string
- def test_list_reservations_all_params_with_retries(self):
- # Enable retries and run test_list_reservations_all_params.
+ def test_list_instance_group_manager_actions_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_manager_actions_all_params.
_service.enable_retries()
- self.test_list_reservations_all_params()
+ self.test_list_instance_group_manager_actions_all_params()
- # Disable retries and run test_list_reservations_all_params.
+ # Disable retries and run test_list_instance_group_manager_actions_all_params.
_service.disable_retries()
- self.test_list_reservations_all_params()
+ self.test_list_instance_group_manager_actions_all_params()
@responses.activate
- def test_list_reservations_required_params(self):
+ def test_list_instance_group_manager_actions_required_params(self):
"""
- test_list_reservations_required_params()
+ test_list_instance_group_manager_actions_required_params()
"""
# Set up mock
- url = preprocess_url('/reservations')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reservations": [{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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('/instance_groups/testString/managers/testString/actions')
+ mock_response = '{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -17117,30 +16877,38 @@ def test_list_reservations_required_params(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+
# Invoke method
- response = _service.list_reservations()
+ response = _service.list_instance_group_manager_actions(
+ instance_group_id,
+ instance_group_manager_id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_reservations_required_params_with_retries(self):
- # Enable retries and run test_list_reservations_required_params.
+ def test_list_instance_group_manager_actions_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_manager_actions_required_params.
_service.enable_retries()
- self.test_list_reservations_required_params()
+ self.test_list_instance_group_manager_actions_required_params()
- # Disable retries and run test_list_reservations_required_params.
+ # Disable retries and run test_list_instance_group_manager_actions_required_params.
_service.disable_retries()
- self.test_list_reservations_required_params()
+ self.test_list_instance_group_manager_actions_required_params()
@responses.activate
- def test_list_reservations_value_error(self):
+ def test_list_instance_group_manager_actions_value_error(self):
"""
- test_list_reservations_value_error()
+ test_list_instance_group_manager_actions_value_error()
"""
# Set up mock
- url = preprocess_url('/reservations')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reservations": [{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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('/instance_groups/testString/managers/testString/actions')
+ mock_response = '{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -17149,32 +16917,38 @@ def test_list_reservations_value_error(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_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_reservations(**req_copy)
+ _service.list_instance_group_manager_actions(**req_copy)
- def test_list_reservations_value_error_with_retries(self):
- # Enable retries and run test_list_reservations_value_error.
+ def test_list_instance_group_manager_actions_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_group_manager_actions_value_error.
_service.enable_retries()
- self.test_list_reservations_value_error()
+ self.test_list_instance_group_manager_actions_value_error()
- # Disable retries and run test_list_reservations_value_error.
+ # Disable retries and run test_list_instance_group_manager_actions_value_error.
_service.disable_retries()
- self.test_list_reservations_value_error()
+ self.test_list_instance_group_manager_actions_value_error()
@responses.activate
- def test_list_reservations_with_pager_get_next(self):
+ def test_list_instance_group_manager_actions_with_pager_get_next(self):
"""
- test_list_reservations_with_pager_get_next()
+ test_list_instance_group_manager_actions_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/reservations')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
responses.add(
responses.GET,
url,
@@ -17192,14 +16966,11 @@ def test_list_reservations_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = ReservationsPager(
+ pager = InstanceGroupManagerActionsPager(
client=_service,
+ instance_group_id='testString',
+ instance_group_manager_id='testString',
limit=10,
- name='my-name',
- profile_resource_type='testString',
- affinity_policy='automatic',
- resource_group_id='testString',
- zone_name='us-south-1',
)
while pager.has_next():
next_page = pager.get_next()
@@ -17208,14 +16979,14 @@ def test_list_reservations_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_reservations_with_pager_get_all(self):
+ def test_list_instance_group_manager_actions_with_pager_get_all(self):
"""
- test_list_reservations_with_pager_get_all()
+ test_list_instance_group_manager_actions_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/reservations')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","id":"r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}'
responses.add(
responses.GET,
url,
@@ -17232,33 +17003,30 @@ def test_list_reservations_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = ReservationsPager(
+ pager = InstanceGroupManagerActionsPager(
client=_service,
+ instance_group_id='testString',
+ instance_group_manager_id='testString',
limit=10,
- name='my-name',
- profile_resource_type='testString',
- affinity_policy='automatic',
- resource_group_id='testString',
- zone_name='us-south-1',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateReservation:
+class TestCreateInstanceGroupManagerAction:
"""
- Test Class for create_reservation
+ Test Class for create_instance_group_manager_action
"""
@responses.activate
- def test_create_reservation_all_params(self):
+ def test_create_instance_group_manager_action_all_params(self):
"""
- create_reservation()
+ create_instance_group_manager_action()
"""
# Set up mock
- url = preprocess_url('/reservations')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions')
+ mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
responses.add(
responses.POST,
url,
@@ -17267,46 +17035,26 @@ def test_create_reservation_all_params(self):
status=201,
)
- # Construct a dict representation of a ReservationCapacityPrototype model
- reservation_capacity_prototype_model = {}
- reservation_capacity_prototype_model['total'] = 10
-
- # Construct a dict representation of a ReservationCommittedUsePrototype model
- reservation_committed_use_prototype_model = {}
- reservation_committed_use_prototype_model['expiration_policy'] = 'release'
- reservation_committed_use_prototype_model['term'] = 'testString'
-
- # Construct a dict representation of a ReservationProfilePrototype model
- reservation_profile_prototype_model = {}
- reservation_profile_prototype_model['name'] = 'bx2-4x16'
- reservation_profile_prototype_model['resource_type'] = 'bare_metal_server_profile'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a InstanceGroupManagerScheduledActionGroupPrototype model
+ instance_group_manager_scheduled_action_group_prototype_model = {}
+ instance_group_manager_scheduled_action_group_prototype_model['membership_count'] = 10
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model
+ instance_group_manager_action_prototype_model = {}
+ instance_group_manager_action_prototype_model['name'] = 'my-instance-group-manager-action'
+ instance_group_manager_action_prototype_model['run_at'] = '2019-01-01T12:00:00Z'
+ instance_group_manager_action_prototype_model['group'] = instance_group_manager_scheduled_action_group_prototype_model
# Set up parameter values
- capacity = reservation_capacity_prototype_model
- committed_use = reservation_committed_use_prototype_model
- profile = reservation_profile_prototype_model
- zone = zone_identity_model
- affinity_policy = 'automatic'
- name = 'my-reservation'
- resource_group = resource_group_identity_model
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+ instance_group_manager_action_prototype = instance_group_manager_action_prototype_model
# Invoke method
- response = _service.create_reservation(
- capacity,
- committed_use,
- profile,
- zone,
- affinity_policy=affinity_policy,
- name=name,
- resource_group=resource_group,
+ response = _service.create_instance_group_manager_action(
+ instance_group_id,
+ instance_group_manager_id,
+ instance_group_manager_action_prototype,
headers={},
)
@@ -17315,31 +17063,25 @@ def test_create_reservation_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['capacity'] == reservation_capacity_prototype_model
- assert req_body['committed_use'] == reservation_committed_use_prototype_model
- assert req_body['profile'] == reservation_profile_prototype_model
- assert req_body['zone'] == zone_identity_model
- assert req_body['affinity_policy'] == 'automatic'
- assert req_body['name'] == 'my-reservation'
- assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body == instance_group_manager_action_prototype
- def test_create_reservation_all_params_with_retries(self):
- # Enable retries and run test_create_reservation_all_params.
+ def test_create_instance_group_manager_action_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_group_manager_action_all_params.
_service.enable_retries()
- self.test_create_reservation_all_params()
+ self.test_create_instance_group_manager_action_all_params()
- # Disable retries and run test_create_reservation_all_params.
+ # Disable retries and run test_create_instance_group_manager_action_all_params.
_service.disable_retries()
- self.test_create_reservation_all_params()
+ self.test_create_instance_group_manager_action_all_params()
@responses.activate
- def test_create_reservation_value_error(self):
+ def test_create_instance_group_manager_action_value_error(self):
"""
- test_create_reservation_value_error()
+ test_create_instance_group_manager_action_value_error()
"""
# Set up mock
- url = preprocess_url('/reservations')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions')
+ mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
responses.add(
responses.POST,
url,
@@ -17348,153 +17090,138 @@ def test_create_reservation_value_error(self):
status=201,
)
- # Construct a dict representation of a ReservationCapacityPrototype model
- reservation_capacity_prototype_model = {}
- reservation_capacity_prototype_model['total'] = 10
-
- # Construct a dict representation of a ReservationCommittedUsePrototype model
- reservation_committed_use_prototype_model = {}
- reservation_committed_use_prototype_model['expiration_policy'] = 'release'
- reservation_committed_use_prototype_model['term'] = 'testString'
-
- # Construct a dict representation of a ReservationProfilePrototype model
- reservation_profile_prototype_model = {}
- reservation_profile_prototype_model['name'] = 'bx2-4x16'
- reservation_profile_prototype_model['resource_type'] = 'bare_metal_server_profile'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a InstanceGroupManagerScheduledActionGroupPrototype model
+ instance_group_manager_scheduled_action_group_prototype_model = {}
+ instance_group_manager_scheduled_action_group_prototype_model['membership_count'] = 10
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model
+ instance_group_manager_action_prototype_model = {}
+ instance_group_manager_action_prototype_model['name'] = 'my-instance-group-manager-action'
+ instance_group_manager_action_prototype_model['run_at'] = '2019-01-01T12:00:00Z'
+ instance_group_manager_action_prototype_model['group'] = instance_group_manager_scheduled_action_group_prototype_model
# Set up parameter values
- capacity = reservation_capacity_prototype_model
- committed_use = reservation_committed_use_prototype_model
- profile = reservation_profile_prototype_model
- zone = zone_identity_model
- affinity_policy = 'automatic'
- name = 'my-reservation'
- resource_group = resource_group_identity_model
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+ instance_group_manager_action_prototype = instance_group_manager_action_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "capacity": capacity,
- "committed_use": committed_use,
- "profile": profile,
- "zone": zone,
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_id,
+ "instance_group_manager_action_prototype": instance_group_manager_action_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_reservation(**req_copy)
+ _service.create_instance_group_manager_action(**req_copy)
- def test_create_reservation_value_error_with_retries(self):
- # Enable retries and run test_create_reservation_value_error.
+ def test_create_instance_group_manager_action_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_group_manager_action_value_error.
_service.enable_retries()
- self.test_create_reservation_value_error()
+ self.test_create_instance_group_manager_action_value_error()
- # Disable retries and run test_create_reservation_value_error.
+ # Disable retries and run test_create_instance_group_manager_action_value_error.
_service.disable_retries()
- self.test_create_reservation_value_error()
+ self.test_create_instance_group_manager_action_value_error()
-class TestDeleteReservation:
+class TestDeleteInstanceGroupManagerAction:
"""
- Test Class for delete_reservation
+ Test Class for delete_instance_group_manager_action
"""
@responses.activate
- def test_delete_reservation_all_params(self):
+ def test_delete_instance_group_manager_action_all_params(self):
"""
- delete_reservation()
+ delete_instance_group_manager_action()
"""
# Set up mock
- url = preprocess_url('/reservations/testString')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_reservation(
+ response = _service.delete_instance_group_manager_action(
+ instance_group_id,
+ instance_group_manager_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_reservation_all_params_with_retries(self):
- # Enable retries and run test_delete_reservation_all_params.
+ def test_delete_instance_group_manager_action_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_manager_action_all_params.
_service.enable_retries()
- self.test_delete_reservation_all_params()
+ self.test_delete_instance_group_manager_action_all_params()
- # Disable retries and run test_delete_reservation_all_params.
+ # Disable retries and run test_delete_instance_group_manager_action_all_params.
_service.disable_retries()
- self.test_delete_reservation_all_params()
+ self.test_delete_instance_group_manager_action_all_params()
@responses.activate
- def test_delete_reservation_value_error(self):
+ def test_delete_instance_group_manager_action_value_error(self):
"""
- test_delete_reservation_value_error()
+ test_delete_instance_group_manager_action_value_error()
"""
# Set up mock
- url = preprocess_url('/reservations/testString')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_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_reservation(**req_copy)
+ _service.delete_instance_group_manager_action(**req_copy)
- def test_delete_reservation_value_error_with_retries(self):
- # Enable retries and run test_delete_reservation_value_error.
+ def test_delete_instance_group_manager_action_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_manager_action_value_error.
_service.enable_retries()
- self.test_delete_reservation_value_error()
+ self.test_delete_instance_group_manager_action_value_error()
- # Disable retries and run test_delete_reservation_value_error.
+ # Disable retries and run test_delete_instance_group_manager_action_value_error.
_service.disable_retries()
- self.test_delete_reservation_value_error()
+ self.test_delete_instance_group_manager_action_value_error()
-class TestGetReservation:
+class TestGetInstanceGroupManagerAction:
"""
- Test Class for get_reservation
+ Test Class for get_instance_group_manager_action
"""
@responses.activate
- def test_get_reservation_all_params(self):
+ def test_get_instance_group_manager_action_all_params(self):
"""
- get_reservation()
+ get_instance_group_manager_action()
"""
# Set up mock
- url = preprocess_url('/reservations/testString')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
+ mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
responses.add(
responses.GET,
url,
@@ -17504,10 +17231,14 @@ def test_get_reservation_all_params(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_reservation(
+ response = _service.get_instance_group_manager_action(
+ instance_group_id,
+ instance_group_manager_id,
id,
headers={},
)
@@ -17516,23 +17247,23 @@ def test_get_reservation_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_reservation_all_params_with_retries(self):
- # Enable retries and run test_get_reservation_all_params.
+ def test_get_instance_group_manager_action_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_group_manager_action_all_params.
_service.enable_retries()
- self.test_get_reservation_all_params()
+ self.test_get_instance_group_manager_action_all_params()
- # Disable retries and run test_get_reservation_all_params.
+ # Disable retries and run test_get_instance_group_manager_action_all_params.
_service.disable_retries()
- self.test_get_reservation_all_params()
+ self.test_get_instance_group_manager_action_all_params()
@responses.activate
- def test_get_reservation_value_error(self):
+ def test_get_instance_group_manager_action_value_error(self):
"""
- test_get_reservation_value_error()
+ test_get_instance_group_manager_action_value_error()
"""
# Set up mock
- url = preprocess_url('/reservations/testString')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
+ mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
responses.add(
responses.GET,
url,
@@ -17542,40 +17273,44 @@ def test_get_reservation_value_error(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_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_reservation(**req_copy)
+ _service.get_instance_group_manager_action(**req_copy)
- def test_get_reservation_value_error_with_retries(self):
- # Enable retries and run test_get_reservation_value_error.
+ def test_get_instance_group_manager_action_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_group_manager_action_value_error.
_service.enable_retries()
- self.test_get_reservation_value_error()
+ self.test_get_instance_group_manager_action_value_error()
- # Disable retries and run test_get_reservation_value_error.
+ # Disable retries and run test_get_instance_group_manager_action_value_error.
_service.disable_retries()
- self.test_get_reservation_value_error()
+ self.test_get_instance_group_manager_action_value_error()
-class TestUpdateReservation:
+class TestUpdateInstanceGroupManagerAction:
"""
- Test Class for update_reservation
+ Test Class for update_instance_group_manager_action
"""
@responses.activate
- def test_update_reservation_all_params(self):
+ def test_update_instance_group_manager_action_all_params(self):
"""
- update_reservation()
+ update_instance_group_manager_action()
"""
# Set up mock
- url = preprocess_url('/reservations/testString')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
+ mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
responses.add(
responses.PATCH,
url,
@@ -17584,36 +17319,37 @@ def test_update_reservation_all_params(self):
status=200,
)
- # Construct a dict representation of a ReservationCapacityPatch model
- reservation_capacity_patch_model = {}
- reservation_capacity_patch_model['total'] = 10
-
- # Construct a dict representation of a ReservationCommittedUsePatch model
- reservation_committed_use_patch_model = {}
- reservation_committed_use_patch_model['expiration_policy'] = 'release'
- reservation_committed_use_patch_model['term'] = 'testString'
+ # Construct a dict representation of a InstanceGroupManagerActionGroupPatch model
+ instance_group_manager_action_group_patch_model = {}
+ instance_group_manager_action_group_patch_model['membership_count'] = 10
- # Construct a dict representation of a ReservationProfilePatch model
- reservation_profile_patch_model = {}
- reservation_profile_patch_model['name'] = 'bx2-4x16'
- reservation_profile_patch_model['resource_type'] = 'bare_metal_server_profile'
+ # Construct a dict representation of a InstanceGroupManagerActionManagerPatch model
+ instance_group_manager_action_manager_patch_model = {}
+ instance_group_manager_action_manager_patch_model['max_membership_count'] = 10
+ instance_group_manager_action_manager_patch_model['min_membership_count'] = 10
- # Construct a dict representation of a ReservationPatch model
- reservation_patch_model = {}
- reservation_patch_model['affinity_policy'] = 'automatic'
- reservation_patch_model['capacity'] = reservation_capacity_patch_model
- reservation_patch_model['committed_use'] = reservation_committed_use_patch_model
- reservation_patch_model['name'] = 'my-reservation'
- reservation_patch_model['profile'] = reservation_profile_patch_model
+ # Construct a dict representation of a InstanceGroupManagerActionPatch model
+ instance_group_manager_action_patch_model = {}
+ instance_group_manager_action_patch_model['auto_delete'] = False
+ instance_group_manager_action_patch_model['auto_delete_timeout'] = 24
+ instance_group_manager_action_patch_model['cron_spec'] = '30 */2 * * 1-5'
+ instance_group_manager_action_patch_model['group'] = instance_group_manager_action_group_patch_model
+ instance_group_manager_action_patch_model['manager'] = instance_group_manager_action_manager_patch_model
+ instance_group_manager_action_patch_model['name'] = 'my-instance-group-manager-action'
+ instance_group_manager_action_patch_model['run_at'] = '2019-01-01T12:00:00Z'
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
- reservation_patch = reservation_patch_model
+ instance_group_manager_action_patch = instance_group_manager_action_patch_model
# Invoke method
- response = _service.update_reservation(
+ response = _service.update_instance_group_manager_action(
+ instance_group_id,
+ instance_group_manager_id,
id,
- reservation_patch,
+ instance_group_manager_action_patch,
headers={},
)
@@ -17622,25 +17358,25 @@ def test_update_reservation_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 == reservation_patch
+ assert req_body == instance_group_manager_action_patch
- def test_update_reservation_all_params_with_retries(self):
- # Enable retries and run test_update_reservation_all_params.
+ def test_update_instance_group_manager_action_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_group_manager_action_all_params.
_service.enable_retries()
- self.test_update_reservation_all_params()
+ self.test_update_instance_group_manager_action_all_params()
- # Disable retries and run test_update_reservation_all_params.
+ # Disable retries and run test_update_instance_group_manager_action_all_params.
_service.disable_retries()
- self.test_update_reservation_all_params()
+ self.test_update_instance_group_manager_action_all_params()
@responses.activate
- def test_update_reservation_value_error(self):
+ def test_update_instance_group_manager_action_value_error(self):
"""
- test_update_reservation_value_error()
+ test_update_instance_group_manager_action_value_error()
"""
# Set up mock
- url = preprocess_url('/reservations/testString')
- mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/actions/testString')
+ mock_response = '{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/actions/r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "id": "r006-b3fda6cb-6f66-4ab4-a636-100ded91e8d7", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}'
responses.add(
responses.PATCH,
url,
@@ -17649,197 +17385,66 @@ def test_update_reservation_value_error(self):
status=200,
)
- # Construct a dict representation of a ReservationCapacityPatch model
- reservation_capacity_patch_model = {}
- reservation_capacity_patch_model['total'] = 10
-
- # Construct a dict representation of a ReservationCommittedUsePatch model
- reservation_committed_use_patch_model = {}
- reservation_committed_use_patch_model['expiration_policy'] = 'release'
- reservation_committed_use_patch_model['term'] = 'testString'
-
- # Construct a dict representation of a ReservationProfilePatch model
- reservation_profile_patch_model = {}
- reservation_profile_patch_model['name'] = 'bx2-4x16'
- reservation_profile_patch_model['resource_type'] = 'bare_metal_server_profile'
-
- # Construct a dict representation of a ReservationPatch model
- reservation_patch_model = {}
- reservation_patch_model['affinity_policy'] = 'automatic'
- reservation_patch_model['capacity'] = reservation_capacity_patch_model
- reservation_patch_model['committed_use'] = reservation_committed_use_patch_model
- reservation_patch_model['name'] = 'my-reservation'
- reservation_patch_model['profile'] = reservation_profile_patch_model
-
- # Set up parameter values
- id = 'testString'
- reservation_patch = reservation_patch_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "reservation_patch": reservation_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_reservation(**req_copy)
-
- def test_update_reservation_value_error_with_retries(self):
- # Enable retries and run test_update_reservation_value_error.
- _service.enable_retries()
- self.test_update_reservation_value_error()
-
- # Disable retries and run test_update_reservation_value_error.
- _service.disable_retries()
- self.test_update_reservation_value_error()
-
-
-class TestActivateReservation:
- """
- Test Class for activate_reservation
- """
-
- @responses.activate
- def test_activate_reservation_all_params(self):
- """
- activate_reservation()
- """
- # Set up mock
- url = preprocess_url('/reservations/testString/activate')
- responses.add(
- responses.POST,
- url,
- status=202,
- )
-
- # Set up parameter values
- id = 'testString'
-
- # Invoke method
- response = _service.activate_reservation(
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- def test_activate_reservation_all_params_with_retries(self):
- # Enable retries and run test_activate_reservation_all_params.
- _service.enable_retries()
- self.test_activate_reservation_all_params()
-
- # Disable retries and run test_activate_reservation_all_params.
- _service.disable_retries()
- self.test_activate_reservation_all_params()
-
- @responses.activate
- def test_activate_reservation_value_error(self):
- """
- test_activate_reservation_value_error()
- """
- # Set up mock
- url = preprocess_url('/reservations/testString/activate')
- responses.add(
- responses.POST,
- 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.activate_reservation(**req_copy)
-
- def test_activate_reservation_value_error_with_retries(self):
- # Enable retries and run test_activate_reservation_value_error.
- _service.enable_retries()
- self.test_activate_reservation_value_error()
-
- # Disable retries and run test_activate_reservation_value_error.
- _service.disable_retries()
- self.test_activate_reservation_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: Reservations
-##############################################################################
-
-##############################################################################
-# Start of Service: DedicatedHosts
-##############################################################################
-# region
-
-
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ # Construct a dict representation of a InstanceGroupManagerActionGroupPatch model
+ instance_group_manager_action_group_patch_model = {}
+ instance_group_manager_action_group_patch_model['membership_count'] = 10
- def test_new_instance(self):
- """
- new_instance()
- """
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
+ # Construct a dict representation of a InstanceGroupManagerActionManagerPatch model
+ instance_group_manager_action_manager_patch_model = {}
+ instance_group_manager_action_manager_patch_model['max_membership_count'] = 10
+ instance_group_manager_action_manager_patch_model['min_membership_count'] = 10
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
- )
+ # Construct a dict representation of a InstanceGroupManagerActionPatch model
+ instance_group_manager_action_patch_model = {}
+ instance_group_manager_action_patch_model['auto_delete'] = False
+ instance_group_manager_action_patch_model['auto_delete_timeout'] = 24
+ instance_group_manager_action_patch_model['cron_spec'] = '30 */2 * * 1-5'
+ instance_group_manager_action_patch_model['group'] = instance_group_manager_action_group_patch_model
+ instance_group_manager_action_patch_model['manager'] = instance_group_manager_action_manager_patch_model
+ instance_group_manager_action_patch_model['name'] = 'my-instance-group-manager-action'
+ instance_group_manager_action_patch_model['run_at'] = '2019-01-01T12:00:00Z'
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+ id = 'testString'
+ instance_group_manager_action_patch = instance_group_manager_action_patch_model
- 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',
- )
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_id,
+ "id": id,
+ "instance_group_manager_action_patch": instance_group_manager_action_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_instance_group_manager_action(**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_update_instance_group_manager_action_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_group_manager_action_value_error.
+ _service.enable_retries()
+ self.test_update_instance_group_manager_action_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,
- )
+ # Disable retries and run test_update_instance_group_manager_action_value_error.
+ _service.disable_retries()
+ self.test_update_instance_group_manager_action_value_error()
-class TestListDedicatedHostGroups:
+class TestListInstanceGroupManagerPolicies:
"""
- Test Class for list_dedicated_host_groups
+ Test Class for list_instance_group_manager_policies
"""
@responses.activate
- def test_list_dedicated_host_groups_all_params(self):
+ def test_list_instance_group_manager_policies_all_params(self):
"""
- list_dedicated_host_groups()
+ list_instance_group_manager_policies()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups')
- mock_response = '{"first": {"href": "href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -17849,19 +17454,17 @@ def test_list_dedicated_host_groups_all_params(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
- zone_name = 'us-south-1'
- name = 'my-name'
# Invoke method
- response = _service.list_dedicated_host_groups(
+ response = _service.list_instance_group_manager_policies(
+ instance_group_id,
+ instance_group_manager_id,
start=start,
limit=limit,
- resource_group_id=resource_group_id,
- zone_name=zone_name,
- name=name,
headers={},
)
@@ -17873,27 +17476,24 @@ def test_list_dedicated_host_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 'zone.name={}'.format(zone_name) in query_string
- assert 'name={}'.format(name) in query_string
- def test_list_dedicated_host_groups_all_params_with_retries(self):
- # Enable retries and run test_list_dedicated_host_groups_all_params.
+ def test_list_instance_group_manager_policies_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_manager_policies_all_params.
_service.enable_retries()
- self.test_list_dedicated_host_groups_all_params()
+ self.test_list_instance_group_manager_policies_all_params()
- # Disable retries and run test_list_dedicated_host_groups_all_params.
+ # Disable retries and run test_list_instance_group_manager_policies_all_params.
_service.disable_retries()
- self.test_list_dedicated_host_groups_all_params()
+ self.test_list_instance_group_manager_policies_all_params()
@responses.activate
- def test_list_dedicated_host_groups_required_params(self):
+ def test_list_instance_group_manager_policies_required_params(self):
"""
- test_list_dedicated_host_groups_required_params()
+ test_list_instance_group_manager_policies_required_params()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups')
- mock_response = '{"first": {"href": "href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -17902,30 +17502,38 @@ def test_list_dedicated_host_groups_required_params(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+
# Invoke method
- response = _service.list_dedicated_host_groups()
+ response = _service.list_instance_group_manager_policies(
+ instance_group_id,
+ instance_group_manager_id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_dedicated_host_groups_required_params_with_retries(self):
- # Enable retries and run test_list_dedicated_host_groups_required_params.
+ def test_list_instance_group_manager_policies_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_manager_policies_required_params.
_service.enable_retries()
- self.test_list_dedicated_host_groups_required_params()
+ self.test_list_instance_group_manager_policies_required_params()
- # Disable retries and run test_list_dedicated_host_groups_required_params.
+ # Disable retries and run test_list_instance_group_manager_policies_required_params.
_service.disable_retries()
- self.test_list_dedicated_host_groups_required_params()
+ self.test_list_instance_group_manager_policies_required_params()
@responses.activate
- def test_list_dedicated_host_groups_value_error(self):
+ def test_list_instance_group_manager_policies_value_error(self):
"""
- test_list_dedicated_host_groups_value_error()
+ test_list_instance_group_manager_policies_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups')
- mock_response = '{"first": {"href": "href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -17934,32 +17542,38 @@ def test_list_dedicated_host_groups_value_error(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_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_dedicated_host_groups(**req_copy)
+ _service.list_instance_group_manager_policies(**req_copy)
- def test_list_dedicated_host_groups_value_error_with_retries(self):
- # Enable retries and run test_list_dedicated_host_groups_value_error.
+ def test_list_instance_group_manager_policies_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_group_manager_policies_value_error.
_service.enable_retries()
- self.test_list_dedicated_host_groups_value_error()
+ self.test_list_instance_group_manager_policies_value_error()
- # Disable retries and run test_list_dedicated_host_groups_value_error.
+ # Disable retries and run test_list_instance_group_manager_policies_value_error.
_service.disable_retries()
- self.test_list_dedicated_host_groups_value_error()
+ self.test_list_instance_group_manager_policies_value_error()
@responses.activate
- def test_list_dedicated_host_groups_with_pager_get_next(self):
+ def test_list_instance_group_manager_policies_with_pager_get_next(self):
"""
- test_list_dedicated_host_groups_with_pager_get_next()
+ test_list_instance_group_manager_policies_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/dedicated_host/groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
responses.add(
responses.GET,
url,
@@ -17977,12 +17591,11 @@ def test_list_dedicated_host_groups_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = DedicatedHostGroupsPager(
+ pager = InstanceGroupManagerPoliciesPager(
client=_service,
+ instance_group_id='testString',
+ instance_group_manager_id='testString',
limit=10,
- resource_group_id='testString',
- zone_name='us-south-1',
- name='my-name',
)
while pager.has_next():
next_page = pager.get_next()
@@ -17991,14 +17604,14 @@ def test_list_dedicated_host_groups_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_dedicated_host_groups_with_pager_get_all(self):
+ def test_list_instance_group_manager_policies_with_pager_get_all(self):
"""
- test_list_dedicated_host_groups_with_pager_get_all()
+ test_list_instance_group_manager_policies_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/dedicated_host/groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","id":"r006-ca664290-30eb-4ad7-9fb6-db45731f0be7","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":0,"policy_type":"target"}]}'
responses.add(
responses.GET,
url,
@@ -18015,31 +17628,30 @@ def test_list_dedicated_host_groups_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = DedicatedHostGroupsPager(
+ pager = InstanceGroupManagerPoliciesPager(
client=_service,
+ instance_group_id='testString',
+ instance_group_manager_id='testString',
limit=10,
- resource_group_id='testString',
- zone_name='us-south-1',
- name='my-name',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateDedicatedHostGroup:
+class TestCreateInstanceGroupManagerPolicy:
"""
- Test Class for create_dedicated_host_group
+ Test Class for create_instance_group_manager_policy
"""
@responses.activate
- def test_create_dedicated_host_group_all_params(self):
+ def test_create_instance_group_manager_policy_all_params(self):
"""
- create_dedicated_host_group()
+ create_instance_group_manager_policy()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups')
- mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
responses.add(
responses.POST,
url,
@@ -18048,28 +17660,23 @@ def test_create_dedicated_host_group_all_params(self):
status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model
+ instance_group_manager_policy_prototype_model = {}
+ instance_group_manager_policy_prototype_model['name'] = 'my-instance-group-manager-policy'
+ instance_group_manager_policy_prototype_model['metric_type'] = 'cpu'
+ instance_group_manager_policy_prototype_model['metric_value'] = 0
+ instance_group_manager_policy_prototype_model['policy_type'] = 'target'
# Set up parameter values
- class_ = 'mx2'
- family = 'balanced'
- zone = zone_identity_model
- name = 'testString'
- resource_group = resource_group_identity_model
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+ instance_group_manager_policy_prototype = instance_group_manager_policy_prototype_model
# Invoke method
- response = _service.create_dedicated_host_group(
- class_,
- family,
- zone,
- name=name,
- resource_group=resource_group,
+ response = _service.create_instance_group_manager_policy(
+ instance_group_id,
+ instance_group_manager_id,
+ instance_group_manager_policy_prototype,
headers={},
)
@@ -18078,29 +17685,25 @@ def test_create_dedicated_host_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['class'] == 'mx2'
- assert req_body['family'] == 'balanced'
- assert req_body['zone'] == zone_identity_model
- assert req_body['name'] == 'testString'
- assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body == instance_group_manager_policy_prototype
- def test_create_dedicated_host_group_all_params_with_retries(self):
- # Enable retries and run test_create_dedicated_host_group_all_params.
+ def test_create_instance_group_manager_policy_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_group_manager_policy_all_params.
_service.enable_retries()
- self.test_create_dedicated_host_group_all_params()
+ self.test_create_instance_group_manager_policy_all_params()
- # Disable retries and run test_create_dedicated_host_group_all_params.
+ # Disable retries and run test_create_instance_group_manager_policy_all_params.
_service.disable_retries()
- self.test_create_dedicated_host_group_all_params()
+ self.test_create_instance_group_manager_policy_all_params()
@responses.activate
- def test_create_dedicated_host_group_value_error(self):
+ def test_create_instance_group_manager_policy_value_error(self):
"""
- test_create_dedicated_host_group_value_error()
+ test_create_instance_group_manager_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups')
- mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
responses.add(
responses.POST,
url,
@@ -18109,54 +17712,51 @@ def test_create_dedicated_host_group_value_error(self):
status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model
+ instance_group_manager_policy_prototype_model = {}
+ instance_group_manager_policy_prototype_model['name'] = 'my-instance-group-manager-policy'
+ instance_group_manager_policy_prototype_model['metric_type'] = 'cpu'
+ instance_group_manager_policy_prototype_model['metric_value'] = 0
+ instance_group_manager_policy_prototype_model['policy_type'] = 'target'
# Set up parameter values
- class_ = 'mx2'
- family = 'balanced'
- zone = zone_identity_model
- name = 'testString'
- resource_group = resource_group_identity_model
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+ instance_group_manager_policy_prototype = instance_group_manager_policy_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "class_": class_,
- "family": family,
- "zone": zone,
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_id,
+ "instance_group_manager_policy_prototype": instance_group_manager_policy_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_dedicated_host_group(**req_copy)
+ _service.create_instance_group_manager_policy(**req_copy)
- def test_create_dedicated_host_group_value_error_with_retries(self):
- # Enable retries and run test_create_dedicated_host_group_value_error.
+ def test_create_instance_group_manager_policy_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_group_manager_policy_value_error.
_service.enable_retries()
- self.test_create_dedicated_host_group_value_error()
+ self.test_create_instance_group_manager_policy_value_error()
- # Disable retries and run test_create_dedicated_host_group_value_error.
+ # Disable retries and run test_create_instance_group_manager_policy_value_error.
_service.disable_retries()
- self.test_create_dedicated_host_group_value_error()
+ self.test_create_instance_group_manager_policy_value_error()
-class TestDeleteDedicatedHostGroup:
+class TestDeleteInstanceGroupManagerPolicy:
"""
- Test Class for delete_dedicated_host_group
+ Test Class for delete_instance_group_manager_policy
"""
@responses.activate
- def test_delete_dedicated_host_group_all_params(self):
+ def test_delete_instance_group_manager_policy_all_params(self):
"""
- delete_dedicated_host_group()
+ delete_instance_group_manager_policy()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups/testString')
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
responses.add(
responses.DELETE,
url,
@@ -18164,10 +17764,14 @@ def test_delete_dedicated_host_group_all_params(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_dedicated_host_group(
+ response = _service.delete_instance_group_manager_policy(
+ instance_group_id,
+ instance_group_manager_id,
id,
headers={},
)
@@ -18176,22 +17780,22 @@ def test_delete_dedicated_host_group_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_dedicated_host_group_all_params_with_retries(self):
- # Enable retries and run test_delete_dedicated_host_group_all_params.
+ def test_delete_instance_group_manager_policy_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_manager_policy_all_params.
_service.enable_retries()
- self.test_delete_dedicated_host_group_all_params()
+ self.test_delete_instance_group_manager_policy_all_params()
- # Disable retries and run test_delete_dedicated_host_group_all_params.
+ # Disable retries and run test_delete_instance_group_manager_policy_all_params.
_service.disable_retries()
- self.test_delete_dedicated_host_group_all_params()
+ self.test_delete_instance_group_manager_policy_all_params()
@responses.activate
- def test_delete_dedicated_host_group_value_error(self):
+ def test_delete_instance_group_manager_policy_value_error(self):
"""
- test_delete_dedicated_host_group_value_error()
+ test_delete_instance_group_manager_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups/testString')
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
responses.add(
responses.DELETE,
url,
@@ -18199,40 +17803,44 @@ def test_delete_dedicated_host_group_value_error(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_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_dedicated_host_group(**req_copy)
+ _service.delete_instance_group_manager_policy(**req_copy)
- def test_delete_dedicated_host_group_value_error_with_retries(self):
- # Enable retries and run test_delete_dedicated_host_group_value_error.
+ def test_delete_instance_group_manager_policy_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_manager_policy_value_error.
_service.enable_retries()
- self.test_delete_dedicated_host_group_value_error()
+ self.test_delete_instance_group_manager_policy_value_error()
- # Disable retries and run test_delete_dedicated_host_group_value_error.
+ # Disable retries and run test_delete_instance_group_manager_policy_value_error.
_service.disable_retries()
- self.test_delete_dedicated_host_group_value_error()
+ self.test_delete_instance_group_manager_policy_value_error()
-class TestGetDedicatedHostGroup:
+class TestGetInstanceGroupManagerPolicy:
"""
- Test Class for get_dedicated_host_group
+ Test Class for get_instance_group_manager_policy
"""
@responses.activate
- def test_get_dedicated_host_group_all_params(self):
+ def test_get_instance_group_manager_policy_all_params(self):
"""
- get_dedicated_host_group()
+ get_instance_group_manager_policy()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups/testString')
- mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
responses.add(
responses.GET,
url,
@@ -18242,10 +17850,14 @@ def test_get_dedicated_host_group_all_params(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_dedicated_host_group(
+ response = _service.get_instance_group_manager_policy(
+ instance_group_id,
+ instance_group_manager_id,
id,
headers={},
)
@@ -18254,23 +17866,23 @@ def test_get_dedicated_host_group_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_dedicated_host_group_all_params_with_retries(self):
- # Enable retries and run test_get_dedicated_host_group_all_params.
+ def test_get_instance_group_manager_policy_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_group_manager_policy_all_params.
_service.enable_retries()
- self.test_get_dedicated_host_group_all_params()
+ self.test_get_instance_group_manager_policy_all_params()
- # Disable retries and run test_get_dedicated_host_group_all_params.
+ # Disable retries and run test_get_instance_group_manager_policy_all_params.
_service.disable_retries()
- self.test_get_dedicated_host_group_all_params()
+ self.test_get_instance_group_manager_policy_all_params()
@responses.activate
- def test_get_dedicated_host_group_value_error(self):
+ def test_get_instance_group_manager_policy_value_error(self):
"""
- test_get_dedicated_host_group_value_error()
+ test_get_instance_group_manager_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups/testString')
- mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
responses.add(
responses.GET,
url,
@@ -18280,40 +17892,44 @@ def test_get_dedicated_host_group_value_error(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_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_dedicated_host_group(**req_copy)
+ _service.get_instance_group_manager_policy(**req_copy)
- def test_get_dedicated_host_group_value_error_with_retries(self):
- # Enable retries and run test_get_dedicated_host_group_value_error.
+ def test_get_instance_group_manager_policy_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_group_manager_policy_value_error.
_service.enable_retries()
- self.test_get_dedicated_host_group_value_error()
+ self.test_get_instance_group_manager_policy_value_error()
- # Disable retries and run test_get_dedicated_host_group_value_error.
+ # Disable retries and run test_get_instance_group_manager_policy_value_error.
_service.disable_retries()
- self.test_get_dedicated_host_group_value_error()
+ self.test_get_instance_group_manager_policy_value_error()
-class TestUpdateDedicatedHostGroup:
+class TestUpdateInstanceGroupManagerPolicy:
"""
- Test Class for update_dedicated_host_group
+ Test Class for update_instance_group_manager_policy
"""
@responses.activate
- def test_update_dedicated_host_group_all_params(self):
+ def test_update_instance_group_manager_policy_all_params(self):
"""
- update_dedicated_host_group()
+ update_instance_group_manager_policy()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups/testString')
- mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
responses.add(
responses.PATCH,
url,
@@ -18322,18 +17938,24 @@ def test_update_dedicated_host_group_all_params(self):
status=200,
)
- # Construct a dict representation of a DedicatedHostGroupPatch model
- dedicated_host_group_patch_model = {}
- dedicated_host_group_patch_model['name'] = 'my-dedicated-host-group-updated'
+ # Construct a dict representation of a InstanceGroupManagerPolicyPatch model
+ instance_group_manager_policy_patch_model = {}
+ instance_group_manager_policy_patch_model['metric_type'] = 'cpu'
+ instance_group_manager_policy_patch_model['metric_value'] = 75
+ instance_group_manager_policy_patch_model['name'] = 'my-instance-group-manager-policy'
# Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
id = 'testString'
- dedicated_host_group_patch = dedicated_host_group_patch_model
+ instance_group_manager_policy_patch = instance_group_manager_policy_patch_model
# Invoke method
- response = _service.update_dedicated_host_group(
+ response = _service.update_instance_group_manager_policy(
+ instance_group_id,
+ instance_group_manager_id,
id,
- dedicated_host_group_patch,
+ instance_group_manager_policy_patch,
headers={},
)
@@ -18342,74 +17964,155 @@ def test_update_dedicated_host_group_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 == dedicated_host_group_patch
+ assert req_body == instance_group_manager_policy_patch
- def test_update_dedicated_host_group_all_params_with_retries(self):
- # Enable retries and run test_update_dedicated_host_group_all_params.
+ def test_update_instance_group_manager_policy_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_group_manager_policy_all_params.
_service.enable_retries()
- self.test_update_dedicated_host_group_all_params()
+ self.test_update_instance_group_manager_policy_all_params()
- # Disable retries and run test_update_dedicated_host_group_all_params.
+ # Disable retries and run test_update_instance_group_manager_policy_all_params.
_service.disable_retries()
- self.test_update_dedicated_host_group_all_params()
+ self.test_update_instance_group_manager_policy_all_params()
@responses.activate
- def test_update_dedicated_host_group_value_error(self):
+ def test_update_instance_group_manager_policy_value_error(self):
"""
- test_update_dedicated_host_group_value_error()
+ test_update_instance_group_manager_policy_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/instance_groups/testString/managers/testString/policies/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/managers/r006-bd21f31f-8a05-4451-836d-ab0347e91fea/policies/r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "id": "r006-ca664290-30eb-4ad7-9fb6-db45731f0be7", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 0, "policy_type": "target"}'
+ responses.add(
+ responses.PATCH,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Construct a dict representation of a InstanceGroupManagerPolicyPatch model
+ instance_group_manager_policy_patch_model = {}
+ instance_group_manager_policy_patch_model['metric_type'] = 'cpu'
+ instance_group_manager_policy_patch_model['metric_value'] = 75
+ instance_group_manager_policy_patch_model['name'] = 'my-instance-group-manager-policy'
+
+ # Set up parameter values
+ instance_group_id = 'testString'
+ instance_group_manager_id = 'testString'
+ id = 'testString'
+ instance_group_manager_policy_patch = instance_group_manager_policy_patch_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "instance_group_manager_id": instance_group_manager_id,
+ "id": id,
+ "instance_group_manager_policy_patch": instance_group_manager_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_instance_group_manager_policy(**req_copy)
+
+ def test_update_instance_group_manager_policy_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_group_manager_policy_value_error.
+ _service.enable_retries()
+ self.test_update_instance_group_manager_policy_value_error()
+
+ # Disable retries and run test_update_instance_group_manager_policy_value_error.
+ _service.disable_retries()
+ self.test_update_instance_group_manager_policy_value_error()
+
+
+class TestDeleteInstanceGroupMemberships:
+ """
+ Test Class for delete_instance_group_memberships
+ """
+
+ @responses.activate
+ def test_delete_instance_group_memberships_all_params(self):
+ """
+ delete_instance_group_memberships()
+ """
+ # Set up mock
+ url = preprocess_url('/instance_groups/testString/memberships')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ instance_group_id = 'testString'
+
+ # Invoke method
+ response = _service.delete_instance_group_memberships(
+ instance_group_id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 204
+
+ def test_delete_instance_group_memberships_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_memberships_all_params.
+ _service.enable_retries()
+ self.test_delete_instance_group_memberships_all_params()
+
+ # Disable retries and run test_delete_instance_group_memberships_all_params.
+ _service.disable_retries()
+ self.test_delete_instance_group_memberships_all_params()
+
+ @responses.activate
+ def test_delete_instance_group_memberships_value_error(self):
+ """
+ test_delete_instance_group_memberships_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/groups/testString')
- mock_response = '{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance_groups/testString/memberships')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a DedicatedHostGroupPatch model
- dedicated_host_group_patch_model = {}
- dedicated_host_group_patch_model['name'] = 'my-dedicated-host-group-updated'
-
# Set up parameter values
- id = 'testString'
- dedicated_host_group_patch = dedicated_host_group_patch_model
+ instance_group_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "dedicated_host_group_patch": dedicated_host_group_patch,
+ "instance_group_id": instance_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.update_dedicated_host_group(**req_copy)
+ _service.delete_instance_group_memberships(**req_copy)
- def test_update_dedicated_host_group_value_error_with_retries(self):
- # Enable retries and run test_update_dedicated_host_group_value_error.
+ def test_delete_instance_group_memberships_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_memberships_value_error.
_service.enable_retries()
- self.test_update_dedicated_host_group_value_error()
+ self.test_delete_instance_group_memberships_value_error()
- # Disable retries and run test_update_dedicated_host_group_value_error.
+ # Disable retries and run test_delete_instance_group_memberships_value_error.
_service.disable_retries()
- self.test_update_dedicated_host_group_value_error()
+ self.test_delete_instance_group_memberships_value_error()
-class TestListDedicatedHostProfiles:
+class TestListInstanceGroupMemberships:
"""
- Test Class for list_dedicated_host_profiles
+ Test Class for list_instance_group_memberships
"""
@responses.activate
- def test_list_dedicated_host_profiles_all_params(self):
+ def test_list_instance_group_memberships_all_params(self):
"""
- list_dedicated_host_profiles()
+ list_instance_group_memberships()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/memberships')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -18419,11 +18122,13 @@ def test_list_dedicated_host_profiles_all_params(self):
)
# Set up parameter values
+ instance_group_id = 'testString'
start = 'testString'
limit = 50
# Invoke method
- response = _service.list_dedicated_host_profiles(
+ response = _service.list_instance_group_memberships(
+ instance_group_id,
start=start,
limit=limit,
headers={},
@@ -18438,23 +18143,23 @@ def test_list_dedicated_host_profiles_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- def test_list_dedicated_host_profiles_all_params_with_retries(self):
- # Enable retries and run test_list_dedicated_host_profiles_all_params.
+ def test_list_instance_group_memberships_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_memberships_all_params.
_service.enable_retries()
- self.test_list_dedicated_host_profiles_all_params()
+ self.test_list_instance_group_memberships_all_params()
- # Disable retries and run test_list_dedicated_host_profiles_all_params.
+ # Disable retries and run test_list_instance_group_memberships_all_params.
_service.disable_retries()
- self.test_list_dedicated_host_profiles_all_params()
+ self.test_list_instance_group_memberships_all_params()
@responses.activate
- def test_list_dedicated_host_profiles_required_params(self):
+ def test_list_instance_group_memberships_required_params(self):
"""
- test_list_dedicated_host_profiles_required_params()
+ test_list_instance_group_memberships_required_params()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/memberships')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -18463,30 +18168,36 @@ def test_list_dedicated_host_profiles_required_params(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+
# Invoke method
- response = _service.list_dedicated_host_profiles()
+ response = _service.list_instance_group_memberships(
+ instance_group_id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_dedicated_host_profiles_required_params_with_retries(self):
- # Enable retries and run test_list_dedicated_host_profiles_required_params.
+ def test_list_instance_group_memberships_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_group_memberships_required_params.
_service.enable_retries()
- self.test_list_dedicated_host_profiles_required_params()
+ self.test_list_instance_group_memberships_required_params()
- # Disable retries and run test_list_dedicated_host_profiles_required_params.
+ # Disable retries and run test_list_instance_group_memberships_required_params.
_service.disable_retries()
- self.test_list_dedicated_host_profiles_required_params()
+ self.test_list_instance_group_memberships_required_params()
@responses.activate
- def test_list_dedicated_host_profiles_value_error(self):
+ def test_list_instance_group_memberships_value_error(self):
"""
- test_list_dedicated_host_profiles_value_error()
+ test_list_instance_group_memberships_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/memberships')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -18495,32 +18206,36 @@ def test_list_dedicated_host_profiles_value_error(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_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_dedicated_host_profiles(**req_copy)
+ _service.list_instance_group_memberships(**req_copy)
- def test_list_dedicated_host_profiles_value_error_with_retries(self):
- # Enable retries and run test_list_dedicated_host_profiles_value_error.
+ def test_list_instance_group_memberships_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_group_memberships_value_error.
_service.enable_retries()
- self.test_list_dedicated_host_profiles_value_error()
+ self.test_list_instance_group_memberships_value_error()
- # Disable retries and run test_list_dedicated_host_profiles_value_error.
+ # Disable retries and run test_list_instance_group_memberships_value_error.
_service.disable_retries()
- self.test_list_dedicated_host_profiles_value_error()
+ self.test_list_instance_group_memberships_value_error()
@responses.activate
- def test_list_dedicated_host_profiles_with_pager_get_next(self):
+ def test_list_instance_group_memberships_with_pager_get_next(self):
"""
- test_list_dedicated_host_profiles_with_pager_get_next()
+ test_list_instance_group_memberships_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/dedicated_host/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
+ url = preprocess_url('/instance_groups/testString/memberships')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
responses.add(
responses.GET,
url,
@@ -18538,8 +18253,9 @@ def test_list_dedicated_host_profiles_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = DedicatedHostProfilesPager(
+ pager = InstanceGroupMembershipsPager(
client=_service,
+ instance_group_id='testString',
limit=10,
)
while pager.has_next():
@@ -18549,14 +18265,14 @@ def test_list_dedicated_host_profiles_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_dedicated_host_profiles_with_pager_get_all(self):
+ def test_list_instance_group_memberships_with_pager_get_all(self):
"""
- test_list_dedicated_host_profiles_with_pager_get_all()
+ test_list_instance_group_memberships_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/dedicated_host/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}'
+ url = preprocess_url('/instance_groups/testString/memberships')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741","id":"r006-32c8210b-fd1a-409f-8966-de85bbfd3741","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","id":"0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}'
responses.add(
responses.GET,
url,
@@ -18573,8 +18289,9 @@ def test_list_dedicated_host_profiles_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = DedicatedHostProfilesPager(
+ pager = InstanceGroupMembershipsPager(
client=_service,
+ instance_group_id='testString',
limit=10,
)
all_results = pager.get_all()
@@ -18582,100 +18299,98 @@ def test_list_dedicated_host_profiles_with_pager_get_all(self):
assert len(all_results) == 2
-class TestGetDedicatedHostProfile:
+class TestDeleteInstanceGroupMembership:
"""
- Test Class for get_dedicated_host_profile
+ Test Class for delete_instance_group_membership
"""
@responses.activate
- def test_get_dedicated_host_profile_all_params(self):
+ def test_delete_instance_group_membership_all_params(self):
"""
- get_dedicated_host_profile()
+ delete_instance_group_membership()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/profiles/mx2-host-152x1216')
- mock_response = '{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
+ url = preprocess_url('/instance_groups/testString/memberships/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- name = 'mx2-host-152x1216'
+ instance_group_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.get_dedicated_host_profile(
- name,
+ response = _service.delete_instance_group_membership(
+ instance_group_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_dedicated_host_profile_all_params_with_retries(self):
- # Enable retries and run test_get_dedicated_host_profile_all_params.
+ def test_delete_instance_group_membership_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_group_membership_all_params.
_service.enable_retries()
- self.test_get_dedicated_host_profile_all_params()
+ self.test_delete_instance_group_membership_all_params()
- # Disable retries and run test_get_dedicated_host_profile_all_params.
+ # Disable retries and run test_delete_instance_group_membership_all_params.
_service.disable_retries()
- self.test_get_dedicated_host_profile_all_params()
+ self.test_delete_instance_group_membership_all_params()
@responses.activate
- def test_get_dedicated_host_profile_value_error(self):
+ def test_delete_instance_group_membership_value_error(self):
"""
- test_get_dedicated_host_profile_value_error()
+ test_delete_instance_group_membership_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_host/profiles/mx2-host-152x1216')
- mock_response = '{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
+ url = preprocess_url('/instance_groups/testString/memberships/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- name = 'mx2-host-152x1216'
+ instance_group_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "name": name,
+ "instance_group_id": instance_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_dedicated_host_profile(**req_copy)
+ _service.delete_instance_group_membership(**req_copy)
- def test_get_dedicated_host_profile_value_error_with_retries(self):
- # Enable retries and run test_get_dedicated_host_profile_value_error.
+ def test_delete_instance_group_membership_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_group_membership_value_error.
_service.enable_retries()
- self.test_get_dedicated_host_profile_value_error()
+ self.test_delete_instance_group_membership_value_error()
- # Disable retries and run test_get_dedicated_host_profile_value_error.
+ # Disable retries and run test_delete_instance_group_membership_value_error.
_service.disable_retries()
- self.test_get_dedicated_host_profile_value_error()
+ self.test_delete_instance_group_membership_value_error()
-class TestListDedicatedHosts:
+class TestGetInstanceGroupMembership:
"""
- Test Class for list_dedicated_hosts
+ Test Class for get_instance_group_membership
"""
@responses.activate
- def test_list_dedicated_hosts_all_params(self):
+ def test_get_instance_group_membership_all_params(self):
"""
- list_dedicated_hosts()
+ get_instance_group_membership()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts')
- mock_response = '{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/memberships/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
responses.add(
responses.GET,
url,
@@ -18685,54 +18400,37 @@ def test_list_dedicated_hosts_all_params(self):
)
# Set up parameter values
- dedicated_host_group_id = 'testString'
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- zone_name = 'us-south-1'
- name = 'my-name'
+ instance_group_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_dedicated_hosts(
- dedicated_host_group_id=dedicated_host_group_id,
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
- zone_name=zone_name,
- name=name,
+ response = _service.get_instance_group_membership(
+ instance_group_id,
+ 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 'dedicated_host_group.id={}'.format(dedicated_host_group_id) 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 'zone.name={}'.format(zone_name) in query_string
- assert 'name={}'.format(name) in query_string
- def test_list_dedicated_hosts_all_params_with_retries(self):
- # Enable retries and run test_list_dedicated_hosts_all_params.
+ def test_get_instance_group_membership_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_group_membership_all_params.
_service.enable_retries()
- self.test_list_dedicated_hosts_all_params()
+ self.test_get_instance_group_membership_all_params()
- # Disable retries and run test_list_dedicated_hosts_all_params.
+ # Disable retries and run test_get_instance_group_membership_all_params.
_service.disable_retries()
- self.test_list_dedicated_hosts_all_params()
+ self.test_get_instance_group_membership_all_params()
@responses.activate
- def test_list_dedicated_hosts_required_params(self):
+ def test_get_instance_group_membership_value_error(self):
"""
- test_list_dedicated_hosts_required_params()
+ test_get_instance_group_membership_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts')
- mock_response = '{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/memberships/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
responses.add(
responses.GET,
url,
@@ -18741,146 +18439,273 @@ def test_list_dedicated_hosts_required_params(self):
status=200,
)
+ # Set up parameter values
+ instance_group_id = 'testString'
+ id = 'testString'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "instance_group_id": instance_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_instance_group_membership(**req_copy)
+
+ def test_get_instance_group_membership_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_group_membership_value_error.
+ _service.enable_retries()
+ self.test_get_instance_group_membership_value_error()
+
+ # Disable retries and run test_get_instance_group_membership_value_error.
+ _service.disable_retries()
+ self.test_get_instance_group_membership_value_error()
+
+
+class TestUpdateInstanceGroupMembership:
+ """
+ Test Class for update_instance_group_membership
+ """
+
+ @responses.activate
+ def test_update_instance_group_membership_all_params(self):
+ """
+ update_instance_group_membership()
+ """
+ # Set up mock
+ url = preprocess_url('/instance_groups/testString/memberships/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
+ responses.add(
+ responses.PATCH,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Construct a dict representation of a InstanceGroupMembershipPatch model
+ instance_group_membership_patch_model = {}
+ instance_group_membership_patch_model['delete_instance_on_membership_delete'] = False
+ instance_group_membership_patch_model['name'] = 'my-instance-group-membership'
+
+ # Set up parameter values
+ instance_group_id = 'testString'
+ id = 'testString'
+ instance_group_membership_patch = instance_group_membership_patch_model
+
# Invoke method
- response = _service.list_dedicated_hosts()
+ response = _service.update_instance_group_membership(
+ instance_group_id,
+ id,
+ instance_group_membership_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 == instance_group_membership_patch
- def test_list_dedicated_hosts_required_params_with_retries(self):
- # Enable retries and run test_list_dedicated_hosts_required_params.
+ def test_update_instance_group_membership_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_group_membership_all_params.
_service.enable_retries()
- self.test_list_dedicated_hosts_required_params()
+ self.test_update_instance_group_membership_all_params()
- # Disable retries and run test_list_dedicated_hosts_required_params.
+ # Disable retries and run test_update_instance_group_membership_all_params.
_service.disable_retries()
- self.test_list_dedicated_hosts_required_params()
+ self.test_update_instance_group_membership_all_params()
@responses.activate
- def test_list_dedicated_hosts_value_error(self):
+ def test_update_instance_group_membership_value_error(self):
"""
- test_list_dedicated_hosts_value_error()
+ test_update_instance_group_membership_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts')
- mock_response = '{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instance_groups/testString/memberships/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60/memberships/r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "id": "r006-32c8210b-fd1a-409f-8966-de85bbfd3741", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a InstanceGroupMembershipPatch model
+ instance_group_membership_patch_model = {}
+ instance_group_membership_patch_model['delete_instance_on_membership_delete'] = False
+ instance_group_membership_patch_model['name'] = 'my-instance-group-membership'
+
+ # Set up parameter values
+ instance_group_id = 'testString'
+ id = 'testString'
+ instance_group_membership_patch = instance_group_membership_patch_model
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_group_id": instance_group_id,
+ "id": id,
+ "instance_group_membership_patch": instance_group_membership_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_dedicated_hosts(**req_copy)
+ _service.update_instance_group_membership(**req_copy)
- def test_list_dedicated_hosts_value_error_with_retries(self):
- # Enable retries and run test_list_dedicated_hosts_value_error.
+ def test_update_instance_group_membership_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_group_membership_value_error.
_service.enable_retries()
- self.test_list_dedicated_hosts_value_error()
+ self.test_update_instance_group_membership_value_error()
- # Disable retries and run test_list_dedicated_hosts_value_error.
+ # Disable retries and run test_update_instance_group_membership_value_error.
_service.disable_retries()
- self.test_list_dedicated_hosts_value_error()
+ self.test_update_instance_group_membership_value_error()
- @responses.activate
- def test_list_dedicated_hosts_with_pager_get_next(self):
+
+# endregion
+##############################################################################
+# End of Service: InstanceGroups
+##############################################################################
+
+##############################################################################
+# Start of Service: InstanceTemplates
+##############################################################################
+# region
+
+
+class TestNewInstance:
+ """
+ Test Class for new_instance
+ """
+
+ def test_new_instance(self):
"""
- test_list_dedicated_hosts_with_pager_get_next()
+ new_instance()
"""
- # Set up a two-page mock response
- url = preprocess_url('/dedicated_hosts')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
+ os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
- # Exercise the pager class for this operation
- all_results = []
- pager = DedicatedHostsPager(
- client=_service,
- dedicated_host_group_id='testString',
- limit=10,
- resource_group_id='testString',
- zone_name='us-south-1',
- name='my-name',
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE',
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+
+ 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 TestListInstanceTemplates:
+ """
+ Test Class for list_instance_templates
+ """
@responses.activate
- def test_list_dedicated_hosts_with_pager_get_all(self):
+ def test_list_instance_templates_all_params(self):
"""
- test_list_dedicated_hosts_with_pager_get_all()
+ list_instance_templates()
"""
- # Set up a two-page mock response
- url = preprocess_url('/dedicated_hosts')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/instance/templates')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}'
responses.add(
responses.GET,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- pager = DedicatedHostsPager(
- client=_service,
- dedicated_host_group_id='testString',
- limit=10,
- resource_group_id='testString',
- zone_name='us-south-1',
- name='my-name',
+ # Invoke method
+ response = _service.list_instance_templates()
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_instance_templates_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_templates_all_params.
+ _service.enable_retries()
+ self.test_list_instance_templates_all_params()
+
+ # Disable retries and run test_list_instance_templates_all_params.
+ _service.disable_retries()
+ self.test_list_instance_templates_all_params()
+
+ @responses.activate
+ def test_list_instance_templates_value_error(self):
+ """
+ test_list_instance_templates_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/instance/templates')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # 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_instance_templates(**req_copy)
-class TestCreateDedicatedHost:
+ def test_list_instance_templates_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_templates_value_error.
+ _service.enable_retries()
+ self.test_list_instance_templates_value_error()
+
+ # Disable retries and run test_list_instance_templates_value_error.
+ _service.disable_retries()
+ self.test_list_instance_templates_value_error()
+
+
+class TestCreateInstanceTemplate:
"""
- Test Class for create_dedicated_host
+ Test Class for create_instance_template
"""
@responses.activate
- def test_create_dedicated_host_all_params(self):
+ def test_create_instance_template_all_params(self):
"""
- create_dedicated_host()
+ create_instance_template()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts')
- mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance/templates')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
responses.add(
responses.POST,
url,
@@ -18889,32 +18714,229 @@ def test_create_dedicated_host_all_params(self):
status=201,
)
- # Construct a dict representation of a DedicatedHostProfileIdentityByName model
- dedicated_host_profile_identity_model = {}
- dedicated_host_profile_identity_model['name'] = 'mx2-host-152x1216'
+ # Construct a dict representation of a InstanceAvailabilityPolicyPrototype model
+ instance_availability_policy_prototype_model = {}
+ instance_availability_policy_prototype_model['host_failure'] = 'restart'
+
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
+ instance_cluster_network_attachment_prototype_instance_context_model = {}
+ instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
+
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
+ instance_default_trusted_profile_prototype_model = {}
+ instance_default_trusted_profile_prototype_model['auto_link'] = False
+ instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+
+ # Construct a dict representation of a InstanceMetadataServicePrototype model
+ instance_metadata_service_prototype_model = {}
+ instance_metadata_service_prototype_model['enabled'] = False
+ instance_metadata_service_prototype_model['protocol'] = 'https'
+ instance_metadata_service_prototype_model['response_hop_limit'] = 2
+
+ # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_prototype_model = {}
+ instance_placement_target_prototype_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
+
+ # Construct a dict representation of a InstanceProfileIdentityByName model
+ instance_profile_identity_model = {}
+ instance_profile_identity_model['name'] = 'bx2-4x16'
+
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a InstanceReservationAffinityPrototype model
+ instance_reservation_affinity_prototype_model = {}
+ instance_reservation_affinity_prototype_model['policy'] = 'automatic'
+ instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a DedicatedHostGroupIdentityById model
- dedicated_host_group_identity_model = {}
- dedicated_host_group_identity_model['id'] = '0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0'
+ # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
+ volume_attachment_prototype_volume_model = {}
+ volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
- # Construct a dict representation of a DedicatedHostPrototypeDedicatedHostByGroup model
- dedicated_host_prototype_model = {}
- dedicated_host_prototype_model['instance_placement_enabled'] = True
- dedicated_host_prototype_model['name'] = 'my-host'
- dedicated_host_prototype_model['profile'] = dedicated_host_profile_identity_model
- dedicated_host_prototype_model['resource_group'] = resource_group_identity_model
- dedicated_host_prototype_model['group'] = dedicated_host_group_identity_model
+ # Construct a dict representation of a VolumeAttachmentPrototype model
+ volume_attachment_prototype_model = {}
+ volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
+ volume_attachment_prototype_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a VolumeAllowedUsePrototype model
+ volume_allowed_use_prototype_model = {}
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # 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 VolumePrototypeInstanceByImageContext model
+ volume_prototype_instance_by_image_context_model = {}
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
+ volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
+ volume_prototype_instance_by_image_context_model['capacity'] = 100
+ volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
+ volume_prototype_instance_by_image_context_model['iops'] = 10000
+ volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
+ volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
+ volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
+ volume_prototype_instance_by_image_context_model['user_tags'] = []
+
+ # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
+ volume_attachment_prototype_instance_by_image_context_model = {}
+ volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
+ volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
+
+ # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
+ catalog_offering_version_plan_identity_model = {}
+ catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
+
+ # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
+ catalog_offering_identity_model = {}
+ catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
+
+ # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
+ instance_catalog_offering_prototype_model = {}
+ instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
+ instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
+
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
+ instance_network_attachment_prototype_virtual_network_interface_model = {}
+ instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
+ instance_network_attachment_prototype_model = {}
+ instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
+ instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
+
+ # 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 NetworkInterfacePrototype model
+ network_interface_prototype_model = {}
+ network_interface_prototype_model['allow_ip_spoofing'] = True
+ network_interface_prototype_model['name'] = 'my-instance-network-interface'
+ network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
+ network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a InstanceTemplatePrototypeInstanceTemplateBySourceTemplate model
+ instance_template_prototype_model = {}
+ instance_template_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
+ instance_template_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
+ instance_template_prototype_model['confidential_compute_mode'] = 'disabled'
+ instance_template_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
+ instance_template_prototype_model['enable_secure_boot'] = True
+ instance_template_prototype_model['keys'] = [key_identity_model]
+ instance_template_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
+ instance_template_prototype_model['name'] = 'my-instance'
+ instance_template_prototype_model['placement_target'] = instance_placement_target_prototype_model
+ instance_template_prototype_model['profile'] = instance_profile_identity_model
+ instance_template_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
+ instance_template_prototype_model['resource_group'] = resource_group_identity_model
+ instance_template_prototype_model['total_volume_bandwidth'] = 500
+ instance_template_prototype_model['user_data'] = 'testString'
+ instance_template_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
+ instance_template_prototype_model['vpc'] = vpc_identity_model
+ instance_template_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
+ instance_template_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
+ instance_template_prototype_model['image'] = image_identity_model
+ instance_template_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
+ instance_template_prototype_model['network_interfaces'] = [network_interface_prototype_model]
+ instance_template_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
+ instance_template_prototype_model['primary_network_interface'] = network_interface_prototype_model
+ instance_template_prototype_model['source_template'] = instance_template_identity_model
+ instance_template_prototype_model['zone'] = zone_identity_model
# Set up parameter values
- dedicated_host_prototype = dedicated_host_prototype_model
+ instance_template_prototype = instance_template_prototype_model
# Invoke method
- response = _service.create_dedicated_host(
- dedicated_host_prototype,
+ response = _service.create_instance_template(
+ instance_template_prototype,
headers={},
)
@@ -18923,25 +18945,25 @@ def test_create_dedicated_host_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 == dedicated_host_prototype
+ assert req_body == instance_template_prototype
- def test_create_dedicated_host_all_params_with_retries(self):
- # Enable retries and run test_create_dedicated_host_all_params.
+ def test_create_instance_template_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_template_all_params.
_service.enable_retries()
- self.test_create_dedicated_host_all_params()
+ self.test_create_instance_template_all_params()
- # Disable retries and run test_create_dedicated_host_all_params.
+ # Disable retries and run test_create_instance_template_all_params.
_service.disable_retries()
- self.test_create_dedicated_host_all_params()
+ self.test_create_instance_template_all_params()
@responses.activate
- def test_create_dedicated_host_value_error(self):
+ def test_create_instance_template_value_error(self):
"""
- test_create_dedicated_host_value_error()
+ test_create_instance_template_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts')
- mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance/templates')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
responses.add(
responses.POST,
url,
@@ -18950,142 +18972,333 @@ def test_create_dedicated_host_value_error(self):
status=201,
)
- # Construct a dict representation of a DedicatedHostProfileIdentityByName model
- dedicated_host_profile_identity_model = {}
- dedicated_host_profile_identity_model['name'] = 'mx2-host-152x1216'
+ # Construct a dict representation of a InstanceAvailabilityPolicyPrototype model
+ instance_availability_policy_prototype_model = {}
+ instance_availability_policy_prototype_model['host_failure'] = 'restart'
+
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
+ instance_cluster_network_attachment_prototype_instance_context_model = {}
+ instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
+
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
+ instance_default_trusted_profile_prototype_model = {}
+ instance_default_trusted_profile_prototype_model['auto_link'] = False
+ instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+
+ # Construct a dict representation of a InstanceMetadataServicePrototype model
+ instance_metadata_service_prototype_model = {}
+ instance_metadata_service_prototype_model['enabled'] = False
+ instance_metadata_service_prototype_model['protocol'] = 'https'
+ instance_metadata_service_prototype_model['response_hop_limit'] = 2
+
+ # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_prototype_model = {}
+ instance_placement_target_prototype_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
+
+ # Construct a dict representation of a InstanceProfileIdentityByName model
+ instance_profile_identity_model = {}
+ instance_profile_identity_model['name'] = 'bx2-4x16'
+
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a InstanceReservationAffinityPrototype model
+ instance_reservation_affinity_prototype_model = {}
+ instance_reservation_affinity_prototype_model['policy'] = 'automatic'
+ instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a DedicatedHostGroupIdentityById model
- dedicated_host_group_identity_model = {}
- dedicated_host_group_identity_model['id'] = '0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0'
+ # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
+ volume_attachment_prototype_volume_model = {}
+ volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
- # Construct a dict representation of a DedicatedHostPrototypeDedicatedHostByGroup model
- dedicated_host_prototype_model = {}
- dedicated_host_prototype_model['instance_placement_enabled'] = True
- dedicated_host_prototype_model['name'] = 'my-host'
- dedicated_host_prototype_model['profile'] = dedicated_host_profile_identity_model
- dedicated_host_prototype_model['resource_group'] = resource_group_identity_model
- dedicated_host_prototype_model['group'] = dedicated_host_group_identity_model
+ # Construct a dict representation of a VolumeAttachmentPrototype model
+ volume_attachment_prototype_model = {}
+ volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
+ volume_attachment_prototype_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a VolumeAllowedUsePrototype model
+ volume_allowed_use_prototype_model = {}
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # 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 VolumePrototypeInstanceByImageContext model
+ volume_prototype_instance_by_image_context_model = {}
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
+ volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
+ volume_prototype_instance_by_image_context_model['capacity'] = 100
+ volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
+ volume_prototype_instance_by_image_context_model['iops'] = 10000
+ volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
+ volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
+ volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
+ volume_prototype_instance_by_image_context_model['user_tags'] = []
+
+ # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
+ volume_attachment_prototype_instance_by_image_context_model = {}
+ volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
+ volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
+
+ # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
+ catalog_offering_version_plan_identity_model = {}
+ catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
+
+ # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
+ catalog_offering_identity_model = {}
+ catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
+
+ # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
+ instance_catalog_offering_prototype_model = {}
+ instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
+ instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
+
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
+ instance_network_attachment_prototype_virtual_network_interface_model = {}
+ instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
+ instance_network_attachment_prototype_model = {}
+ instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
+ instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
+
+ # 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 NetworkInterfacePrototype model
+ network_interface_prototype_model = {}
+ network_interface_prototype_model['allow_ip_spoofing'] = True
+ network_interface_prototype_model['name'] = 'my-instance-network-interface'
+ network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
+ network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a InstanceTemplatePrototypeInstanceTemplateBySourceTemplate model
+ instance_template_prototype_model = {}
+ instance_template_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
+ instance_template_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
+ instance_template_prototype_model['confidential_compute_mode'] = 'disabled'
+ instance_template_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
+ instance_template_prototype_model['enable_secure_boot'] = True
+ instance_template_prototype_model['keys'] = [key_identity_model]
+ instance_template_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
+ instance_template_prototype_model['name'] = 'my-instance'
+ instance_template_prototype_model['placement_target'] = instance_placement_target_prototype_model
+ instance_template_prototype_model['profile'] = instance_profile_identity_model
+ instance_template_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
+ instance_template_prototype_model['resource_group'] = resource_group_identity_model
+ instance_template_prototype_model['total_volume_bandwidth'] = 500
+ instance_template_prototype_model['user_data'] = 'testString'
+ instance_template_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
+ instance_template_prototype_model['vpc'] = vpc_identity_model
+ instance_template_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
+ instance_template_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
+ instance_template_prototype_model['image'] = image_identity_model
+ instance_template_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
+ instance_template_prototype_model['network_interfaces'] = [network_interface_prototype_model]
+ instance_template_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
+ instance_template_prototype_model['primary_network_interface'] = network_interface_prototype_model
+ instance_template_prototype_model['source_template'] = instance_template_identity_model
+ instance_template_prototype_model['zone'] = zone_identity_model
# Set up parameter values
- dedicated_host_prototype = dedicated_host_prototype_model
+ instance_template_prototype = instance_template_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "dedicated_host_prototype": dedicated_host_prototype,
+ "instance_template_prototype": instance_template_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_dedicated_host(**req_copy)
+ _service.create_instance_template(**req_copy)
- def test_create_dedicated_host_value_error_with_retries(self):
- # Enable retries and run test_create_dedicated_host_value_error.
+ def test_create_instance_template_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_template_value_error.
_service.enable_retries()
- self.test_create_dedicated_host_value_error()
+ self.test_create_instance_template_value_error()
- # Disable retries and run test_create_dedicated_host_value_error.
+ # Disable retries and run test_create_instance_template_value_error.
_service.disable_retries()
- self.test_create_dedicated_host_value_error()
+ self.test_create_instance_template_value_error()
-class TestListDedicatedHostDisks:
+class TestDeleteInstanceTemplate:
"""
- Test Class for list_dedicated_host_disks
+ Test Class for delete_instance_template
"""
@responses.activate
- def test_list_dedicated_host_disks_all_params(self):
+ def test_delete_instance_template_all_params(self):
"""
- list_dedicated_host_disks()
+ delete_instance_template()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString/disks')
- mock_response = '{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}'
+ url = preprocess_url('/instance/templates/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- dedicated_host_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_dedicated_host_disks(
- dedicated_host_id,
+ response = _service.delete_instance_template(
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_list_dedicated_host_disks_all_params_with_retries(self):
- # Enable retries and run test_list_dedicated_host_disks_all_params.
+ def test_delete_instance_template_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_template_all_params.
_service.enable_retries()
- self.test_list_dedicated_host_disks_all_params()
+ self.test_delete_instance_template_all_params()
- # Disable retries and run test_list_dedicated_host_disks_all_params.
+ # Disable retries and run test_delete_instance_template_all_params.
_service.disable_retries()
- self.test_list_dedicated_host_disks_all_params()
+ self.test_delete_instance_template_all_params()
@responses.activate
- def test_list_dedicated_host_disks_value_error(self):
+ def test_delete_instance_template_value_error(self):
"""
- test_list_dedicated_host_disks_value_error()
+ test_delete_instance_template_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString/disks')
- mock_response = '{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}'
+ url = preprocess_url('/instance/templates/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- dedicated_host_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "dedicated_host_id": dedicated_host_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_dedicated_host_disks(**req_copy)
+ _service.delete_instance_template(**req_copy)
- def test_list_dedicated_host_disks_value_error_with_retries(self):
- # Enable retries and run test_list_dedicated_host_disks_value_error.
+ def test_delete_instance_template_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_template_value_error.
_service.enable_retries()
- self.test_list_dedicated_host_disks_value_error()
+ self.test_delete_instance_template_value_error()
- # Disable retries and run test_list_dedicated_host_disks_value_error.
+ # Disable retries and run test_delete_instance_template_value_error.
_service.disable_retries()
- self.test_list_dedicated_host_disks_value_error()
+ self.test_delete_instance_template_value_error()
-class TestGetDedicatedHostDisk:
+class TestGetInstanceTemplate:
"""
- Test Class for get_dedicated_host_disk
+ Test Class for get_instance_template
"""
@responses.activate
- def test_get_dedicated_host_disk_all_params(self):
+ def test_get_instance_template_all_params(self):
"""
- get_dedicated_host_disk()
+ get_instance_template()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString/disks/testString')
- mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
+ url = preprocess_url('/instance/templates/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
responses.add(
responses.GET,
url,
@@ -19095,12 +19308,10 @@ def test_get_dedicated_host_disk_all_params(self):
)
# Set up parameter values
- dedicated_host_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_dedicated_host_disk(
- dedicated_host_id,
+ response = _service.get_instance_template(
id,
headers={},
)
@@ -19109,23 +19320,23 @@ def test_get_dedicated_host_disk_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_dedicated_host_disk_all_params_with_retries(self):
- # Enable retries and run test_get_dedicated_host_disk_all_params.
+ def test_get_instance_template_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_template_all_params.
_service.enable_retries()
- self.test_get_dedicated_host_disk_all_params()
+ self.test_get_instance_template_all_params()
- # Disable retries and run test_get_dedicated_host_disk_all_params.
+ # Disable retries and run test_get_instance_template_all_params.
_service.disable_retries()
- self.test_get_dedicated_host_disk_all_params()
+ self.test_get_instance_template_all_params()
@responses.activate
- def test_get_dedicated_host_disk_value_error(self):
+ def test_get_instance_template_value_error(self):
"""
- test_get_dedicated_host_disk_value_error()
+ test_get_instance_template_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString/disks/testString')
- mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
+ url = preprocess_url('/instance/templates/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
responses.add(
responses.GET,
url,
@@ -19135,42 +19346,40 @@ def test_get_dedicated_host_disk_value_error(self):
)
# Set up parameter values
- dedicated_host_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "dedicated_host_id": dedicated_host_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_dedicated_host_disk(**req_copy)
+ _service.get_instance_template(**req_copy)
- def test_get_dedicated_host_disk_value_error_with_retries(self):
- # Enable retries and run test_get_dedicated_host_disk_value_error.
+ def test_get_instance_template_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_template_value_error.
_service.enable_retries()
- self.test_get_dedicated_host_disk_value_error()
+ self.test_get_instance_template_value_error()
- # Disable retries and run test_get_dedicated_host_disk_value_error.
+ # Disable retries and run test_get_instance_template_value_error.
_service.disable_retries()
- self.test_get_dedicated_host_disk_value_error()
+ self.test_get_instance_template_value_error()
-class TestUpdateDedicatedHostDisk:
+class TestUpdateInstanceTemplate:
"""
- Test Class for update_dedicated_host_disk
+ Test Class for update_instance_template
"""
@responses.activate
- def test_update_dedicated_host_disk_all_params(self):
+ def test_update_instance_template_all_params(self):
"""
- update_dedicated_host_disk()
+ update_instance_template()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString/disks/testString')
- mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
+ url = preprocess_url('/instance/templates/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
responses.add(
responses.PATCH,
url,
@@ -19179,20 +19388,18 @@ def test_update_dedicated_host_disk_all_params(self):
status=200,
)
- # Construct a dict representation of a DedicatedHostDiskPatch model
- dedicated_host_disk_patch_model = {}
- dedicated_host_disk_patch_model['name'] = 'my-dedicated-host-disk-updated'
+ # Construct a dict representation of a InstanceTemplatePatch model
+ instance_template_patch_model = {}
+ instance_template_patch_model['name'] = 'my-instance-template-updated'
# Set up parameter values
- dedicated_host_id = 'testString'
id = 'testString'
- dedicated_host_disk_patch = dedicated_host_disk_patch_model
+ instance_template_patch = instance_template_patch_model
# Invoke method
- response = _service.update_dedicated_host_disk(
- dedicated_host_id,
+ response = _service.update_instance_template(
id,
- dedicated_host_disk_patch,
+ instance_template_patch,
headers={},
)
@@ -19201,25 +19408,25 @@ def test_update_dedicated_host_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 == dedicated_host_disk_patch
+ assert req_body == instance_template_patch
- def test_update_dedicated_host_disk_all_params_with_retries(self):
- # Enable retries and run test_update_dedicated_host_disk_all_params.
+ def test_update_instance_template_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_template_all_params.
_service.enable_retries()
- self.test_update_dedicated_host_disk_all_params()
+ self.test_update_instance_template_all_params()
- # Disable retries and run test_update_dedicated_host_disk_all_params.
+ # Disable retries and run test_update_instance_template_all_params.
_service.disable_retries()
- self.test_update_dedicated_host_disk_all_params()
+ self.test_update_instance_template_all_params()
@responses.activate
- def test_update_dedicated_host_disk_value_error(self):
+ def test_update_instance_template_value_error(self):
"""
- test_update_dedicated_host_disk_value_error()
+ test_update_instance_template_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString/disks/testString')
- mock_response = '{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}'
+ url = preprocess_url('/instance/templates/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "id": "0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "automatic", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "user_data", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "bandwidth": 1000, "capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["user_tags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}'
responses.add(
responses.PATCH,
url,
@@ -19228,124 +19435,104 @@ def test_update_dedicated_host_disk_value_error(self):
status=200,
)
- # Construct a dict representation of a DedicatedHostDiskPatch model
- dedicated_host_disk_patch_model = {}
- dedicated_host_disk_patch_model['name'] = 'my-dedicated-host-disk-updated'
+ # Construct a dict representation of a InstanceTemplatePatch model
+ instance_template_patch_model = {}
+ instance_template_patch_model['name'] = 'my-instance-template-updated'
# Set up parameter values
- dedicated_host_id = 'testString'
id = 'testString'
- dedicated_host_disk_patch = dedicated_host_disk_patch_model
+ instance_template_patch = instance_template_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "dedicated_host_id": dedicated_host_id,
"id": id,
- "dedicated_host_disk_patch": dedicated_host_disk_patch,
+ "instance_template_patch": instance_template_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_dedicated_host_disk(**req_copy)
+ _service.update_instance_template(**req_copy)
- def test_update_dedicated_host_disk_value_error_with_retries(self):
- # Enable retries and run test_update_dedicated_host_disk_value_error.
+ def test_update_instance_template_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_template_value_error.
_service.enable_retries()
- self.test_update_dedicated_host_disk_value_error()
+ self.test_update_instance_template_value_error()
- # Disable retries and run test_update_dedicated_host_disk_value_error.
+ # Disable retries and run test_update_instance_template_value_error.
_service.disable_retries()
- self.test_update_dedicated_host_disk_value_error()
+ self.test_update_instance_template_value_error()
-class TestDeleteDedicatedHost:
+# endregion
+##############################################################################
+# End of Service: InstanceTemplates
+##############################################################################
+
+##############################################################################
+# Start of Service: Instances
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for delete_dedicated_host
+ Test Class for new_instance
"""
- @responses.activate
- def test_delete_dedicated_host_all_params(self):
+ def test_new_instance(self):
"""
- delete_dedicated_host()
+ new_instance()
"""
- # Set up mock
- url = preprocess_url('/dedicated_hosts/testString')
- responses.add(
- responses.DELETE,
- url,
- status=204,
- )
-
- # Set up parameter values
- id = 'testString'
+ os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
- # Invoke method
- response = _service.delete_dedicated_host(
- id,
- headers={},
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE',
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_delete_dedicated_host_all_params_with_retries(self):
- # Enable retries and run test_delete_dedicated_host_all_params.
- _service.enable_retries()
- self.test_delete_dedicated_host_all_params()
-
- # Disable retries and run test_delete_dedicated_host_all_params.
- _service.disable_retries()
- self.test_delete_dedicated_host_all_params()
+ assert service is not None
+ assert isinstance(service, VpcV1)
- @responses.activate
- def test_delete_dedicated_host_value_error(self):
+ def test_new_instance_without_authenticator(self):
"""
- test_delete_dedicated_host_value_error()
+ new_instance_without_authenticator()
"""
- # Set up mock
- url = preprocess_url('/dedicated_hosts/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_dedicated_host(**req_copy)
+ with pytest.raises(ValueError, match='authenticator must be provided'):
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE_NOT_FOUND',
+ )
- def test_delete_dedicated_host_value_error_with_retries(self):
- # Enable retries and run test_delete_dedicated_host_value_error.
- _service.enable_retries()
- self.test_delete_dedicated_host_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_delete_dedicated_host_value_error.
- _service.disable_retries()
- self.test_delete_dedicated_host_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 TestGetDedicatedHost:
+class TestListInstanceProfiles:
"""
- Test Class for get_dedicated_host
+ Test Class for list_instance_profiles
"""
@responses.activate
- def test_get_dedicated_host_all_params(self):
+ def test_list_instance_profiles_all_params(self):
"""
- get_dedicated_host()
+ list_instance_profiles()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString')
- mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance/profiles')
+ mock_response = '{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}]}'
responses.add(
responses.GET,
url,
@@ -19354,36 +19541,30 @@ def test_get_dedicated_host_all_params(self):
status=200,
)
- # Set up parameter values
- id = 'testString'
-
# Invoke method
- response = _service.get_dedicated_host(
- id,
- headers={},
- )
+ response = _service.list_instance_profiles()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_dedicated_host_all_params_with_retries(self):
- # Enable retries and run test_get_dedicated_host_all_params.
+ def test_list_instance_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_profiles_all_params.
_service.enable_retries()
- self.test_get_dedicated_host_all_params()
+ self.test_list_instance_profiles_all_params()
- # Disable retries and run test_get_dedicated_host_all_params.
+ # Disable retries and run test_list_instance_profiles_all_params.
_service.disable_retries()
- self.test_get_dedicated_host_all_params()
+ self.test_list_instance_profiles_all_params()
@responses.activate
- def test_get_dedicated_host_value_error(self):
+ def test_list_instance_profiles_value_error(self):
"""
- test_get_dedicated_host_value_error()
+ test_list_instance_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString')
- mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance/profiles')
+ mock_response = '{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}]}'
responses.add(
responses.GET,
url,
@@ -19392,196 +19573,118 @@ def test_get_dedicated_host_value_error(self):
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_dedicated_host(**req_copy)
+ _service.list_instance_profiles(**req_copy)
- def test_get_dedicated_host_value_error_with_retries(self):
- # Enable retries and run test_get_dedicated_host_value_error.
+ def test_list_instance_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_profiles_value_error.
_service.enable_retries()
- self.test_get_dedicated_host_value_error()
+ self.test_list_instance_profiles_value_error()
- # Disable retries and run test_get_dedicated_host_value_error.
+ # Disable retries and run test_list_instance_profiles_value_error.
_service.disable_retries()
- self.test_get_dedicated_host_value_error()
+ self.test_list_instance_profiles_value_error()
-class TestUpdateDedicatedHost:
+class TestGetInstanceProfile:
"""
- Test Class for update_dedicated_host
+ Test Class for get_instance_profile
"""
@responses.activate
- def test_update_dedicated_host_all_params(self):
+ def test_get_instance_profile_all_params(self):
"""
- update_dedicated_host()
+ get_instance_profile()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString')
- mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance/profiles/mx2-host-152x1216')
+ mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a DedicatedHostPatch model
- dedicated_host_patch_model = {}
- dedicated_host_patch_model['instance_placement_enabled'] = False
- dedicated_host_patch_model['name'] = 'my-host'
-
# Set up parameter values
- id = 'testString'
- dedicated_host_patch = dedicated_host_patch_model
+ name = 'mx2-host-152x1216'
# Invoke method
- response = _service.update_dedicated_host(
- id,
- dedicated_host_patch,
+ response = _service.get_instance_profile(
+ name,
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 == dedicated_host_patch
- def test_update_dedicated_host_all_params_with_retries(self):
- # Enable retries and run test_update_dedicated_host_all_params.
+ def test_get_instance_profile_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_profile_all_params.
_service.enable_retries()
- self.test_update_dedicated_host_all_params()
+ self.test_get_instance_profile_all_params()
- # Disable retries and run test_update_dedicated_host_all_params.
+ # Disable retries and run test_get_instance_profile_all_params.
_service.disable_retries()
- self.test_update_dedicated_host_all_params()
+ self.test_get_instance_profile_all_params()
@responses.activate
- def test_update_dedicated_host_value_error(self):
+ def test_get_instance_profile_value_error(self):
"""
- test_update_dedicated_host_value_error()
+ test_get_instance_profile_value_error()
"""
# Set up mock
- url = preprocess_url('/dedicated_hosts/testString')
- mock_response = '{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/instance/profiles/mx2-host-152x1216')
+ mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["amd"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a DedicatedHostPatch model
- dedicated_host_patch_model = {}
- dedicated_host_patch_model['instance_placement_enabled'] = False
- dedicated_host_patch_model['name'] = 'my-host'
-
# Set up parameter values
- id = 'testString'
- dedicated_host_patch = dedicated_host_patch_model
+ name = 'mx2-host-152x1216'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "dedicated_host_patch": dedicated_host_patch,
+ "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.update_dedicated_host(**req_copy)
+ _service.get_instance_profile(**req_copy)
- def test_update_dedicated_host_value_error_with_retries(self):
- # Enable retries and run test_update_dedicated_host_value_error.
+ def test_get_instance_profile_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_profile_value_error.
_service.enable_retries()
- self.test_update_dedicated_host_value_error()
+ self.test_get_instance_profile_value_error()
- # Disable retries and run test_update_dedicated_host_value_error.
+ # Disable retries and run test_get_instance_profile_value_error.
_service.disable_retries()
- self.test_update_dedicated_host_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: DedicatedHosts
-##############################################################################
-
-##############################################################################
-# Start of Service: PlacementGroups
-##############################################################################
-# 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,
- )
+ self.test_get_instance_profile_value_error()
-class TestListPlacementGroups:
+class TestListInstances:
"""
- Test Class for list_placement_groups
+ Test Class for list_instances
"""
@responses.activate
- def test_list_placement_groups_all_params(self):
+ def test_list_instances_all_params(self):
"""
- list_placement_groups()
+ list_instances()
"""
# Set up mock
- url = preprocess_url('/placement_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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('/instances')
+ mock_response = '{"first": {"href": "href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -19593,11 +19696,47 @@ def test_list_placement_groups_all_params(self):
# Set up parameter values
start = 'testString'
limit = 50
+ resource_group_id = 'testString'
+ name = 'my-name'
+ cluster_network_id = 'testString'
+ cluster_network_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573'
+ cluster_network_name = 'my-cluster-network'
+ dedicated_host_id = 'testString'
+ dedicated_host_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
+ dedicated_host_name = 'my-dedicated-host'
+ placement_group_id = 'testString'
+ placement_group_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871'
+ placement_group_name = 'my-placement-group'
+ reservation_affinity_policy = 'automatic'
+ reservation_id = 'testString'
+ reservation_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+ reservation_name = 'my-reservation'
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
# Invoke method
- response = _service.list_placement_groups(
+ response = _service.list_instances(
start=start,
limit=limit,
+ resource_group_id=resource_group_id,
+ name=name,
+ cluster_network_id=cluster_network_id,
+ cluster_network_crn=cluster_network_crn,
+ cluster_network_name=cluster_network_name,
+ dedicated_host_id=dedicated_host_id,
+ dedicated_host_crn=dedicated_host_crn,
+ dedicated_host_name=dedicated_host_name,
+ placement_group_id=placement_group_id,
+ placement_group_crn=placement_group_crn,
+ placement_group_name=placement_group_name,
+ reservation_affinity_policy=reservation_affinity_policy,
+ reservation_id=reservation_id,
+ reservation_crn=reservation_crn,
+ reservation_name=reservation_name,
+ vpc_id=vpc_id,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
headers={},
)
@@ -19609,24 +19748,42 @@ 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 'cluster_network.id={}'.format(cluster_network_id) in query_string
+ assert 'cluster_network.crn={}'.format(cluster_network_crn) in query_string
+ assert 'cluster_network.name={}'.format(cluster_network_name) in query_string
+ assert 'dedicated_host.id={}'.format(dedicated_host_id) in query_string
+ assert 'dedicated_host.crn={}'.format(dedicated_host_crn) in query_string
+ assert 'dedicated_host.name={}'.format(dedicated_host_name) in query_string
+ assert 'placement_group.id={}'.format(placement_group_id) in query_string
+ assert 'placement_group.crn={}'.format(placement_group_crn) in query_string
+ assert 'placement_group.name={}'.format(placement_group_name) in query_string
+ assert 'reservation_affinity.policy={}'.format(reservation_affinity_policy) in query_string
+ assert 'reservation.id={}'.format(reservation_id) in query_string
+ assert 'reservation.crn={}'.format(reservation_crn) in query_string
+ assert 'reservation.name={}'.format(reservation_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
- def test_list_placement_groups_all_params_with_retries(self):
- # Enable retries and run test_list_placement_groups_all_params.
+ def test_list_instances_all_params_with_retries(self):
+ # Enable retries and run test_list_instances_all_params.
_service.enable_retries()
- self.test_list_placement_groups_all_params()
+ self.test_list_instances_all_params()
- # Disable retries and run test_list_placement_groups_all_params.
+ # Disable retries and run test_list_instances_all_params.
_service.disable_retries()
- self.test_list_placement_groups_all_params()
+ self.test_list_instances_all_params()
@responses.activate
- def test_list_placement_groups_required_params(self):
+ def test_list_instances_required_params(self):
"""
- test_list_placement_groups_required_params()
+ test_list_instances_required_params()
"""
# Set up mock
- url = preprocess_url('/placement_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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('/instances')
+ mock_response = '{"first": {"href": "href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -19636,29 +19793,29 @@ def test_list_placement_groups_required_params(self):
)
# Invoke method
- response = _service.list_placement_groups()
+ response = _service.list_instances()
# 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_instances_required_params_with_retries(self):
+ # Enable retries and run test_list_instances_required_params.
_service.enable_retries()
- self.test_list_placement_groups_required_params()
+ self.test_list_instances_required_params()
- # Disable retries and run test_list_placement_groups_required_params.
+ # Disable retries and run test_list_instances_required_params.
_service.disable_retries()
- self.test_list_placement_groups_required_params()
+ self.test_list_instances_required_params()
@responses.activate
- def test_list_placement_groups_value_error(self):
+ def test_list_instances_value_error(self):
"""
- test_list_placement_groups_value_error()
+ test_list_instances_value_error()
"""
# Set up mock
- url = preprocess_url('/placement_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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('/instances')
+ mock_response = '{"first": {"href": "href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -19673,26 +19830,26 @@ 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_instances(**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_instances_value_error_with_retries(self):
+ # Enable retries and run test_list_instances_value_error.
_service.enable_retries()
- self.test_list_placement_groups_value_error()
+ self.test_list_instances_value_error()
- # Disable retries and run test_list_placement_groups_value_error.
+ # Disable retries and run test_list_instances_value_error.
_service.disable_retries()
- self.test_list_placement_groups_value_error()
+ self.test_list_instances_value_error()
@responses.activate
- def test_list_placement_groups_with_pager_get_next(self):
+ def test_list_instances_with_pager_get_next(self):
"""
- test_list_placement_groups_with_pager_get_next()
+ test_list_instances_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/placement_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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('/instances')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ mock_response2 = '{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -19710,9 +19867,27 @@ def test_list_placement_groups_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = PlacementGroupsPager(
+ pager = InstancesPager(
client=_service,
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ cluster_network_id='testString',
+ cluster_network_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573',
+ cluster_network_name='my-cluster-network',
+ dedicated_host_id='testString',
+ dedicated_host_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a',
+ dedicated_host_name='my-dedicated-host',
+ placement_group_id='testString',
+ placement_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871',
+ placement_group_name='my-placement-group',
+ reservation_affinity_policy='automatic',
+ reservation_id='testString',
+ reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
+ reservation_name='my-reservation',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
)
while pager.has_next():
next_page = pager.get_next()
@@ -19721,14 +19896,14 @@ def test_list_placement_groups_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_placement_groups_with_pager_get_all(self):
+ def test_list_instances_with_pager_get_all(self):
"""
- test_list_placement_groups_with_pager_get_all()
+ test_list_instances_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/placement_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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('/instances')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ mock_response2 = '{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"amd","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -19745,28 +19920,46 @@ def test_list_placement_groups_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = PlacementGroupsPager(
+ pager = InstancesPager(
client=_service,
limit=10,
+ resource_group_id='testString',
+ name='my-name',
+ cluster_network_id='testString',
+ cluster_network_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573',
+ cluster_network_name='my-cluster-network',
+ dedicated_host_id='testString',
+ dedicated_host_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a',
+ dedicated_host_name='my-dedicated-host',
+ placement_group_id='testString',
+ placement_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871',
+ placement_group_name='my-placement-group',
+ reservation_affinity_policy='automatic',
+ reservation_id='testString',
+ reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
+ reservation_name='my-reservation',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreatePlacementGroup:
+class TestCreateInstance:
"""
- Test Class for create_placement_group
+ Test Class for create_instance
"""
@responses.activate
- def test_create_placement_group_all_params(self):
+ def test_create_instance_all_params(self):
"""
- create_placement_group()
+ create_instance()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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('/instances')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -19775,673 +19968,642 @@ def test_create_placement_group_all_params(self):
status=201,
)
- # 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'
- resource_group = resource_group_identity_model
-
- # Invoke method
- response = _service.create_placement_group(
- strategy,
- name=name,
- resource_group=resource_group,
- 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['strategy'] == 'host_spread'
- assert req_body['name'] == 'my-placement-group'
- 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.
- _service.enable_retries()
- self.test_create_placement_group_all_params()
-
- # Disable retries and run test_create_placement_group_all_params.
- _service.disable_retries()
- self.test_create_placement_group_all_params()
-
- @responses.activate
- def test_create_placement_group_value_error(self):
- """
- test_create_placement_group_value_error()
- """
- # 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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 InstanceAvailabilityPolicyPrototype model
+ instance_availability_policy_prototype_model = {}
+ instance_availability_policy_prototype_model['host_failure'] = 'restart'
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
- # Set up parameter values
- strategy = 'host_spread'
- name = 'my-placement-group'
- resource_group = resource_group_identity_model
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
- # 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)
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
- 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_placement_group_value_error()
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
+ instance_cluster_network_attachment_prototype_instance_context_model = {}
+ instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
- # Disable retries and run test_create_placement_group_value_error.
- _service.disable_retries()
- self.test_create_placement_group_value_error()
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+ # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
+ instance_default_trusted_profile_prototype_model = {}
+ instance_default_trusted_profile_prototype_model['auto_link'] = False
+ instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
-class TestDeletePlacementGroup:
- """
- Test Class for delete_placement_group
- """
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
- @responses.activate
- def test_delete_placement_group_all_params(self):
- """
- delete_placement_group()
- """
- # Set up mock
- url = preprocess_url('/placement_groups/testString')
- responses.add(
- responses.DELETE,
- url,
- status=202,
- )
+ # Construct a dict representation of a InstanceMetadataServicePrototype model
+ instance_metadata_service_prototype_model = {}
+ instance_metadata_service_prototype_model['enabled'] = False
+ instance_metadata_service_prototype_model['protocol'] = 'https'
+ instance_metadata_service_prototype_model['response_hop_limit'] = 2
- # Set up parameter values
- id = 'testString'
+ # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_prototype_model = {}
+ instance_placement_target_prototype_model['id'] = 'r006-418fe842-a3e9-47b9-a938-1aa5bd632871'
- # Invoke method
- response = _service.delete_placement_group(
- id,
- headers={},
- )
+ # Construct a dict representation of a InstanceProfileIdentityByName model
+ instance_profile_identity_model = {}
+ instance_profile_identity_model['name'] = 'bx2-2x8'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- 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()
+ # Construct a dict representation of a InstanceReservationAffinityPrototype model
+ instance_reservation_affinity_prototype_model = {}
+ instance_reservation_affinity_prototype_model['policy'] = 'automatic'
+ instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
- # Disable retries and run test_delete_placement_group_all_params.
- _service.disable_retries()
- self.test_delete_placement_group_all_params()
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- @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,
- )
+ # Construct a dict representation of a VolumeProfileIdentityByName model
+ volume_profile_identity_model = {}
+ volume_profile_identity_model['name'] = '5iops-tier'
- # Set up parameter values
- id = 'testString'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
- # 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)
+ # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model
+ volume_attachment_prototype_volume_model = {}
+ volume_attachment_prototype_volume_model['bandwidth'] = 1000
+ volume_attachment_prototype_volume_model['iops'] = 10000
+ volume_attachment_prototype_volume_model['name'] = 'my-data-volume'
+ volume_attachment_prototype_volume_model['profile'] = volume_profile_identity_model
+ volume_attachment_prototype_volume_model['resource_group'] = resource_group_identity_model
+ volume_attachment_prototype_volume_model['user_tags'] = []
+ volume_attachment_prototype_volume_model['capacity'] = 1000
+ volume_attachment_prototype_volume_model['encryption_key'] = encryption_key_identity_model
- 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_placement_group_value_error()
+ # Construct a dict representation of a VolumeAttachmentPrototype model
+ volume_attachment_prototype_model = {}
+ volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
+ volume_attachment_prototype_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
- # Disable retries and run test_delete_placement_group_value_error.
- _service.disable_retries()
- self.test_delete_placement_group_value_error()
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a VolumeAllowedUsePrototype model
+ volume_allowed_use_prototype_model = {}
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
-class TestGetPlacementGroup:
- """
- Test Class for get_placement_group
- """
+ # Construct a dict representation of a VolumePrototypeInstanceByImageContext model
+ volume_prototype_instance_by_image_context_model = {}
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
+ volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
+ volume_prototype_instance_by_image_context_model['capacity'] = 100
+ volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
+ volume_prototype_instance_by_image_context_model['iops'] = 10000
+ volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
+ volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
+ volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
+ volume_prototype_instance_by_image_context_model['user_tags'] = []
- @responses.activate
- def test_get_placement_group_all_params(self):
- """
- get_placement_group()
- """
- # 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
+ volume_attachment_prototype_instance_by_image_context_model = {}
+ volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
+ volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
- # Set up parameter values
- id = 'testString'
+ # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
+ catalog_offering_version_plan_identity_model = {}
+ catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
- # Invoke method
- response = _service.get_placement_group(
- id,
- headers={},
- )
+ # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
+ catalog_offering_identity_model = {}
+ catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
+ # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
+ instance_catalog_offering_prototype_model = {}
+ instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
+ instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
- 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_placement_group_all_params()
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
- # Disable retries and run test_get_placement_group_all_params.
- _service.disable_retries()
- self.test_get_placement_group_all_params()
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
- @responses.activate
- def test_get_placement_group_value_error(self):
- """
- test_get_placement_group_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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
- # Set up parameter values
- id = 'testString'
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- # 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_placement_group(**req_copy)
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- 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_placement_group_value_error()
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
+ instance_network_attachment_prototype_virtual_network_interface_model = {}
+ instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
- # Disable retries and run test_get_placement_group_value_error.
- _service.disable_retries()
- self.test_get_placement_group_value_error()
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
+ instance_network_attachment_prototype_model = {}
+ instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
+ instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
+ # 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'
-class TestUpdatePlacementGroup:
- """
- Test Class for update_placement_group
- """
+ # Construct a dict representation of a NetworkInterfacePrototype model
+ network_interface_prototype_model = {}
+ network_interface_prototype_model['allow_ip_spoofing'] = True
+ network_interface_prototype_model['name'] = 'my-instance-network-interface'
+ network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
+ network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ network_interface_prototype_model['subnet'] = subnet_identity_model
- @responses.activate
- def test_update_placement_group_all_params(self):
- """
- update_placement_group()
- """
- # 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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 InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
- # Construct a dict representation of a PlacementGroupPatch model
- placement_group_patch_model = {}
- placement_group_patch_model['name'] = 'my-placement-group-updated'
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a InstancePrototypeInstanceBySourceTemplate model
+ instance_prototype_model = {}
+ instance_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
+ instance_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
+ instance_prototype_model['confidential_compute_mode'] = 'disabled'
+ instance_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
+ instance_prototype_model['enable_secure_boot'] = True
+ instance_prototype_model['keys'] = [key_identity_model]
+ instance_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
+ instance_prototype_model['name'] = 'my-instance'
+ instance_prototype_model['placement_target'] = instance_placement_target_prototype_model
+ instance_prototype_model['profile'] = instance_profile_identity_model
+ instance_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
+ instance_prototype_model['resource_group'] = resource_group_identity_model
+ instance_prototype_model['total_volume_bandwidth'] = 500
+ instance_prototype_model['user_data'] = 'testString'
+ instance_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
+ instance_prototype_model['vpc'] = vpc_identity_model
+ instance_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
+ instance_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
+ instance_prototype_model['image'] = image_identity_model
+ instance_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
+ instance_prototype_model['network_interfaces'] = [network_interface_prototype_model]
+ instance_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
+ instance_prototype_model['primary_network_interface'] = network_interface_prototype_model
+ instance_prototype_model['source_template'] = instance_template_identity_model
+ instance_prototype_model['zone'] = zone_identity_model
# Set up parameter values
- id = 'testString'
- placement_group_patch = placement_group_patch_model
+ instance_prototype = instance_prototype_model
# Invoke method
- response = _service.update_placement_group(
- id,
- placement_group_patch,
+ response = _service.create_instance(
+ instance_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 == placement_group_patch
+ assert req_body == instance_prototype
- def test_update_placement_group_all_params_with_retries(self):
- # Enable retries and run test_update_placement_group_all_params.
+ def test_create_instance_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_all_params.
_service.enable_retries()
- self.test_update_placement_group_all_params()
+ self.test_create_instance_all_params()
- # Disable retries and run test_update_placement_group_all_params.
+ # Disable retries and run test_create_instance_all_params.
_service.disable_retries()
- self.test_update_placement_group_all_params()
+ self.test_create_instance_all_params()
@responses.activate
- def test_update_placement_group_value_error(self):
+ def test_create_instance_value_error(self):
"""
- test_update_placement_group_value_error()
+ test_create_instance_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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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('/instances')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ 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-updated'
+ # Construct a dict representation of a InstanceAvailabilityPolicyPrototype model
+ instance_availability_policy_prototype_model = {}
+ instance_availability_policy_prototype_model['host_failure'] = 'restart'
- # Set up parameter values
- id = 'testString'
- placement_group_patch = placement_group_patch_model
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "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_placement_group(**req_copy)
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
- 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_placement_group_value_error()
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
- # Disable retries and run test_update_placement_group_value_error.
- _service.disable_retries()
- self.test_update_placement_group_value_error()
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeInstanceContext model
+ instance_cluster_network_attachment_prototype_instance_context_model = {}
+ instance_cluster_network_attachment_prototype_instance_context_model['cluster_network_interface'] = instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ instance_cluster_network_attachment_prototype_instance_context_model['name'] = 'my-instance-network-attachment'
+ # Construct a dict representation of a TrustedProfileIdentityById model
+ trusted_profile_identity_model = {}
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
-# endregion
-##############################################################################
-# End of Service: PlacementGroups
-##############################################################################
+ # Construct a dict representation of a InstanceDefaultTrustedProfilePrototype model
+ instance_default_trusted_profile_prototype_model = {}
+ instance_default_trusted_profile_prototype_model['auto_link'] = False
+ instance_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
-##############################################################################
-# Start of Service: BareMetalServers
-##############################################################################
-# region
+ # Construct a dict representation of a KeyIdentityById model
+ key_identity_model = {}
+ key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+ # Construct a dict representation of a InstanceMetadataServicePrototype model
+ instance_metadata_service_prototype_model = {}
+ instance_metadata_service_prototype_model['enabled'] = False
+ instance_metadata_service_prototype_model['protocol'] = 'https'
+ instance_metadata_service_prototype_model['response_hop_limit'] = 2
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ # Construct a dict representation of a InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_prototype_model = {}
+ instance_placement_target_prototype_model['id'] = 'r006-418fe842-a3e9-47b9-a938-1aa5bd632871'
- def test_new_instance(self):
- """
- new_instance()
- """
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
+ # Construct a dict representation of a InstanceProfileIdentityByName model
+ instance_profile_identity_model = {}
+ instance_profile_identity_model['name'] = 'bx2-2x8'
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
- )
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Construct a dict representation of a InstanceReservationAffinityPrototype model
+ instance_reservation_affinity_prototype_model = {}
+ instance_reservation_affinity_prototype_model['policy'] = 'automatic'
+ instance_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
- 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',
- )
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- 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()
+ # Construct a dict representation of a VolumeProfileIdentityByName model
+ volume_profile_identity_model = {}
+ volume_profile_identity_model['name'] = '5iops-tier'
- 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,
- )
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+ # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model
+ volume_attachment_prototype_volume_model = {}
+ volume_attachment_prototype_volume_model['bandwidth'] = 1000
+ volume_attachment_prototype_volume_model['iops'] = 10000
+ volume_attachment_prototype_volume_model['name'] = 'my-data-volume'
+ volume_attachment_prototype_volume_model['profile'] = volume_profile_identity_model
+ volume_attachment_prototype_volume_model['resource_group'] = resource_group_identity_model
+ volume_attachment_prototype_volume_model['user_tags'] = []
+ volume_attachment_prototype_volume_model['capacity'] = 1000
+ volume_attachment_prototype_volume_model['encryption_key'] = encryption_key_identity_model
-class TestListBareMetalServerProfiles:
- """
- Test Class for list_bare_metal_server_profiles
- """
+ # Construct a dict representation of a VolumeAttachmentPrototype model
+ volume_attachment_prototype_model = {}
+ volume_attachment_prototype_model['delete_volume_on_instance_delete'] = False
+ volume_attachment_prototype_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_model['volume'] = volume_attachment_prototype_volume_model
- @responses.activate
- def test_list_bare_metal_server_profiles_all_params(self):
- """
- list_bare_metal_server_profiles()
- """
- # Set up mock
- url = preprocess_url('/bare_metal_server/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- # Set up parameter values
- start = 'testString'
- limit = 50
+ # Construct a dict representation of a VolumeAllowedUsePrototype model
+ volume_allowed_use_prototype_model = {}
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
- # Invoke method
- response = _service.list_bare_metal_server_profiles(
- start=start,
- limit=limit,
- headers={},
- )
+ # Construct a dict representation of a VolumePrototypeInstanceByImageContext model
+ volume_prototype_instance_by_image_context_model = {}
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
+ volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
+ volume_prototype_instance_by_image_context_model['capacity'] = 100
+ volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
+ volume_prototype_instance_by_image_context_model['iops'] = 10000
+ volume_prototype_instance_by_image_context_model['name'] = 'my-boot-volume'
+ volume_prototype_instance_by_image_context_model['profile'] = volume_profile_identity_model
+ volume_prototype_instance_by_image_context_model['resource_group'] = resource_group_identity_model
+ volume_prototype_instance_by_image_context_model['user_tags'] = []
- # 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
+ # Construct a dict representation of a VolumeAttachmentPrototypeInstanceByImageContext model
+ volume_attachment_prototype_instance_by_image_context_model = {}
+ volume_attachment_prototype_instance_by_image_context_model['delete_volume_on_instance_delete'] = True
+ volume_attachment_prototype_instance_by_image_context_model['name'] = 'my-volume-attachment'
+ volume_attachment_prototype_instance_by_image_context_model['volume'] = volume_prototype_instance_by_image_context_model
- 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_profiles_all_params()
+ # Construct a dict representation of a CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN model
+ catalog_offering_version_plan_identity_model = {}
+ catalog_offering_version_plan_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e'
- # Disable retries and run test_list_bare_metal_server_profiles_all_params.
- _service.disable_retries()
- self.test_list_bare_metal_server_profiles_all_params()
+ # Construct a dict representation of a CatalogOfferingIdentityCatalogOfferingByCRN model
+ catalog_offering_identity_model = {}
+ catalog_offering_identity_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442'
- @responses.activate
- 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": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a InstanceCatalogOfferingPrototypeCatalogOfferingByOffering model
+ instance_catalog_offering_prototype_model = {}
+ instance_catalog_offering_prototype_model['plan'] = catalog_offering_version_plan_identity_model
+ instance_catalog_offering_prototype_model['offering'] = catalog_offering_identity_model
- # Invoke method
- response = _service.list_bare_metal_server_profiles()
+ # Construct a dict representation of a ImageIdentityById model
+ image_identity_model = {}
+ image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
- 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()
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
- # Disable retries and run test_list_bare_metal_server_profiles_required_params.
- _service.disable_retries()
- self.test_list_bare_metal_server_profiles_required_params()
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- @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": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
+ instance_network_attachment_prototype_virtual_network_interface_model = {}
+ instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototype model
+ instance_network_attachment_prototype_model = {}
+ instance_network_attachment_prototype_model['name'] = 'my-instance-network-attachment'
+ instance_network_attachment_prototype_model['virtual_network_interface'] = instance_network_attachment_prototype_virtual_network_interface_model
+
+ # 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 NetworkInterfacePrototype model
+ network_interface_prototype_model = {}
+ network_interface_prototype_model['allow_ip_spoofing'] = True
+ network_interface_prototype_model['name'] = 'my-instance-network-interface'
+ network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model
+ network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a InstanceTemplateIdentityById model
+ instance_template_identity_model = {}
+ instance_template_identity_model['id'] = '0717-e6c2c7d8-ad57-4f38-a21c-a86265b6aeb2'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a InstancePrototypeInstanceBySourceTemplate model
+ instance_prototype_model = {}
+ instance_prototype_model['availability_policy'] = instance_availability_policy_prototype_model
+ instance_prototype_model['cluster_network_attachments'] = [instance_cluster_network_attachment_prototype_instance_context_model]
+ instance_prototype_model['confidential_compute_mode'] = 'disabled'
+ instance_prototype_model['default_trusted_profile'] = instance_default_trusted_profile_prototype_model
+ instance_prototype_model['enable_secure_boot'] = True
+ instance_prototype_model['keys'] = [key_identity_model]
+ instance_prototype_model['metadata_service'] = instance_metadata_service_prototype_model
+ instance_prototype_model['name'] = 'my-instance'
+ instance_prototype_model['placement_target'] = instance_placement_target_prototype_model
+ instance_prototype_model['profile'] = instance_profile_identity_model
+ instance_prototype_model['reservation_affinity'] = instance_reservation_affinity_prototype_model
+ instance_prototype_model['resource_group'] = resource_group_identity_model
+ instance_prototype_model['total_volume_bandwidth'] = 500
+ instance_prototype_model['user_data'] = 'testString'
+ instance_prototype_model['volume_attachments'] = [volume_attachment_prototype_model]
+ instance_prototype_model['vpc'] = vpc_identity_model
+ instance_prototype_model['boot_volume_attachment'] = volume_attachment_prototype_instance_by_image_context_model
+ instance_prototype_model['catalog_offering'] = instance_catalog_offering_prototype_model
+ instance_prototype_model['image'] = image_identity_model
+ instance_prototype_model['network_attachments'] = [instance_network_attachment_prototype_model]
+ instance_prototype_model['network_interfaces'] = [network_interface_prototype_model]
+ instance_prototype_model['primary_network_attachment'] = instance_network_attachment_prototype_model
+ instance_prototype_model['primary_network_interface'] = network_interface_prototype_model
+ instance_prototype_model['source_template'] = instance_template_identity_model
+ instance_prototype_model['zone'] = zone_identity_model
+
+ # Set up parameter values
+ instance_prototype = instance_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_prototype": instance_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.list_bare_metal_server_profiles(**req_copy)
+ _service.create_instance(**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_create_instance_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_value_error.
_service.enable_retries()
- self.test_list_bare_metal_server_profiles_value_error()
+ self.test_create_instance_value_error()
- # Disable retries and run test_list_bare_metal_server_profiles_value_error.
+ # Disable retries and run test_create_instance_value_error.
_service.disable_retries()
- self.test_list_bare_metal_server_profiles_value_error()
+ self.test_create_instance_value_error()
- @responses.activate
- def test_list_bare_metal_server_profiles_with_pager_get_next(self):
- """
- test_list_bare_metal_server_profiles_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_server/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
- # Exercise the pager class for this operation
- all_results = []
- pager = BareMetalServerProfilesPager(
- client=_service,
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+class TestDeleteInstance:
+ """
+ Test Class for delete_instance
+ """
@responses.activate
- def test_list_bare_metal_server_profiles_with_pager_get_all(self):
+ def test_delete_instance_all_params(self):
"""
- test_list_bare_metal_server_profiles_with_pager_get_all()
+ delete_instance()
"""
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_server/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"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":"fcp","type":"enum","values":["fcp"]}}],"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","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"reservation_terms":{"type":"enum","values":["one_year"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/instances/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response2,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Exercise the pager class for this operation
- pager = BareMetalServerProfilesPager(
- client=_service,
- limit=10,
+ # Set up parameter values
+ id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+
+ # Invoke method
+ response = _service.delete_instance(
+ id,
+ if_match=if_match,
+ headers={},
)
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 204
-class TestGetBareMetalServerProfile:
- """
- Test Class for get_bare_metal_server_profile
- """
+ def test_delete_instance_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_all_params.
+ _service.enable_retries()
+ self.test_delete_instance_all_params()
+
+ # Disable retries and run test_delete_instance_all_params.
+ _service.disable_retries()
+ self.test_delete_instance_all_params()
@responses.activate
- def test_get_bare_metal_server_profile_all_params(self):
+ def test_delete_instance_required_params(self):
"""
- get_bare_metal_server_profile()
+ test_delete_instance_required_params()
"""
# Set up mock
- url = preprocess_url('/bare_metal_server/profiles/bx2-metal-192x768')
- mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}'
+ url = preprocess_url('/instances/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- name = 'bx2-metal-192x768'
+ id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server_profile(
- name,
+ response = _service.delete_instance(
+ 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_profile_all_params_with_retries(self):
- # Enable retries and run test_get_bare_metal_server_profile_all_params.
+ def test_delete_instance_required_params_with_retries(self):
+ # Enable retries and run test_delete_instance_required_params.
_service.enable_retries()
- self.test_get_bare_metal_server_profile_all_params()
+ self.test_delete_instance_required_params()
- # Disable retries and run test_get_bare_metal_server_profile_all_params.
+ # Disable retries and run test_delete_instance_required_params.
_service.disable_retries()
- self.test_get_bare_metal_server_profile_all_params()
+ self.test_delete_instance_required_params()
@responses.activate
- def test_get_bare_metal_server_profile_value_error(self):
+ def test_delete_instance_value_error(self):
"""
- test_get_bare_metal_server_profile_value_error()
+ test_delete_instance_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_server/profiles/bx2-metal-192x768')
- mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"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": "fcp", "type": "enum", "values": ["fcp"]}}], "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", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}'
+ url = preprocess_url('/instances/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- name = 'bx2-metal-192x768'
+ 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_bare_metal_server_profile(**req_copy)
+ _service.delete_instance(**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_delete_instance_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_profile_value_error()
+ self.test_delete_instance_value_error()
- # Disable retries and run test_get_bare_metal_server_profile_value_error.
+ # Disable retries and run test_delete_instance_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_profile_value_error()
+ self.test_delete_instance_value_error()
-class TestListBareMetalServers:
+class TestGetInstance:
"""
- Test Class for list_bare_metal_servers
+ Test Class for get_instance
"""
@responses.activate
- def test_list_bare_metal_servers_all_params(self):
+ def test_get_instance_all_params(self):
"""
- list_bare_metal_servers()
+ get_instance()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -20451,66 +20613,35 @@ def test_list_bare_metal_servers_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- name = 'my-name'
- reservation_id = 'testString'
- reservation_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- reservation_name = 'my-reservation'
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
+ id = 'testString'
# Invoke method
- response = _service.list_bare_metal_servers(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
- name=name,
- reservation_id=reservation_id,
- reservation_crn=reservation_crn,
- reservation_name=reservation_name,
- vpc_id=vpc_id,
- vpc_crn=vpc_crn,
- vpc_name=vpc_name,
+ response = _service.get_instance(
+ 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
- assert 'name={}'.format(name) in query_string
- assert 'reservation.id={}'.format(reservation_id) in query_string
- assert 'reservation.crn={}'.format(reservation_crn) in query_string
- assert 'reservation.name={}'.format(reservation_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
- def test_list_bare_metal_servers_all_params_with_retries(self):
- # Enable retries and run test_list_bare_metal_servers_all_params.
+ def test_get_instance_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_all_params.
_service.enable_retries()
- self.test_list_bare_metal_servers_all_params()
+ self.test_get_instance_all_params()
- # Disable retries and run test_list_bare_metal_servers_all_params.
+ # Disable retries and run test_get_instance_all_params.
_service.disable_retries()
- self.test_list_bare_metal_servers_all_params()
+ self.test_get_instance_all_params()
@responses.activate
- def test_list_bare_metal_servers_required_params(self):
+ def test_get_instance_value_error(self):
"""
- test_list_bare_metal_servers_required_params()
+ test_get_instance_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -20519,450 +20650,466 @@ def test_list_bare_metal_servers_required_params(self):
status=200,
)
- # Invoke method
- response = _service.list_bare_metal_servers()
+ # Set up parameter values
+ id = 'testString'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
+ # 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_instance(**req_copy)
- def test_list_bare_metal_servers_required_params_with_retries(self):
- # Enable retries and run test_list_bare_metal_servers_required_params.
+ def test_get_instance_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_value_error.
_service.enable_retries()
- self.test_list_bare_metal_servers_required_params()
+ self.test_get_instance_value_error()
- # Disable retries and run test_list_bare_metal_servers_required_params.
+ # Disable retries and run test_get_instance_value_error.
_service.disable_retries()
- self.test_list_bare_metal_servers_required_params()
+ self.test_get_instance_value_error()
+
+
+class TestUpdateInstance:
+ """
+ Test Class for update_instance
+ """
@responses.activate
- def test_list_bare_metal_servers_value_error(self):
+ def test_update_instance_all_params(self):
"""
- test_list_bare_metal_servers_value_error()
+ update_instance()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
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)
+ # Construct a dict representation of a InstanceAvailabilityPolicyPatch model
+ instance_availability_policy_patch_model = {}
+ instance_availability_policy_patch_model['host_failure'] = 'restart'
- def test_list_bare_metal_servers_value_error_with_retries(self):
- # Enable retries and run test_list_bare_metal_servers_value_error.
+ # Construct a dict representation of a InstanceMetadataServicePatch model
+ instance_metadata_service_patch_model = {}
+ instance_metadata_service_patch_model['enabled'] = True
+ instance_metadata_service_patch_model['protocol'] = 'http'
+ instance_metadata_service_patch_model['response_hop_limit'] = 1
+
+ # Construct a dict representation of a InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_patch_model = {}
+ instance_placement_target_patch_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
+
+ # Construct a dict representation of a InstancePatchProfileInstanceProfileIdentityByName model
+ instance_patch_profile_model = {}
+ instance_patch_profile_model['name'] = 'bx2-4x16'
+
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a InstanceReservationAffinityPatch model
+ instance_reservation_affinity_patch_model = {}
+ instance_reservation_affinity_patch_model['policy'] = 'automatic'
+ instance_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
+
+ # Construct a dict representation of a InstancePatch model
+ instance_patch_model = {}
+ instance_patch_model['availability_policy'] = instance_availability_policy_patch_model
+ instance_patch_model['confidential_compute_mode'] = 'disabled'
+ instance_patch_model['enable_secure_boot'] = True
+ instance_patch_model['metadata_service'] = instance_metadata_service_patch_model
+ instance_patch_model['name'] = 'my-instance'
+ instance_patch_model['placement_target'] = instance_placement_target_patch_model
+ instance_patch_model['profile'] = instance_patch_profile_model
+ instance_patch_model['reservation_affinity'] = instance_reservation_affinity_patch_model
+ instance_patch_model['total_volume_bandwidth'] = 500
+
+ # Set up parameter values
+ id = 'testString'
+ instance_patch = instance_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+
+ # Invoke method
+ response = _service.update_instance(
+ id,
+ instance_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 == instance_patch
+
+ def test_update_instance_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_all_params.
_service.enable_retries()
- self.test_list_bare_metal_servers_value_error()
+ self.test_update_instance_all_params()
- # Disable retries and run test_list_bare_metal_servers_value_error.
+ # Disable retries and run test_update_instance_all_params.
_service.disable_retries()
- self.test_list_bare_metal_servers_value_error()
+ self.test_update_instance_all_params()
@responses.activate
- def test_list_bare_metal_servers_with_pager_get_next(self):
+ def test_update_instance_required_params(self):
"""
- test_list_bare_metal_servers_with_pager_get_next()
+ test_update_instance_required_params()
"""
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_servers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/instances/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = BareMetalServersPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- reservation_id='testString',
- reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
- reservation_name='my-reservation',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+ # Construct a dict representation of a InstanceAvailabilityPolicyPatch model
+ instance_availability_policy_patch_model = {}
+ instance_availability_policy_patch_model['host_failure'] = 'restart'
- @responses.activate
- def test_list_bare_metal_servers_with_pager_get_all(self):
- """
- test_list_bare_metal_servers_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_servers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","name":"my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"0717-3744f199-6ccc-4698-8772-bb3937348c96","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-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"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"automatic","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"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":"deleting","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":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a InstanceMetadataServicePatch model
+ instance_metadata_service_patch_model = {}
+ instance_metadata_service_patch_model['enabled'] = True
+ instance_metadata_service_patch_model['protocol'] = 'http'
+ instance_metadata_service_patch_model['response_hop_limit'] = 1
- # Exercise the pager class for this operation
- pager = BareMetalServersPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- reservation_id='testString',
- reservation_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63',
- reservation_name='my-reservation',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
+ # Construct a dict representation of a InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_patch_model = {}
+ instance_placement_target_patch_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
+
+ # Construct a dict representation of a InstancePatchProfileInstanceProfileIdentityByName model
+ instance_patch_profile_model = {}
+ instance_patch_profile_model['name'] = 'bx2-4x16'
+
+ # Construct a dict representation of a ReservationIdentityById model
+ reservation_identity_model = {}
+ reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+
+ # Construct a dict representation of a InstanceReservationAffinityPatch model
+ instance_reservation_affinity_patch_model = {}
+ instance_reservation_affinity_patch_model['policy'] = 'automatic'
+ instance_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
+
+ # Construct a dict representation of a InstancePatch model
+ instance_patch_model = {}
+ instance_patch_model['availability_policy'] = instance_availability_policy_patch_model
+ instance_patch_model['confidential_compute_mode'] = 'disabled'
+ instance_patch_model['enable_secure_boot'] = True
+ instance_patch_model['metadata_service'] = instance_metadata_service_patch_model
+ instance_patch_model['name'] = 'my-instance'
+ instance_patch_model['placement_target'] = instance_placement_target_patch_model
+ instance_patch_model['profile'] = instance_patch_profile_model
+ instance_patch_model['reservation_affinity'] = instance_reservation_affinity_patch_model
+ instance_patch_model['total_volume_bandwidth'] = 500
+
+ # Set up parameter values
+ id = 'testString'
+ instance_patch = instance_patch_model
+
+ # Invoke method
+ response = _service.update_instance(
+ id,
+ instance_patch,
+ headers={},
)
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # 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 == instance_patch
+
+ def test_update_instance_required_params_with_retries(self):
+ # Enable retries and run test_update_instance_required_params.
+ _service.enable_retries()
+ self.test_update_instance_required_params()
-class TestCreateBareMetalServer:
- """
- Test Class for create_bare_metal_server
- """
+ # Disable retries and run test_update_instance_required_params.
+ _service.disable_retries()
+ self.test_update_instance_required_params()
@responses.activate
- def test_create_bare_metal_server_all_params(self):
+ def test_update_instance_value_error(self):
"""
- create_bare_metal_server()
+ test_update_instance_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/instances/testString')
+ mock_response = '{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-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/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "amd", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+ # Construct a dict representation of a InstanceAvailabilityPolicyPatch model
+ instance_availability_policy_patch_model = {}
+ instance_availability_policy_patch_model['host_failure'] = 'restart'
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
+ # Construct a dict representation of a InstanceMetadataServicePatch model
+ instance_metadata_service_patch_model = {}
+ instance_metadata_service_patch_model['enabled'] = True
+ instance_metadata_service_patch_model['protocol'] = 'http'
+ instance_metadata_service_patch_model['response_hop_limit'] = 1
- # 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 InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityById model
+ instance_placement_target_patch_model = {}
+ instance_placement_target_patch_model['id'] = '0717-1e09281b-f177-46fb-baf1-bc152b2e391a'
- # 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 InstancePatchProfileInstanceProfileIdentityByName model
+ instance_patch_profile_model = {}
+ instance_patch_profile_model['name'] = 'bx2-4x16'
# Construct a dict representation of a ReservationIdentityById model
reservation_identity_model = {}
reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- # Construct a dict representation of a BareMetalServerReservationAffinityPrototype model
- bare_metal_server_reservation_affinity_prototype_model = {}
- bare_metal_server_reservation_affinity_prototype_model['policy'] = 'automatic'
- bare_metal_server_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # Construct a dict representation of a BareMetalServerTrustedPlatformModulePrototype model
- bare_metal_server_trusted_platform_module_prototype_model = {}
- bare_metal_server_trusted_platform_module_prototype_model['mode'] = 'disabled'
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a dict representation of a InstanceReservationAffinityPatch model
+ instance_reservation_affinity_patch_model = {}
+ instance_reservation_affinity_patch_model['policy'] = 'automatic'
+ instance_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a dict representation of a InstancePatch model
+ instance_patch_model = {}
+ instance_patch_model['availability_policy'] = instance_availability_policy_patch_model
+ instance_patch_model['confidential_compute_mode'] = 'disabled'
+ instance_patch_model['enable_secure_boot'] = True
+ instance_patch_model['metadata_service'] = instance_metadata_service_patch_model
+ instance_patch_model['name'] = 'my-instance'
+ instance_patch_model['placement_target'] = instance_placement_target_patch_model
+ instance_patch_model['profile'] = instance_patch_profile_model
+ instance_patch_model['reservation_affinity'] = instance_reservation_affinity_patch_model
+ instance_patch_model['total_volume_bandwidth'] = 500
- # Construct a dict representation of a SecurityGroupIdentityById model
- security_group_identity_model = {}
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # Set up parameter values
+ id = 'testString'
+ instance_patch = instance_patch_model
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "instance_patch": instance_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_instance(**req_copy)
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+ def test_update_instance_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_value_error.
+ _service.enable_retries()
+ self.test_update_instance_value_error()
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
- bare_metal_server_network_attachment_prototype_model = {}
- bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
- bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
- bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
+ # Disable retries and run test_update_instance_value_error.
+ _service.disable_retries()
+ self.test_update_instance_value_error()
- # Construct a dict representation of a BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPCIPrototype model
- bare_metal_server_primary_network_attachment_prototype_model = {}
- bare_metal_server_primary_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_primary_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
- bare_metal_server_primary_network_attachment_prototype_model['allowed_vlans'] = []
- bare_metal_server_primary_network_attachment_prototype_model['interface_type'] = 'pci'
- # Construct a dict representation of a BareMetalServerPrototypeBareMetalServerByNetworkAttachment model
- bare_metal_server_prototype_model = {}
- bare_metal_server_prototype_model['bandwidth'] = 20000
- bare_metal_server_prototype_model['enable_secure_boot'] = False
- bare_metal_server_prototype_model['initialization'] = bare_metal_server_initialization_prototype_model
- bare_metal_server_prototype_model['name'] = 'my-bare-metal-server'
- bare_metal_server_prototype_model['profile'] = bare_metal_server_profile_identity_model
- bare_metal_server_prototype_model['reservation_affinity'] = bare_metal_server_reservation_affinity_prototype_model
- bare_metal_server_prototype_model['resource_group'] = resource_group_identity_model
- bare_metal_server_prototype_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_prototype_model
- bare_metal_server_prototype_model['vpc'] = vpc_identity_model
- bare_metal_server_prototype_model['zone'] = zone_identity_model
- bare_metal_server_prototype_model['network_attachments'] = [bare_metal_server_network_attachment_prototype_model]
- bare_metal_server_prototype_model['primary_network_attachment'] = bare_metal_server_primary_network_attachment_prototype_model
+class TestGetInstanceInitialization:
+ """
+ Test Class for get_instance_initialization
+ """
+
+ @responses.activate
+ def test_get_instance_initialization_all_params(self):
+ """
+ get_instance_initialization()
+ """
+ # Set up mock
+ url = preprocess_url('/instances/testString/initialization')
+ mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
# Set up parameter values
- bare_metal_server_prototype = bare_metal_server_prototype_model
+ id = 'testString'
# Invoke method
- response = _service.create_bare_metal_server(
- bare_metal_server_prototype,
+ response = _service.get_instance_initialization(
+ id,
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_prototype
+ assert response.status_code == 200
- def test_create_bare_metal_server_all_params_with_retries(self):
- # Enable retries and run test_create_bare_metal_server_all_params.
+ def test_get_instance_initialization_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_initialization_all_params.
_service.enable_retries()
- self.test_create_bare_metal_server_all_params()
+ self.test_get_instance_initialization_all_params()
- # Disable retries and run test_create_bare_metal_server_all_params.
+ # Disable retries and run test_get_instance_initialization_all_params.
_service.disable_retries()
- self.test_create_bare_metal_server_all_params()
+ self.test_get_instance_initialization_all_params()
@responses.activate
- def test_create_bare_metal_server_value_error(self):
+ def test_get_instance_initialization_value_error(self):
"""
- test_create_bare_metal_server_value_error()
+ test_get_instance_initialization_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/instances/testString/initialization')
+ mock_response = '{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
-
- # 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 BareMetalServerProfileIdentityByName model
- bare_metal_server_profile_identity_model = {}
- bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768'
-
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a BareMetalServerReservationAffinityPrototype model
- bare_metal_server_reservation_affinity_prototype_model = {}
- bare_metal_server_reservation_affinity_prototype_model['policy'] = 'automatic'
- bare_metal_server_reservation_affinity_prototype_model['pool'] = [reservation_identity_model]
+ # Set up parameter values
+ id = 'testString'
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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_instance_initialization(**req_copy)
- # Construct a dict representation of a BareMetalServerTrustedPlatformModulePrototype model
- bare_metal_server_trusted_platform_module_prototype_model = {}
- bare_metal_server_trusted_platform_module_prototype_model['mode'] = 'disabled'
+ def test_get_instance_initialization_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_initialization_value_error.
+ _service.enable_retries()
+ self.test_get_instance_initialization_value_error()
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Disable retries and run test_get_instance_initialization_value_error.
+ _service.disable_retries()
+ self.test_get_instance_initialization_value_error()
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+class TestCreateInstanceAction:
+ """
+ Test Class for create_instance_action
+ """
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+ @responses.activate
+ def test_create_instance_action_all_params(self):
+ """
+ create_instance_action()
+ """
+ # Set up mock
+ url = preprocess_url('/instances/testString/actions')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}'
+ responses.add(
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
+ )
- # Construct a dict representation of a SecurityGroupIdentityById model
- security_group_identity_model = {}
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # Set up parameter values
+ instance_id = 'testString'
+ type = 'reboot'
+ force = True
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # Invoke method
+ response = _service.create_instance_action(
+ instance_id,
+ type,
+ force=force,
+ headers={},
+ )
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
+ # 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['type'] == 'reboot'
+ assert req_body['force'] == True
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
- bare_metal_server_network_attachment_prototype_model = {}
- bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
- bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
- bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
+ def test_create_instance_action_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_action_all_params.
+ _service.enable_retries()
+ self.test_create_instance_action_all_params()
- # Construct a dict representation of a BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPCIPrototype model
- bare_metal_server_primary_network_attachment_prototype_model = {}
- bare_metal_server_primary_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_primary_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
- bare_metal_server_primary_network_attachment_prototype_model['allowed_vlans'] = []
- bare_metal_server_primary_network_attachment_prototype_model['interface_type'] = 'pci'
+ # Disable retries and run test_create_instance_action_all_params.
+ _service.disable_retries()
+ self.test_create_instance_action_all_params()
- # Construct a dict representation of a BareMetalServerPrototypeBareMetalServerByNetworkAttachment model
- bare_metal_server_prototype_model = {}
- bare_metal_server_prototype_model['bandwidth'] = 20000
- bare_metal_server_prototype_model['enable_secure_boot'] = False
- bare_metal_server_prototype_model['initialization'] = bare_metal_server_initialization_prototype_model
- bare_metal_server_prototype_model['name'] = 'my-bare-metal-server'
- bare_metal_server_prototype_model['profile'] = bare_metal_server_profile_identity_model
- bare_metal_server_prototype_model['reservation_affinity'] = bare_metal_server_reservation_affinity_prototype_model
- bare_metal_server_prototype_model['resource_group'] = resource_group_identity_model
- bare_metal_server_prototype_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_prototype_model
- bare_metal_server_prototype_model['vpc'] = vpc_identity_model
- bare_metal_server_prototype_model['zone'] = zone_identity_model
- bare_metal_server_prototype_model['network_attachments'] = [bare_metal_server_network_attachment_prototype_model]
- bare_metal_server_prototype_model['primary_network_attachment'] = bare_metal_server_primary_network_attachment_prototype_model
+ @responses.activate
+ def test_create_instance_action_value_error(self):
+ """
+ test_create_instance_action_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/instances/testString/actions')
+ mock_response = '{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}'
+ responses.add(
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
+ )
# Set up parameter values
- bare_metal_server_prototype = bare_metal_server_prototype_model
+ instance_id = 'testString'
+ type = 'reboot'
+ force = True
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "bare_metal_server_prototype": bare_metal_server_prototype,
+ "instance_id": instance_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.create_bare_metal_server(**req_copy)
+ _service.create_instance_action(**req_copy)
- def test_create_bare_metal_server_value_error_with_retries(self):
- # Enable retries and run test_create_bare_metal_server_value_error.
+ def test_create_instance_action_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_action_value_error.
_service.enable_retries()
- self.test_create_bare_metal_server_value_error()
+ self.test_create_instance_action_value_error()
- # Disable retries and run test_create_bare_metal_server_value_error.
+ # Disable retries and run test_create_instance_action_value_error.
_service.disable_retries()
- self.test_create_bare_metal_server_value_error()
+ self.test_create_instance_action_value_error()
-class TestCreateBareMetalServerConsoleAccessToken:
+class TestListInstanceClusterNetworkAttachments:
"""
- Test Class for create_bare_metal_server_console_access_token
+ Test Class for list_instance_cluster_network_attachments
"""
@responses.activate
- def test_create_bare_metal_server_console_access_token_all_params(self):
+ def test_list_instance_cluster_network_attachments_all_params(self):
"""
- create_bare_metal_server_console_access_token()
+ list_instance_cluster_network_attachments()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/console_access_token')
- mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response = '{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
@@ -20970,45 +21117,46 @@ def test_create_bare_metal_server_console_access_token_all_params(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
- console_type = 'serial'
- force = False
+ instance_id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.create_bare_metal_server_console_access_token(
- bare_metal_server_id,
- console_type,
- force=force,
+ response = _service.list_instance_cluster_network_attachments(
+ instance_id,
+ start=start,
+ limit=limit,
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
+ # 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_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_list_instance_cluster_network_attachments_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_cluster_network_attachments_all_params.
_service.enable_retries()
- self.test_create_bare_metal_server_console_access_token_all_params()
+ self.test_list_instance_cluster_network_attachments_all_params()
- # Disable retries and run test_create_bare_metal_server_console_access_token_all_params.
+ # Disable retries and run test_list_instance_cluster_network_attachments_all_params.
_service.disable_retries()
- self.test_create_bare_metal_server_console_access_token_all_params()
+ self.test_list_instance_cluster_network_attachments_all_params()
@responses.activate
- def test_create_bare_metal_server_console_access_token_value_error(self):
+ def test_list_instance_cluster_network_attachments_required_params(self):
"""
- test_create_bare_metal_server_console_access_token_value_error()
+ test_list_instance_cluster_network_attachments_required_params()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/console_access_token')
- mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response = '{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
@@ -21016,763 +21164,730 @@ def test_create_bare_metal_server_console_access_token_value_error(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
- console_type = 'serial'
- force = False
+ instance_id = 'testString'
+
+ # Invoke method
+ response = _service.list_instance_cluster_network_attachments(
+ instance_id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_instance_cluster_network_attachments_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_cluster_network_attachments_required_params.
+ _service.enable_retries()
+ self.test_list_instance_cluster_network_attachments_required_params()
+
+ # Disable retries and run test_list_instance_cluster_network_attachments_required_params.
+ _service.disable_retries()
+ self.test_list_instance_cluster_network_attachments_required_params()
+
+ @responses.activate
+ def test_list_instance_cluster_network_attachments_value_error(self):
+ """
+ test_list_instance_cluster_network_attachments_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response = '{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ instance_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,
+ "instance_id": instance_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.list_instance_cluster_network_attachments(**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_list_instance_cluster_network_attachments_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_cluster_network_attachments_value_error.
_service.enable_retries()
- self.test_create_bare_metal_server_console_access_token_value_error()
+ self.test_list_instance_cluster_network_attachments_value_error()
- # Disable retries and run test_create_bare_metal_server_console_access_token_value_error.
+ # Disable retries and run test_list_instance_cluster_network_attachments_value_error.
_service.disable_retries()
- self.test_create_bare_metal_server_console_access_token_value_error()
+ self.test_list_instance_cluster_network_attachments_value_error()
+
+ @responses.activate
+ def test_list_instance_cluster_network_attachments_with_pager_get_next(self):
+ """
+ test_list_instance_cluster_network_attachments_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
+ mock_response2 = '{"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = InstanceClusterNetworkAttachmentsPager(
+ client=_service,
+ instance_id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestListBareMetalServerDisks:
+ @responses.activate
+ def test_list_instance_cluster_network_attachments_with_pager_get_all(self):
+ """
+ test_list_instance_cluster_network_attachments_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
+ mock_response2 = '{"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = InstanceClusterNetworkAttachmentsPager(
+ client=_service,
+ instance_id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateClusterNetworkAttachment:
"""
- Test Class for list_bare_metal_server_disks
+ Test Class for create_cluster_network_attachment
"""
@responses.activate
- def test_list_bare_metal_server_disks_all_params(self):
+ def test_create_cluster_network_attachment_all_params(self):
"""
- list_bare_metal_server_disks()
+ create_cluster_network_attachment()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityById model
+ instance_cluster_network_attachment_before_prototype_model = {}
+ instance_cluster_network_attachment_before_prototype_model['id'] = '0717-fb880975-db45-4459-8548-64e3995ac213'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
+ cluster_network_interface = instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ before = instance_cluster_network_attachment_before_prototype_model
+ name = 'my-instance-network-attachment'
# Invoke method
- response = _service.list_bare_metal_server_disks(
- bare_metal_server_id,
+ response = _service.create_cluster_network_attachment(
+ instance_id,
+ cluster_network_interface,
+ before=before,
+ 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['cluster_network_interface'] == instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ assert req_body['before'] == instance_cluster_network_attachment_before_prototype_model
+ assert req_body['name'] == 'my-instance-network-attachment'
- 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_create_cluster_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_create_cluster_network_attachment_all_params.
_service.enable_retries()
- self.test_list_bare_metal_server_disks_all_params()
+ self.test_create_cluster_network_attachment_all_params()
- # Disable retries and run test_list_bare_metal_server_disks_all_params.
+ # Disable retries and run test_create_cluster_network_attachment_all_params.
_service.disable_retries()
- self.test_list_bare_metal_server_disks_all_params()
+ self.test_create_cluster_network_attachment_all_params()
@responses.activate
- def test_list_bare_metal_server_disks_value_error(self):
+ def test_create_cluster_network_attachment_value_error(self):
"""
- test_list_bare_metal_server_disks_value_error()
+ test_create_cluster_network_attachment_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
+ cluster_network_interface_primary_ip_prototype_model = {}
+ cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+
+ # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
+ cluster_network_subnet_identity_model = {}
+ cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model = {}
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['auto_delete'] = False
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['name'] = 'my-cluster-network-interface'
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['primary_ip'] = cluster_network_interface_primary_ip_prototype_model
+ instance_cluster_network_attachment_prototype_cluster_network_interface_model['subnet'] = cluster_network_subnet_identity_model
+
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityById model
+ instance_cluster_network_attachment_before_prototype_model = {}
+ instance_cluster_network_attachment_before_prototype_model['id'] = '0717-fb880975-db45-4459-8548-64e3995ac213'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
+ cluster_network_interface = instance_cluster_network_attachment_prototype_cluster_network_interface_model
+ before = instance_cluster_network_attachment_before_prototype_model
+ name = 'my-instance-network-attachment'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "bare_metal_server_id": bare_metal_server_id,
+ "instance_id": instance_id,
+ "cluster_network_interface": cluster_network_interface,
}
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.create_cluster_network_attachment(**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_create_cluster_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_create_cluster_network_attachment_value_error.
_service.enable_retries()
- self.test_list_bare_metal_server_disks_value_error()
+ self.test_create_cluster_network_attachment_value_error()
- # Disable retries and run test_list_bare_metal_server_disks_value_error.
+ # Disable retries and run test_create_cluster_network_attachment_value_error.
_service.disable_retries()
- self.test_list_bare_metal_server_disks_value_error()
+ self.test_create_cluster_network_attachment_value_error()
-class TestGetBareMetalServerDisk:
+class TestDeleteInstanceClusterNetworkAttachment:
"""
- Test Class for get_bare_metal_server_disk
+ Test Class for delete_instance_cluster_network_attachment
"""
@responses.activate
- def test_get_bare_metal_server_disk_all_params(self):
+ def test_delete_instance_cluster_network_attachment_all_params(self):
"""
- get_bare_metal_server_disk()
+ delete_instance_cluster_network_attachment()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server_disk(
- bare_metal_server_id,
+ response = _service.delete_instance_cluster_network_attachment(
+ instance_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 202
- def test_get_bare_metal_server_disk_all_params_with_retries(self):
- # Enable retries and run test_get_bare_metal_server_disk_all_params.
+ def test_delete_instance_cluster_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_cluster_network_attachment_all_params.
_service.enable_retries()
- self.test_get_bare_metal_server_disk_all_params()
+ self.test_delete_instance_cluster_network_attachment_all_params()
- # Disable retries and run test_get_bare_metal_server_disk_all_params.
+ # Disable retries and run test_delete_instance_cluster_network_attachment_all_params.
_service.disable_retries()
- self.test_get_bare_metal_server_disk_all_params()
+ self.test_delete_instance_cluster_network_attachment_all_params()
@responses.activate
- def test_get_bare_metal_server_disk_value_error(self):
+ def test_delete_instance_cluster_network_attachment_value_error(self):
"""
- test_get_bare_metal_server_disk_value_error()
+ test_delete_instance_cluster_network_attachment_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.GET,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_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,
+ "instance_id": instance_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)
+ _service.delete_instance_cluster_network_attachment(**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_delete_instance_cluster_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_cluster_network_attachment_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_disk_value_error()
+ self.test_delete_instance_cluster_network_attachment_value_error()
- # Disable retries and run test_get_bare_metal_server_disk_value_error.
+ # Disable retries and run test_delete_instance_cluster_network_attachment_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_disk_value_error()
+ self.test_delete_instance_cluster_network_attachment_value_error()
-class TestUpdateBareMetalServerDisk:
+class TestGetInstanceClusterNetworkAttachment:
"""
- Test Class for update_bare_metal_server_disk
+ Test Class for get_instance_cluster_network_attachment
"""
@responses.activate
- def test_update_bare_metal_server_disk_all_params(self):
+ def test_get_instance_cluster_network_attachment_all_params(self):
"""
- update_bare_metal_server_disk()
+ get_instance_cluster_network_attachment()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.PATCH,
+ responses.GET,
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'
+ instance_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,
+ response = _service.get_instance_cluster_network_attachment(
+ instance_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.
+ def test_get_instance_cluster_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_cluster_network_attachment_all_params.
_service.enable_retries()
- self.test_update_bare_metal_server_disk_all_params()
+ self.test_get_instance_cluster_network_attachment_all_params()
- # Disable retries and run test_update_bare_metal_server_disk_all_params.
+ # Disable retries and run test_get_instance_cluster_network_attachment_all_params.
_service.disable_retries()
- self.test_update_bare_metal_server_disk_all_params()
+ self.test_get_instance_cluster_network_attachment_all_params()
@responses.activate
- def test_update_bare_metal_server_disk_value_error(self):
+ def test_get_instance_cluster_network_attachment_value_error(self):
"""
- test_update_bare_metal_server_disk_value_error()
+ test_get_instance_cluster_network_attachment_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.PATCH,
+ responses.GET,
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'
+ instance_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,
+ "instance_id": instance_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)
+ _service.get_instance_cluster_network_attachment(**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_get_instance_cluster_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_cluster_network_attachment_value_error.
_service.enable_retries()
- self.test_update_bare_metal_server_disk_value_error()
+ self.test_get_instance_cluster_network_attachment_value_error()
- # Disable retries and run test_update_bare_metal_server_disk_value_error.
+ # Disable retries and run test_get_instance_cluster_network_attachment_value_error.
_service.disable_retries()
- self.test_update_bare_metal_server_disk_value_error()
+ self.test_get_instance_cluster_network_attachment_value_error()
-class TestListBareMetalServerNetworkAttachments:
+class TestUpdateInstanceClusterNetworkAttachment:
"""
- Test Class for list_bare_metal_server_network_attachments
+ Test Class for update_instance_cluster_network_attachment
"""
@responses.activate
- def test_list_bare_metal_server_network_attachments_all_params(self):
+ def test_update_instance_cluster_network_attachment_all_params(self):
"""
- list_bare_metal_server_network_attachments()
+ update_instance_cluster_network_attachment()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Set up parameter values
- bare_metal_server_id = 'testString'
- start = 'testString'
- limit = 50
-
- # Invoke method
- response = _service.list_bare_metal_server_network_attachments(
- 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_attachments_all_params_with_retries(self):
- # Enable retries and run test_list_bare_metal_server_network_attachments_all_params.
- _service.enable_retries()
- self.test_list_bare_metal_server_network_attachments_all_params()
-
- # Disable retries and run test_list_bare_metal_server_network_attachments_all_params.
- _service.disable_retries()
- self.test_list_bare_metal_server_network_attachments_all_params()
-
- @responses.activate
- def test_list_bare_metal_server_network_attachments_required_params(self):
- """
- test_list_bare_metal_server_network_attachments_required_params()
- """
- # Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPatch model
+ instance_cluster_network_attachment_patch_model = {}
+ instance_cluster_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
+ id = 'testString'
+ instance_cluster_network_attachment_patch = instance_cluster_network_attachment_patch_model
# Invoke method
- response = _service.list_bare_metal_server_network_attachments(
- bare_metal_server_id,
+ response = _service.update_instance_cluster_network_attachment(
+ instance_id,
+ id,
+ instance_cluster_network_attachment_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 == instance_cluster_network_attachment_patch
- def test_list_bare_metal_server_network_attachments_required_params_with_retries(self):
- # Enable retries and run test_list_bare_metal_server_network_attachments_required_params.
+ def test_update_instance_cluster_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_cluster_network_attachment_all_params.
_service.enable_retries()
- self.test_list_bare_metal_server_network_attachments_required_params()
+ self.test_update_instance_cluster_network_attachment_all_params()
- # Disable retries and run test_list_bare_metal_server_network_attachments_required_params.
+ # Disable retries and run test_update_instance_cluster_network_attachment_all_params.
_service.disable_retries()
- self.test_list_bare_metal_server_network_attachments_required_params()
+ self.test_update_instance_cluster_network_attachment_all_params()
@responses.activate
- def test_list_bare_metal_server_network_attachments_value_error(self):
+ def test_update_instance_cluster_network_attachment_value_error(self):
"""
- test_list_bare_metal_server_network_attachments_value_error()
+ test_update_instance_cluster_network_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString/cluster_network_attachments/testString')
+ mock_response = '{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a InstanceClusterNetworkAttachmentPatch model
+ instance_cluster_network_attachment_patch_model = {}
+ instance_cluster_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
+ id = 'testString'
+ instance_cluster_network_attachment_patch = instance_cluster_network_attachment_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,
+ "instance_id": instance_id,
+ "id": id,
+ "instance_cluster_network_attachment_patch": instance_cluster_network_attachment_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_server_network_attachments(**req_copy)
+ _service.update_instance_cluster_network_attachment(**req_copy)
- def test_list_bare_metal_server_network_attachments_value_error_with_retries(self):
- # Enable retries and run test_list_bare_metal_server_network_attachments_value_error.
+ def test_update_instance_cluster_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_cluster_network_attachment_value_error.
_service.enable_retries()
- self.test_list_bare_metal_server_network_attachments_value_error()
+ self.test_update_instance_cluster_network_attachment_value_error()
- # Disable retries and run test_list_bare_metal_server_network_attachments_value_error.
+ # Disable retries and run test_update_instance_cluster_network_attachment_value_error.
_service.disable_retries()
- self.test_list_bare_metal_server_network_attachments_value_error()
-
- @responses.activate
- def test_list_bare_metal_server_network_attachments_with_pager_get_next(self):
- """
- test_list_bare_metal_server_network_attachments_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = BareMetalServerNetworkAttachmentsPager(
- client=_service,
- bare_metal_server_id='testString',
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_bare_metal_server_network_attachments_with_pager_get_all(self):
- """
- test_list_bare_metal_server_network_attachments_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = BareMetalServerNetworkAttachmentsPager(
- client=_service,
- bare_metal_server_id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_update_instance_cluster_network_attachment_value_error()
-class TestCreateBareMetalServerNetworkAttachment:
+class TestCreateInstanceConsoleAccessToken:
"""
- Test Class for create_bare_metal_server_network_attachment
+ Test Class for create_instance_console_access_token
"""
@responses.activate
- def test_create_bare_metal_server_network_attachment_all_params(self):
+ def test_create_instance_console_access_token_all_params(self):
"""
- create_bare_metal_server_network_attachment()
+ create_instance_console_access_token()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
+ url = preprocess_url('/instances/testString/console_access_token')
+ mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
responses.add(
responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
- bare_metal_server_network_attachment_prototype_model = {}
- bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
- bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
- bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
-
# Set up parameter values
- bare_metal_server_id = 'testString'
- bare_metal_server_network_attachment_prototype = bare_metal_server_network_attachment_prototype_model
+ instance_id = 'testString'
+ console_type = 'serial'
+ force = False
# Invoke method
- response = _service.create_bare_metal_server_network_attachment(
- bare_metal_server_id,
- bare_metal_server_network_attachment_prototype,
+ response = _service.create_instance_console_access_token(
+ instance_id,
+ console_type,
+ force=force,
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 == bare_metal_server_network_attachment_prototype
+ assert req_body['console_type'] == 'serial'
+ assert req_body['force'] == False
- def test_create_bare_metal_server_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_create_bare_metal_server_network_attachment_all_params.
+ def test_create_instance_console_access_token_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_console_access_token_all_params.
_service.enable_retries()
- self.test_create_bare_metal_server_network_attachment_all_params()
+ self.test_create_instance_console_access_token_all_params()
- # Disable retries and run test_create_bare_metal_server_network_attachment_all_params.
+ # Disable retries and run test_create_instance_console_access_token_all_params.
_service.disable_retries()
- self.test_create_bare_metal_server_network_attachment_all_params()
+ self.test_create_instance_console_access_token_all_params()
@responses.activate
- def test_create_bare_metal_server_network_attachment_value_error(self):
+ def test_create_instance_console_access_token_value_error(self):
"""
- test_create_bare_metal_server_network_attachment_value_error()
+ test_create_instance_console_access_token_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
+ url = preprocess_url('/instances/testString/console_access_token')
+ mock_response = '{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "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/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}'
responses.add(
- responses.POST,
- url,
- body=mock_response,
- content_type='application/json',
- status=201,
- )
-
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model = {}
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
- bare_metal_server_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPCIPrototype model
- bare_metal_server_network_attachment_prototype_model = {}
- bare_metal_server_network_attachment_prototype_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_network_attachment_prototype_model['virtual_network_interface'] = bare_metal_server_network_attachment_prototype_virtual_network_interface_model
- bare_metal_server_network_attachment_prototype_model['allowed_vlans'] = []
- bare_metal_server_network_attachment_prototype_model['interface_type'] = 'pci'
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
# Set up parameter values
- bare_metal_server_id = 'testString'
- bare_metal_server_network_attachment_prototype = bare_metal_server_network_attachment_prototype_model
+ instance_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,
- "bare_metal_server_network_attachment_prototype": bare_metal_server_network_attachment_prototype,
+ "instance_id": instance_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_network_attachment(**req_copy)
+ _service.create_instance_console_access_token(**req_copy)
- def test_create_bare_metal_server_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_create_bare_metal_server_network_attachment_value_error.
+ def test_create_instance_console_access_token_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_console_access_token_value_error.
_service.enable_retries()
- self.test_create_bare_metal_server_network_attachment_value_error()
+ self.test_create_instance_console_access_token_value_error()
- # Disable retries and run test_create_bare_metal_server_network_attachment_value_error.
+ # Disable retries and run test_create_instance_console_access_token_value_error.
_service.disable_retries()
- self.test_create_bare_metal_server_network_attachment_value_error()
+ self.test_create_instance_console_access_token_value_error()
-class TestDeleteBareMetalServerNetworkAttachment:
+class TestListInstanceDisks:
"""
- Test Class for delete_bare_metal_server_network_attachment
+ Test Class for list_instance_disks
"""
@responses.activate
- def test_delete_bare_metal_server_network_attachment_all_params(self):
+ def test_list_instance_disks_all_params(self):
"""
- delete_bare_metal_server_network_attachment()
+ list_instance_disks()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
+ url = preprocess_url('/instances/testString/disks')
+ mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- bare_metal_server_id = 'testString'
- id = 'testString'
+ instance_id = 'testString'
# Invoke method
- response = _service.delete_bare_metal_server_network_attachment(
- bare_metal_server_id,
- id,
+ response = _service.list_instance_disks(
+ instance_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_bare_metal_server_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_delete_bare_metal_server_network_attachment_all_params.
+ def test_list_instance_disks_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_disks_all_params.
_service.enable_retries()
- self.test_delete_bare_metal_server_network_attachment_all_params()
+ self.test_list_instance_disks_all_params()
- # Disable retries and run test_delete_bare_metal_server_network_attachment_all_params.
+ # Disable retries and run test_list_instance_disks_all_params.
_service.disable_retries()
- self.test_delete_bare_metal_server_network_attachment_all_params()
+ self.test_list_instance_disks_all_params()
@responses.activate
- def test_delete_bare_metal_server_network_attachment_value_error(self):
+ def test_list_instance_disks_value_error(self):
"""
- test_delete_bare_metal_server_network_attachment_value_error()
+ test_list_instance_disks_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
+ url = preprocess_url('/instances/testString/disks')
+ mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- bare_metal_server_id = 'testString'
- id = 'testString'
+ instance_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,
+ "instance_id": instance_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_attachment(**req_copy)
+ _service.list_instance_disks(**req_copy)
- def test_delete_bare_metal_server_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_delete_bare_metal_server_network_attachment_value_error.
+ def test_list_instance_disks_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_disks_value_error.
_service.enable_retries()
- self.test_delete_bare_metal_server_network_attachment_value_error()
+ self.test_list_instance_disks_value_error()
- # Disable retries and run test_delete_bare_metal_server_network_attachment_value_error.
+ # Disable retries and run test_list_instance_disks_value_error.
_service.disable_retries()
- self.test_delete_bare_metal_server_network_attachment_value_error()
+ self.test_list_instance_disks_value_error()
-class TestGetBareMetalServerNetworkAttachment:
+class TestGetInstanceDisk:
"""
- Test Class for get_bare_metal_server_network_attachment
+ Test Class for get_instance_disk
"""
@responses.activate
- def test_get_bare_metal_server_network_attachment_all_params(self):
+ def test_get_instance_disk_all_params(self):
"""
- get_bare_metal_server_network_attachment()
+ get_instance_disk()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
+ url = preprocess_url('/instances/testString/disks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
responses.add(
responses.GET,
url,
@@ -21782,12 +21897,12 @@ def test_get_bare_metal_server_network_attachment_all_params(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server_network_attachment(
- bare_metal_server_id,
+ response = _service.get_instance_disk(
+ instance_id,
id,
headers={},
)
@@ -21796,23 +21911,23 @@ def test_get_bare_metal_server_network_attachment_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_bare_metal_server_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_get_bare_metal_server_network_attachment_all_params.
+ def test_get_instance_disk_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_disk_all_params.
_service.enable_retries()
- self.test_get_bare_metal_server_network_attachment_all_params()
+ self.test_get_instance_disk_all_params()
- # Disable retries and run test_get_bare_metal_server_network_attachment_all_params.
+ # Disable retries and run test_get_instance_disk_all_params.
_service.disable_retries()
- self.test_get_bare_metal_server_network_attachment_all_params()
+ self.test_get_instance_disk_all_params()
@responses.activate
- def test_get_bare_metal_server_network_attachment_value_error(self):
+ def test_get_instance_disk_value_error(self):
"""
- test_get_bare_metal_server_network_attachment_value_error()
+ test_get_instance_disk_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
+ url = preprocess_url('/instances/testString/disks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
responses.add(
responses.GET,
url,
@@ -21822,42 +21937,42 @@ def test_get_bare_metal_server_network_attachment_value_error(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_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,
+ "instance_id": instance_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_attachment(**req_copy)
+ _service.get_instance_disk(**req_copy)
- def test_get_bare_metal_server_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_get_bare_metal_server_network_attachment_value_error.
+ def test_get_instance_disk_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_disk_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_network_attachment_value_error()
+ self.test_get_instance_disk_value_error()
- # Disable retries and run test_get_bare_metal_server_network_attachment_value_error.
+ # Disable retries and run test_get_instance_disk_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_network_attachment_value_error()
+ self.test_get_instance_disk_value_error()
-class TestUpdateBareMetalServerNetworkAttachment:
+class TestUpdateInstanceDisk:
"""
- Test Class for update_bare_metal_server_network_attachment
+ Test Class for update_instance_disk
"""
@responses.activate
- def test_update_bare_metal_server_network_attachment_all_params(self):
+ def test_update_instance_disk_all_params(self):
"""
- update_bare_metal_server_network_attachment()
+ update_instance_disk()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
+ url = preprocess_url('/instances/testString/disks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
responses.add(
responses.PATCH,
url,
@@ -21866,21 +21981,20 @@ def test_update_bare_metal_server_network_attachment_all_params(self):
status=200,
)
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPatch model
- bare_metal_server_network_attachment_patch_model = {}
- bare_metal_server_network_attachment_patch_model['allowed_vlans'] = [4]
- bare_metal_server_network_attachment_patch_model['name'] = 'my-bare-metal-server-network-attachment-updated'
+ # Construct a dict representation of a InstanceDiskPatch model
+ instance_disk_patch_model = {}
+ instance_disk_patch_model['name'] = 'my-instance-disk-updated'
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
- bare_metal_server_network_attachment_patch = bare_metal_server_network_attachment_patch_model
+ instance_disk_patch = instance_disk_patch_model
# Invoke method
- response = _service.update_bare_metal_server_network_attachment(
- bare_metal_server_id,
+ response = _service.update_instance_disk(
+ instance_id,
id,
- bare_metal_server_network_attachment_patch,
+ instance_disk_patch,
headers={},
)
@@ -21889,25 +22003,25 @@ def test_update_bare_metal_server_network_attachment_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_attachment_patch
+ assert req_body == instance_disk_patch
- def test_update_bare_metal_server_network_attachment_all_params_with_retries(self):
- # Enable retries and run test_update_bare_metal_server_network_attachment_all_params.
+ def test_update_instance_disk_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_disk_all_params.
_service.enable_retries()
- self.test_update_bare_metal_server_network_attachment_all_params()
+ self.test_update_instance_disk_all_params()
- # Disable retries and run test_update_bare_metal_server_network_attachment_all_params.
+ # Disable retries and run test_update_instance_disk_all_params.
_service.disable_retries()
- self.test_update_bare_metal_server_network_attachment_all_params()
+ self.test_update_instance_disk_all_params()
@responses.activate
- def test_update_bare_metal_server_network_attachment_value_error(self):
+ def test_update_instance_disk_value_error(self):
"""
- test_update_bare_metal_server_network_attachment_value_error()
+ test_update_instance_disk_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_attachments/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}'
+ url = preprocess_url('/instances/testString/disks/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}'
responses.add(
responses.PATCH,
url,
@@ -21916,97 +22030,49 @@ def test_update_bare_metal_server_network_attachment_value_error(self):
status=200,
)
- # Construct a dict representation of a BareMetalServerNetworkAttachmentPatch model
- bare_metal_server_network_attachment_patch_model = {}
- bare_metal_server_network_attachment_patch_model['allowed_vlans'] = [4]
- bare_metal_server_network_attachment_patch_model['name'] = 'my-bare-metal-server-network-attachment-updated'
+ # Construct a dict representation of a InstanceDiskPatch model
+ instance_disk_patch_model = {}
+ instance_disk_patch_model['name'] = 'my-instance-disk-updated'
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
- bare_metal_server_network_attachment_patch = bare_metal_server_network_attachment_patch_model
+ instance_disk_patch = instance_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,
+ "instance_id": instance_id,
"id": id,
- "bare_metal_server_network_attachment_patch": bare_metal_server_network_attachment_patch,
+ "instance_disk_patch": instance_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_network_attachment(**req_copy)
+ _service.update_instance_disk(**req_copy)
- def test_update_bare_metal_server_network_attachment_value_error_with_retries(self):
- # Enable retries and run test_update_bare_metal_server_network_attachment_value_error.
+ def test_update_instance_disk_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_disk_value_error.
_service.enable_retries()
- self.test_update_bare_metal_server_network_attachment_value_error()
+ self.test_update_instance_disk_value_error()
- # Disable retries and run test_update_bare_metal_server_network_attachment_value_error.
+ # Disable retries and run test_update_instance_disk_value_error.
_service.disable_retries()
- self.test_update_bare_metal_server_network_attachment_value_error()
+ self.test_update_instance_disk_value_error()
-class TestListBareMetalServerNetworkInterfaces:
+class TestListInstanceNetworkAttachments:
"""
- Test Class for list_bare_metal_server_network_interfaces
+ Test Class for list_instance_network_attachments
"""
@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": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "href"}, "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 = 50
-
- # 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):
+ def test_list_instance_network_attachments_all_params(self):
"""
- test_list_bare_metal_server_network_interfaces_required_params()
+ list_instance_network_attachments()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces')
- mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString/network_attachments')
+ mock_response = '{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}'
responses.add(
responses.GET,
url,
@@ -22016,11 +22082,11 @@ def test_list_bare_metal_server_network_interfaces_required_params(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
# Invoke method
- response = _service.list_bare_metal_server_network_interfaces(
- bare_metal_server_id,
+ response = _service.list_instance_network_attachments(
+ instance_id,
headers={},
)
@@ -22028,23 +22094,23 @@ def test_list_bare_metal_server_network_interfaces_required_params(self):
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.
+ def test_list_instance_network_attachments_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_network_attachments_all_params.
_service.enable_retries()
- self.test_list_bare_metal_server_network_interfaces_required_params()
+ self.test_list_instance_network_attachments_all_params()
- # Disable retries and run test_list_bare_metal_server_network_interfaces_required_params.
+ # Disable retries and run test_list_instance_network_attachments_all_params.
_service.disable_retries()
- self.test_list_bare_metal_server_network_interfaces_required_params()
+ self.test_list_instance_network_attachments_all_params()
@responses.activate
- def test_list_bare_metal_server_network_interfaces_value_error(self):
+ def test_list_instance_network_attachments_value_error(self):
"""
- test_list_bare_metal_server_network_interfaces_value_error()
+ test_list_instance_network_attachments_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces')
- mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString/network_attachments')
+ mock_response = '{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}'
responses.add(
responses.GET,
url,
@@ -22054,111 +22120,40 @@ def test_list_bare_metal_server_network_interfaces_value_error(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_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,
+ "instance_id": instance_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_instance_network_attachments(**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_instance_network_attachments_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_network_attachments_value_error.
_service.enable_retries()
- self.test_list_bare_metal_server_network_interfaces_value_error()
+ self.test_list_instance_network_attachments_value_error()
- # Disable retries and run test_list_bare_metal_server_network_interfaces_value_error.
+ # Disable retries and run test_list_instance_network_attachments_value_error.
_service.disable_retries()
- self.test_list_bare_metal_server_network_interfaces_value_error()
-
- @responses.activate
- def test_list_bare_metal_server_network_interfaces_with_pager_get_next(self):
- """
- test_list_bare_metal_server_network_interfaces_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = BareMetalServerNetworkInterfacesPager(
- client=_service,
- bare_metal_server_id='testString',
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_bare_metal_server_network_interfaces_with_pager_get_all(self):
- """
- test_list_bare_metal_server_network_interfaces_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = BareMetalServerNetworkInterfacesPager(
- client=_service,
- bare_metal_server_id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_list_instance_network_attachments_value_error()
-class TestCreateBareMetalServerNetworkInterface:
+class TestCreateInstanceNetworkAttachment:
"""
- Test Class for create_bare_metal_server_network_interface
+ Test Class for create_instance_network_attachment
"""
@responses.activate
- def test_create_bare_metal_server_network_interface_all_params(self):
+ def test_create_instance_network_attachment_all_params(self):
"""
- create_bare_metal_server_network_interface()
+ create_instance_network_attachment()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
+ url = preprocess_url('/instances/testString/network_attachments')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
responses.add(
responses.POST,
url,
@@ -22167,11 +22162,21 @@ def test_create_bare_metal_server_network_interface_all_params(self):
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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.7'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # 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 = {}
@@ -22181,24 +22186,29 @@ def test_create_bare_metal_server_network_interface_all_params(self):
subnet_identity_model = {}
subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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-bare-metal-server-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['interface_type'] = 'hipersocket'
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
+ instance_network_attachment_prototype_virtual_network_interface_model = {}
+ instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
# Set up parameter values
- bare_metal_server_id = 'testString'
- bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model
+ instance_id = 'testString'
+ virtual_network_interface = instance_network_attachment_prototype_virtual_network_interface_model
+ name = 'testString'
# Invoke method
- response = _service.create_bare_metal_server_network_interface(
- bare_metal_server_id,
- bare_metal_server_network_interface_prototype,
+ response = _service.create_instance_network_attachment(
+ instance_id,
+ virtual_network_interface,
+ name=name,
headers={},
)
@@ -22207,25 +22217,26 @@ 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['virtual_network_interface'] == instance_network_attachment_prototype_virtual_network_interface_model
+ assert req_body['name'] == 'testString'
- 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_instance_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_network_attachment_all_params.
_service.enable_retries()
- self.test_create_bare_metal_server_network_interface_all_params()
+ self.test_create_instance_network_attachment_all_params()
- # Disable retries and run test_create_bare_metal_server_network_interface_all_params.
+ # Disable retries and run test_create_instance_network_attachment_all_params.
_service.disable_retries()
- self.test_create_bare_metal_server_network_interface_all_params()
+ self.test_create_instance_network_attachment_all_params()
@responses.activate
- def test_create_bare_metal_server_network_interface_value_error(self):
+ def test_create_instance_network_attachment_value_error(self):
"""
- test_create_bare_metal_server_network_interface_value_error()
+ test_create_instance_network_attachment_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
+ url = preprocess_url('/instances/testString/network_attachments')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
responses.add(
responses.POST,
url,
@@ -22234,146 +22245,160 @@ def test_create_bare_metal_server_network_interface_value_error(self):
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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.7'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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-bare-metal-server-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['interface_type'] = 'hipersocket'
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model
+ instance_network_attachment_prototype_virtual_network_interface_model = {}
+ instance_network_attachment_prototype_virtual_network_interface_model['allow_ip_spoofing'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['auto_delete'] = False
+ instance_network_attachment_prototype_virtual_network_interface_model['enable_infrastructure_nat'] = True
+ instance_network_attachment_prototype_virtual_network_interface_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['name'] = 'my-virtual-network-interface'
+ instance_network_attachment_prototype_virtual_network_interface_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ instance_network_attachment_prototype_virtual_network_interface_model['protocol_state_filtering_mode'] = 'auto'
+ instance_network_attachment_prototype_virtual_network_interface_model['resource_group'] = resource_group_identity_model
+ instance_network_attachment_prototype_virtual_network_interface_model['security_groups'] = [security_group_identity_model]
+ instance_network_attachment_prototype_virtual_network_interface_model['subnet'] = subnet_identity_model
# Set up parameter values
- bare_metal_server_id = 'testString'
- bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model
+ instance_id = 'testString'
+ virtual_network_interface = instance_network_attachment_prototype_virtual_network_interface_model
+ name = 'testString'
# 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,
+ "instance_id": instance_id,
+ "virtual_network_interface": virtual_network_interface,
}
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_instance_network_attachment(**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_instance_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_network_attachment_value_error.
_service.enable_retries()
- self.test_create_bare_metal_server_network_interface_value_error()
+ self.test_create_instance_network_attachment_value_error()
- # Disable retries and run test_create_bare_metal_server_network_interface_value_error.
+ # Disable retries and run test_create_instance_network_attachment_value_error.
_service.disable_retries()
- self.test_create_bare_metal_server_network_interface_value_error()
+ self.test_create_instance_network_attachment_value_error()
-class TestDeleteBareMetalServerNetworkInterface:
+class TestDeleteInstanceNetworkAttachment:
"""
- Test Class for delete_bare_metal_server_network_interface
+ Test Class for delete_instance_network_attachment
"""
@responses.activate
- def test_delete_bare_metal_server_network_interface_all_params(self):
+ def test_delete_instance_network_attachment_all_params(self):
"""
- delete_bare_metal_server_network_interface()
+ delete_instance_network_attachment()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString')
+ url = preprocess_url('/instances/testString/network_attachments/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_bare_metal_server_network_interface(
- bare_metal_server_id,
+ response = _service.delete_instance_network_attachment(
+ instance_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_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_instance_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_network_attachment_all_params.
_service.enable_retries()
- self.test_delete_bare_metal_server_network_interface_all_params()
+ self.test_delete_instance_network_attachment_all_params()
- # Disable retries and run test_delete_bare_metal_server_network_interface_all_params.
+ # Disable retries and run test_delete_instance_network_attachment_all_params.
_service.disable_retries()
- self.test_delete_bare_metal_server_network_interface_all_params()
+ self.test_delete_instance_network_attachment_all_params()
@responses.activate
- def test_delete_bare_metal_server_network_interface_value_error(self):
+ def test_delete_instance_network_attachment_value_error(self):
"""
- test_delete_bare_metal_server_network_interface_value_error()
+ test_delete_instance_network_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString')
+ url = preprocess_url('/instances/testString/network_attachments/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_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,
+ "instance_id": instance_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_instance_network_attachment(**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_instance_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_network_attachment_value_error.
_service.enable_retries()
- self.test_delete_bare_metal_server_network_interface_value_error()
+ self.test_delete_instance_network_attachment_value_error()
- # Disable retries and run test_delete_bare_metal_server_network_interface_value_error.
+ # Disable retries and run test_delete_instance_network_attachment_value_error.
_service.disable_retries()
- self.test_delete_bare_metal_server_network_interface_value_error()
+ self.test_delete_instance_network_attachment_value_error()
-class TestGetBareMetalServerNetworkInterface:
+class TestGetInstanceNetworkAttachment:
"""
- Test Class for get_bare_metal_server_network_interface
+ Test Class for get_instance_network_attachment
"""
@responses.activate
- def test_get_bare_metal_server_network_interface_all_params(self):
+ def test_get_instance_network_attachment_all_params(self):
"""
- get_bare_metal_server_network_interface()
+ get_instance_network_attachment()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
+ url = preprocess_url('/instances/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
responses.add(
responses.GET,
url,
@@ -22383,12 +22408,12 @@ def test_get_bare_metal_server_network_interface_all_params(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server_network_interface(
- bare_metal_server_id,
+ response = _service.get_instance_network_attachment(
+ instance_id,
id,
headers={},
)
@@ -22397,23 +22422,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_instance_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_network_attachment_all_params.
_service.enable_retries()
- self.test_get_bare_metal_server_network_interface_all_params()
+ self.test_get_instance_network_attachment_all_params()
- # Disable retries and run test_get_bare_metal_server_network_interface_all_params.
+ # Disable retries and run test_get_instance_network_attachment_all_params.
_service.disable_retries()
- self.test_get_bare_metal_server_network_interface_all_params()
+ self.test_get_instance_network_attachment_all_params()
@responses.activate
- def test_get_bare_metal_server_network_interface_value_error(self):
+ def test_get_instance_network_attachment_value_error(self):
"""
- test_get_bare_metal_server_network_interface_value_error()
+ test_get_instance_network_attachment_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
+ url = preprocess_url('/instances/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
responses.add(
responses.GET,
url,
@@ -22423,42 +22448,42 @@ def test_get_bare_metal_server_network_interface_value_error(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_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,
+ "instance_id": instance_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_instance_network_attachment(**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_instance_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_network_attachment_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_network_interface_value_error()
+ self.test_get_instance_network_attachment_value_error()
- # Disable retries and run test_get_bare_metal_server_network_interface_value_error.
+ # Disable retries and run test_get_instance_network_attachment_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_network_interface_value_error()
+ self.test_get_instance_network_attachment_value_error()
-class TestUpdateBareMetalServerNetworkInterface:
+class TestUpdateInstanceNetworkAttachment:
"""
- Test Class for update_bare_metal_server_network_interface
+ Test Class for update_instance_network_attachment
"""
@responses.activate
- def test_update_bare_metal_server_network_interface_all_params(self):
+ def test_update_instance_network_attachment_all_params(self):
"""
- update_bare_metal_server_network_interface()
+ update_instance_network_attachment()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
+ url = preprocess_url('/instances/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
responses.add(
responses.PATCH,
url,
@@ -22467,23 +22492,20 @@ def test_update_bare_metal_server_network_interface_all_params(self):
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-bare-metal-server-network-interface'
+ # Construct a dict representation of a InstanceNetworkAttachmentPatch model
+ instance_network_attachment_patch_model = {}
+ instance_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
- bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model
+ instance_network_attachment_patch = instance_network_attachment_patch_model
# Invoke method
- response = _service.update_bare_metal_server_network_interface(
- bare_metal_server_id,
+ response = _service.update_instance_network_attachment(
+ instance_id,
id,
- bare_metal_server_network_interface_patch,
+ instance_network_attachment_patch,
headers={},
)
@@ -22492,25 +22514,25 @@ 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 == instance_network_attachment_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_instance_network_attachment_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_network_attachment_all_params.
_service.enable_retries()
- self.test_update_bare_metal_server_network_interface_all_params()
+ self.test_update_instance_network_attachment_all_params()
- # Disable retries and run test_update_bare_metal_server_network_interface_all_params.
+ # Disable retries and run test_update_instance_network_attachment_all_params.
_service.disable_retries()
- self.test_update_bare_metal_server_network_interface_all_params()
+ self.test_update_instance_network_attachment_all_params()
@responses.activate
- def test_update_bare_metal_server_network_interface_value_error(self):
+ def test_update_instance_network_attachment_value_error(self):
"""
- test_update_bare_metal_server_network_interface_value_error()
+ test_update_instance_network_attachment_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}'
+ url = preprocess_url('/instances/testString/network_attachments/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}'
responses.add(
responses.PATCH,
url,
@@ -22519,52 +22541,49 @@ def test_update_bare_metal_server_network_interface_value_error(self):
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-bare-metal-server-network-interface'
+ # Construct a dict representation of a InstanceNetworkAttachmentPatch model
+ instance_network_attachment_patch_model = {}
+ instance_network_attachment_patch_model['name'] = 'my-instance-network-attachment-updated'
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
id = 'testString'
- bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model
+ instance_network_attachment_patch = instance_network_attachment_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,
+ "instance_id": instance_id,
"id": id,
- "bare_metal_server_network_interface_patch": bare_metal_server_network_interface_patch,
+ "instance_network_attachment_patch": instance_network_attachment_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_instance_network_attachment(**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_instance_network_attachment_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_network_attachment_value_error.
_service.enable_retries()
- self.test_update_bare_metal_server_network_interface_value_error()
+ self.test_update_instance_network_attachment_value_error()
- # Disable retries and run test_update_bare_metal_server_network_interface_value_error.
+ # Disable retries and run test_update_instance_network_attachment_value_error.
_service.disable_retries()
- self.test_update_bare_metal_server_network_interface_value_error()
+ self.test_update_instance_network_attachment_value_error()
-class TestListBareMetalServerNetworkInterfaceFloatingIps:
+class TestListInstanceNetworkInterfaces:
"""
- Test Class for list_bare_metal_server_network_interface_floating_ips
+ Test Class for list_instance_network_interfaces
"""
@responses.activate
- def test_list_bare_metal_server_network_interface_floating_ips_all_params(self):
+ def test_list_instance_network_interfaces_all_params(self):
"""
- list_bare_metal_server_network_interface_floating_ips()
+ list_instance_network_interfaces()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/instances/testString/network_interfaces')
+ mock_response = '{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}'
responses.add(
responses.GET,
url,
@@ -22574,13 +22593,11 @@ def test_list_bare_metal_server_network_interface_floating_ips_all_params(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
- network_interface_id = 'testString'
+ instance_id = 'testString'
# Invoke method
- response = _service.list_bare_metal_server_network_interface_floating_ips(
- bare_metal_server_id,
- network_interface_id,
+ response = _service.list_instance_network_interfaces(
+ instance_id,
headers={},
)
@@ -22588,23 +22605,23 @@ def test_list_bare_metal_server_network_interface_floating_ips_all_params(self):
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.
+ def test_list_instance_network_interfaces_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_network_interfaces_all_params.
_service.enable_retries()
- self.test_list_bare_metal_server_network_interface_floating_ips_all_params()
+ self.test_list_instance_network_interfaces_all_params()
- # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_all_params.
+ # Disable retries and run test_list_instance_network_interfaces_all_params.
_service.disable_retries()
- self.test_list_bare_metal_server_network_interface_floating_ips_all_params()
+ self.test_list_instance_network_interfaces_all_params()
@responses.activate
- def test_list_bare_metal_server_network_interface_floating_ips_value_error(self):
+ def test_list_instance_network_interfaces_value_error(self):
"""
- test_list_bare_metal_server_network_interface_floating_ips_value_error()
+ test_list_instance_network_interfaces_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/instances/testString/network_interfaces')
+ mock_response = '{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}'
responses.add(
responses.GET,
url,
@@ -22614,388 +22631,438 @@ def test_list_bare_metal_server_network_interface_floating_ips_value_error(self)
)
# Set up parameter values
- bare_metal_server_id = 'testString'
- network_interface_id = 'testString'
+ instance_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,
+ "instance_id": instance_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_instance_network_interfaces(**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_instance_network_interfaces_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_network_interfaces_value_error.
_service.enable_retries()
- self.test_list_bare_metal_server_network_interface_floating_ips_value_error()
+ self.test_list_instance_network_interfaces_value_error()
- # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_value_error.
+ # Disable retries and run test_list_instance_network_interfaces_value_error.
_service.disable_retries()
- self.test_list_bare_metal_server_network_interface_floating_ips_value_error()
+ self.test_list_instance_network_interfaces_value_error()
-class TestRemoveBareMetalServerNetworkInterfaceFloatingIp:
+class TestCreateInstanceNetworkInterface:
"""
- Test Class for remove_bare_metal_server_network_interface_floating_ip
+ Test Class for create_instance_network_interface
"""
@responses.activate
- def test_remove_bare_metal_server_network_interface_floating_ip_all_params(self):
+ def test_create_instance_network_interface_all_params(self):
"""
- remove_bare_metal_server_network_interface_floating_ip()
+ create_instance_network_interface()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString')
+ url = preprocess_url('/instances/testString/network_interfaces')
+ mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
- network_interface_id = 'testString'
- id = 'testString'
+ instance_id = 'testString'
+ subnet = subnet_identity_model
+ allow_ip_spoofing = True
+ name = 'my-instance-network-interface'
+ primary_ip = network_interface_ip_prototype_model
+ security_groups = [security_group_identity_model]
# Invoke method
- response = _service.remove_bare_metal_server_network_interface_floating_ip(
- bare_metal_server_id,
- network_interface_id,
- id,
+ response = _service.create_instance_network_interface(
+ instance_id,
+ subnet,
+ allow_ip_spoofing=allow_ip_spoofing,
+ name=name,
+ primary_ip=primary_ip,
+ security_groups=security_groups,
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['subnet'] == subnet_identity_model
+ assert req_body['allow_ip_spoofing'] == True
+ assert req_body['name'] == 'my-instance-network-interface'
+ assert req_body['primary_ip'] == network_interface_ip_prototype_model
+ assert req_body['security_groups'] == [security_group_identity_model]
- 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_create_instance_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_network_interface_all_params.
_service.enable_retries()
- self.test_remove_bare_metal_server_network_interface_floating_ip_all_params()
+ self.test_create_instance_network_interface_all_params()
- # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_all_params.
+ # Disable retries and run test_create_instance_network_interface_all_params.
_service.disable_retries()
- self.test_remove_bare_metal_server_network_interface_floating_ip_all_params()
+ self.test_create_instance_network_interface_all_params()
@responses.activate
- def test_remove_bare_metal_server_network_interface_floating_ip_value_error(self):
+ def test_create_instance_network_interface_value_error(self):
"""
- test_remove_bare_metal_server_network_interface_floating_ip_value_error()
+ test_create_instance_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString')
+ url = preprocess_url('/instances/testString/network_interfaces')
+ mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
- network_interface_id = 'testString'
- id = 'testString'
+ instance_id = 'testString'
+ subnet = subnet_identity_model
+ allow_ip_spoofing = True
+ name = 'my-instance-network-interface'
+ primary_ip = network_interface_ip_prototype_model
+ security_groups = [security_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,
- "network_interface_id": network_interface_id,
- "id": id,
+ "instance_id": instance_id,
+ "subnet": subnet,
}
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)
+ _service.create_instance_network_interface(**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.
+ def test_create_instance_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_network_interface_value_error.
_service.enable_retries()
- self.test_remove_bare_metal_server_network_interface_floating_ip_value_error()
+ self.test_create_instance_network_interface_value_error()
- # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_value_error.
+ # Disable retries and run test_create_instance_network_interface_value_error.
_service.disable_retries()
- self.test_remove_bare_metal_server_network_interface_floating_ip_value_error()
+ self.test_create_instance_network_interface_value_error()
-class TestGetBareMetalServerNetworkInterfaceFloatingIp:
+class TestDeleteInstanceNetworkInterface:
"""
- Test Class for get_bare_metal_server_network_interface_floating_ip
+ Test Class for delete_instance_network_interface
"""
@responses.activate
- def test_get_bare_metal_server_network_interface_floating_ip_all_params(self):
+ def test_delete_instance_network_interface_all_params(self):
"""
- get_bare_metal_server_network_interface_floating_ip()
+ delete_instance_network_interface()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/instances/testString/network_interfaces/testString')
responses.add(
- responses.GET,
+ 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'
+ instance_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_instance_network_interface(
+ instance_id,
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_instance_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_network_interface_all_params.
_service.enable_retries()
- self.test_get_bare_metal_server_network_interface_floating_ip_all_params()
+ self.test_delete_instance_network_interface_all_params()
- # Disable retries and run test_get_bare_metal_server_network_interface_floating_ip_all_params.
+ # Disable retries and run test_delete_instance_network_interface_all_params.
_service.disable_retries()
- self.test_get_bare_metal_server_network_interface_floating_ip_all_params()
+ self.test_delete_instance_network_interface_all_params()
@responses.activate
- def test_get_bare_metal_server_network_interface_floating_ip_value_error(self):
+ def test_delete_instance_network_interface_value_error(self):
"""
- test_get_bare_metal_server_network_interface_floating_ip_value_error()
+ test_delete_instance_network_interface_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/instances/testString/network_interfaces/testString')
responses.add(
- responses.GET,
+ 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'
+ instance_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,
+ "instance_id": instance_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_instance_network_interface(**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_instance_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_network_interface_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_network_interface_floating_ip_value_error()
+ self.test_delete_instance_network_interface_value_error()
- # Disable retries and run test_get_bare_metal_server_network_interface_floating_ip_value_error.
+ # Disable retries and run test_delete_instance_network_interface_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_network_interface_floating_ip_value_error()
+ self.test_delete_instance_network_interface_value_error()
-class TestAddBareMetalServerNetworkInterfaceFloatingIp:
+class TestGetInstanceNetworkInterface:
"""
- Test Class for add_bare_metal_server_network_interface_floating_ip
+ Test Class for get_instance_network_interface
"""
@responses.activate
- def test_add_bare_metal_server_network_interface_floating_ip_all_params(self):
+ def test_get_instance_network_interface_all_params(self):
"""
- add_bare_metal_server_network_interface_floating_ip()
+ get_instance_network_interface()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/instances/testString/network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
responses.add(
- responses.PUT,
+ 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'
+ instance_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_instance_network_interface(
+ instance_id,
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_instance_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_network_interface_all_params.
_service.enable_retries()
- self.test_add_bare_metal_server_network_interface_floating_ip_all_params()
+ self.test_get_instance_network_interface_all_params()
- # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_all_params.
+ # Disable retries and run test_get_instance_network_interface_all_params.
_service.disable_retries()
- self.test_add_bare_metal_server_network_interface_floating_ip_all_params()
+ self.test_get_instance_network_interface_all_params()
@responses.activate
- def test_add_bare_metal_server_network_interface_floating_ip_value_error(self):
+ def test_get_instance_network_interface_value_error(self):
"""
- test_add_bare_metal_server_network_interface_floating_ip_value_error()
+ test_get_instance_network_interface_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/instances/testString/network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
responses.add(
- responses.PUT,
+ 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'
+ instance_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,
+ "instance_id": instance_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_instance_network_interface(**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_instance_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_network_interface_value_error.
_service.enable_retries()
- self.test_add_bare_metal_server_network_interface_floating_ip_value_error()
+ self.test_get_instance_network_interface_value_error()
- # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_value_error.
+ # Disable retries and run test_get_instance_network_interface_value_error.
_service.disable_retries()
- self.test_add_bare_metal_server_network_interface_floating_ip_value_error()
+ self.test_get_instance_network_interface_value_error()
-class TestListBareMetalServerNetworkInterfaceIps:
+class TestUpdateInstanceNetworkInterface:
"""
- Test Class for list_bare_metal_server_network_interface_ips
+ Test Class for update_instance_network_interface
"""
@responses.activate
- def test_list_bare_metal_server_network_interface_ips_all_params(self):
+ def test_update_instance_network_interface_all_params(self):
"""
- list_bare_metal_server_network_interface_ips()
+ update_instance_network_interface()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString/network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a NetworkInterfacePatch model
+ network_interface_patch_model = {}
+ network_interface_patch_model['allow_ip_spoofing'] = True
+ network_interface_patch_model['name'] = 'my-network-interface-updated'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
- network_interface_id = 'testString'
+ instance_id = 'testString'
+ id = 'testString'
+ network_interface_patch = network_interface_patch_model
# Invoke method
- response = _service.list_bare_metal_server_network_interface_ips(
- bare_metal_server_id,
- network_interface_id,
+ response = _service.update_instance_network_interface(
+ instance_id,
+ id,
+ 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 == network_interface_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_instance_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_network_interface_all_params.
_service.enable_retries()
- self.test_list_bare_metal_server_network_interface_ips_all_params()
+ self.test_update_instance_network_interface_all_params()
- # Disable retries and run test_list_bare_metal_server_network_interface_ips_all_params.
+ # Disable retries and run test_update_instance_network_interface_all_params.
_service.disable_retries()
- self.test_list_bare_metal_server_network_interface_ips_all_params()
+ self.test_update_instance_network_interface_all_params()
@responses.activate
- def test_list_bare_metal_server_network_interface_ips_value_error(self):
+ def test_update_instance_network_interface_value_error(self):
"""
- test_list_bare_metal_server_network_interface_ips_value_error()
+ test_update_instance_network_interface_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/instances/testString/network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a NetworkInterfacePatch model
+ network_interface_patch_model = {}
+ network_interface_patch_model['allow_ip_spoofing'] = True
+ network_interface_patch_model['name'] = 'my-network-interface-updated'
+
# Set up parameter values
- bare_metal_server_id = 'testString'
- network_interface_id = 'testString'
+ instance_id = 'testString'
+ id = 'testString'
+ network_interface_patch = 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,
- "network_interface_id": network_interface_id,
+ "instance_id": instance_id,
+ "id": id,
+ "network_interface_patch": 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.list_bare_metal_server_network_interface_ips(**req_copy)
+ _service.update_instance_network_interface(**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.
+ def test_update_instance_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_network_interface_value_error.
_service.enable_retries()
- self.test_list_bare_metal_server_network_interface_ips_value_error()
+ self.test_update_instance_network_interface_value_error()
- # Disable retries and run test_list_bare_metal_server_network_interface_ips_value_error.
+ # Disable retries and run test_update_instance_network_interface_value_error.
_service.disable_retries()
- self.test_list_bare_metal_server_network_interface_ips_value_error()
+ self.test_update_instance_network_interface_value_error()
-class TestGetBareMetalServerNetworkInterfaceIp:
+class TestListInstanceNetworkInterfaceFloatingIps:
"""
- Test Class for get_bare_metal_server_network_interface_ip
+ Test Class for list_instance_network_interface_floating_ips
"""
@responses.activate
- def test_get_bare_metal_server_network_interface_ip_all_params(self):
+ def test_list_instance_network_interface_floating_ips_all_params(self):
"""
- get_bare_metal_server_network_interface_ip()
+ list_instance_network_interface_floating_ips()
"""
# 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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -23005,15 +23072,13 @@ def test_get_bare_metal_server_network_interface_ip_all_params(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_id = 'testString'
network_interface_id = 'testString'
- id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server_network_interface_ip(
- bare_metal_server_id,
+ response = _service.list_instance_network_interface_floating_ips(
+ instance_id,
network_interface_id,
- id,
headers={},
)
@@ -23021,23 +23086,23 @@ def test_get_bare_metal_server_network_interface_ip_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- 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_list_instance_network_interface_floating_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_network_interface_floating_ips_all_params.
_service.enable_retries()
- self.test_get_bare_metal_server_network_interface_ip_all_params()
+ self.test_list_instance_network_interface_floating_ips_all_params()
- # Disable retries and run test_get_bare_metal_server_network_interface_ip_all_params.
+ # Disable retries and run test_list_instance_network_interface_floating_ips_all_params.
_service.disable_retries()
- self.test_get_bare_metal_server_network_interface_ip_all_params()
+ self.test_list_instance_network_interface_floating_ips_all_params()
@responses.activate
- def test_get_bare_metal_server_network_interface_ip_value_error(self):
+ def test_list_instance_network_interface_floating_ips_value_error(self):
"""
- test_get_bare_metal_server_network_interface_ip_value_error()
+ test_list_instance_network_interface_floating_ips_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -23047,119 +23112,125 @@ def test_get_bare_metal_server_network_interface_ip_value_error(self):
)
# Set up parameter values
- bare_metal_server_id = 'testString'
+ instance_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,
+ "instance_id": instance_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_ip(**req_copy)
+ _service.list_instance_network_interface_floating_ips(**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_list_instance_network_interface_floating_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_network_interface_floating_ips_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_network_interface_ip_value_error()
+ self.test_list_instance_network_interface_floating_ips_value_error()
- # Disable retries and run test_get_bare_metal_server_network_interface_ip_value_error.
+ # Disable retries and run test_list_instance_network_interface_floating_ips_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_network_interface_ip_value_error()
+ self.test_list_instance_network_interface_floating_ips_value_error()
-class TestDeleteBareMetalServer:
+class TestRemoveInstanceNetworkInterfaceFloatingIp:
"""
- Test Class for delete_bare_metal_server
+ Test Class for remove_instance_network_interface_floating_ip
"""
@responses.activate
- def test_delete_bare_metal_server_all_params(self):
+ def test_remove_instance_network_interface_floating_ip_all_params(self):
"""
- delete_bare_metal_server()
+ remove_instance_network_interface_floating_ip()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString')
+ url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_bare_metal_server(
+ response = _service.remove_instance_network_interface_floating_ip(
+ instance_id,
+ network_interface_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ 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.
+ def test_remove_instance_network_interface_floating_ip_all_params_with_retries(self):
+ # Enable retries and run test_remove_instance_network_interface_floating_ip_all_params.
_service.enable_retries()
- self.test_delete_bare_metal_server_all_params()
+ self.test_remove_instance_network_interface_floating_ip_all_params()
- # Disable retries and run test_delete_bare_metal_server_all_params.
+ # Disable retries and run test_remove_instance_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_delete_bare_metal_server_all_params()
+ self.test_remove_instance_network_interface_floating_ip_all_params()
@responses.activate
- def test_delete_bare_metal_server_value_error(self):
+ def test_remove_instance_network_interface_floating_ip_value_error(self):
"""
- test_delete_bare_metal_server_value_error()
+ test_remove_instance_network_interface_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString')
+ url = preprocess_url('/instances/testString/network_interfaces/testString/floating_ips/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_id": instance_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.delete_bare_metal_server(**req_copy)
+ _service.remove_instance_network_interface_floating_ip(**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_remove_instance_network_interface_floating_ip_value_error_with_retries(self):
+ # Enable retries and run test_remove_instance_network_interface_floating_ip_value_error.
_service.enable_retries()
- self.test_delete_bare_metal_server_value_error()
+ self.test_remove_instance_network_interface_floating_ip_value_error()
- # Disable retries and run test_delete_bare_metal_server_value_error.
+ # Disable retries and run test_remove_instance_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_delete_bare_metal_server_value_error()
+ self.test_remove_instance_network_interface_floating_ip_value_error()
-class TestGetBareMetalServer:
+class TestGetInstanceNetworkInterfaceFloatingIp:
"""
- Test Class for get_bare_metal_server
+ Test Class for get_instance_network_interface_floating_ip
"""
@responses.activate
- def test_get_bare_metal_server_all_params(self):
+ def test_get_instance_network_interface_floating_ip_all_params(self):
"""
- get_bare_metal_server()
+ get_instance_network_interface_floating_ip()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -23169,10 +23240,14 @@ def test_get_bare_metal_server_all_params(self):
)
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server(
+ response = _service.get_instance_network_interface_floating_ip(
+ instance_id,
+ network_interface_id,
id,
headers={},
)
@@ -23181,23 +23256,23 @@ def test_get_bare_metal_server_all_params(self):
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_get_instance_network_interface_floating_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_network_interface_floating_ip_all_params.
_service.enable_retries()
- self.test_get_bare_metal_server_all_params()
+ self.test_get_instance_network_interface_floating_ip_all_params()
- # Disable retries and run test_get_bare_metal_server_all_params.
+ # Disable retries and run test_get_instance_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_get_bare_metal_server_all_params()
+ self.test_get_instance_network_interface_floating_ip_all_params()
@responses.activate
- def test_get_bare_metal_server_value_error(self):
+ def test_get_instance_network_interface_floating_ip_value_error(self):
"""
- test_get_bare_metal_server_value_error()
+ test_get_instance_network_interface_floating_ip_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
@@ -23207,285 +23282,182 @@ def test_get_bare_metal_server_value_error(self):
)
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_id": instance_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(**req_copy)
+ _service.get_instance_network_interface_floating_ip(**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_get_instance_network_interface_floating_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_network_interface_floating_ip_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_value_error()
+ self.test_get_instance_network_interface_floating_ip_value_error()
- # Disable retries and run test_get_bare_metal_server_value_error.
+ # Disable retries and run test_get_instance_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_value_error()
+ self.test_get_instance_network_interface_floating_ip_value_error()
-class TestUpdateBareMetalServer:
+class TestAddInstanceNetworkInterfaceFloatingIp:
"""
- Test Class for update_bare_metal_server
+ Test Class for add_instance_network_interface_floating_ip
"""
@responses.activate
- def test_update_bare_metal_server_all_params(self):
+ def test_add_instance_network_interface_floating_ip_all_params(self):
"""
- update_bare_metal_server()
+ add_instance_network_interface_floating_ip()
"""
# 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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a BareMetalServerReservationAffinityPatch model
- bare_metal_server_reservation_affinity_patch_model = {}
- bare_metal_server_reservation_affinity_patch_model['policy'] = 'automatic'
- bare_metal_server_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a BareMetalServerTrustedPlatformModulePatch model
- bare_metal_server_trusted_platform_module_patch_model = {}
- bare_metal_server_trusted_platform_module_patch_model['mode'] = 'disabled'
-
- # Construct a dict representation of a BareMetalServerPatch model
- bare_metal_server_patch_model = {}
- bare_metal_server_patch_model['bandwidth'] = 20000
- bare_metal_server_patch_model['enable_secure_boot'] = False
- bare_metal_server_patch_model['name'] = 'my-bare-metal-server'
- bare_metal_server_patch_model['reservation_affinity'] = bare_metal_server_reservation_affinity_patch_model
- bare_metal_server_patch_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_patch_model
-
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
- bare_metal_server_patch = bare_metal_server_patch_model
# Invoke method
- response = _service.update_bare_metal_server(
+ response = _service.add_instance_network_interface_floating_ip(
+ instance_id,
+ network_interface_id,
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
+ assert response.status_code == 201
- def test_update_bare_metal_server_all_params_with_retries(self):
- # Enable retries and run test_update_bare_metal_server_all_params.
+ def test_add_instance_network_interface_floating_ip_all_params_with_retries(self):
+ # Enable retries and run test_add_instance_network_interface_floating_ip_all_params.
_service.enable_retries()
- self.test_update_bare_metal_server_all_params()
+ self.test_add_instance_network_interface_floating_ip_all_params()
- # Disable retries and run test_update_bare_metal_server_all_params.
+ # Disable retries and run test_add_instance_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_update_bare_metal_server_all_params()
+ self.test_add_instance_network_interface_floating_ip_all_params()
@responses.activate
- def test_update_bare_metal_server_value_error(self):
+ def test_add_instance_network_interface_floating_ip_value_error(self):
"""
- test_update_bare_metal_server_value_error()
+ test_add_instance_network_interface_floating_ip_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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "name": "my-bare-metal-server-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/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "0717-3744f199-6ccc-4698-8772-bb3937348c96", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "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/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-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"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "automatic", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "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": "deleting", "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": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/instances/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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ReservationIdentityById model
- reservation_identity_model = {}
- reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
-
- # Construct a dict representation of a BareMetalServerReservationAffinityPatch model
- bare_metal_server_reservation_affinity_patch_model = {}
- bare_metal_server_reservation_affinity_patch_model['policy'] = 'automatic'
- bare_metal_server_reservation_affinity_patch_model['pool'] = [reservation_identity_model]
-
- # Construct a dict representation of a BareMetalServerTrustedPlatformModulePatch model
- bare_metal_server_trusted_platform_module_patch_model = {}
- bare_metal_server_trusted_platform_module_patch_model['mode'] = 'disabled'
-
- # Construct a dict representation of a BareMetalServerPatch model
- bare_metal_server_patch_model = {}
- bare_metal_server_patch_model['bandwidth'] = 20000
- bare_metal_server_patch_model['enable_secure_boot'] = False
- bare_metal_server_patch_model['name'] = 'my-bare-metal-server'
- bare_metal_server_patch_model['reservation_affinity'] = bare_metal_server_reservation_affinity_patch_model
- bare_metal_server_patch_model['trusted_platform_module'] = bare_metal_server_trusted_platform_module_patch_model
-
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
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 = {
+ "instance_id": instance_id,
+ "network_interface_id": network_interface_id,
"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)
+ _service.add_instance_network_interface_floating_ip(**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_add_instance_network_interface_floating_ip_value_error_with_retries(self):
+ # Enable retries and run test_add_instance_network_interface_floating_ip_value_error.
_service.enable_retries()
- self.test_update_bare_metal_server_value_error()
+ self.test_add_instance_network_interface_floating_ip_value_error()
- # Disable retries and run test_update_bare_metal_server_value_error.
+ # Disable retries and run test_add_instance_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_update_bare_metal_server_value_error()
+ self.test_add_instance_network_interface_floating_ip_value_error()
-class TestUpdateFirmwareForBareMetalServer:
+class TestListInstanceNetworkInterfaceIps:
"""
- Test Class for update_firmware_for_bare_metal_server
+ Test Class for list_instance_network_interface_ips
"""
@responses.activate
- def test_update_firmware_for_bare_metal_server_all_params(self):
- """
- update_firmware_for_bare_metal_server()
- """
- # Set up mock
- url = preprocess_url('/bare_metal_servers/testString/firmware/update')
- responses.add(
- responses.POST,
- url,
- status=204,
- )
-
- # Set up parameter values
- id = 'testString'
- auto_start = True
-
- # Invoke method
- response = _service.update_firmware_for_bare_metal_server(
- id,
- auto_start=auto_start,
- 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['auto_start'] == True
-
- def test_update_firmware_for_bare_metal_server_all_params_with_retries(self):
- # Enable retries and run test_update_firmware_for_bare_metal_server_all_params.
- _service.enable_retries()
- self.test_update_firmware_for_bare_metal_server_all_params()
-
- # Disable retries and run test_update_firmware_for_bare_metal_server_all_params.
- _service.disable_retries()
- self.test_update_firmware_for_bare_metal_server_all_params()
-
- @responses.activate
- def test_update_firmware_for_bare_metal_server_required_params(self):
+ def test_list_instance_network_interface_ips_all_params(self):
"""
- test_update_firmware_for_bare_metal_server_required_params()
+ list_instance_network_interface_ips()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/firmware/update')
+ url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
+ network_interface_id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.update_firmware_for_bare_metal_server(
- id,
+ response = _service.list_instance_network_interface_ips(
+ instance_id,
+ network_interface_id,
+ start=start,
+ limit=limit,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
-
- def test_update_firmware_for_bare_metal_server_required_params_with_retries(self):
- # Enable retries and run test_update_firmware_for_bare_metal_server_required_params.
- _service.enable_retries()
- self.test_update_firmware_for_bare_metal_server_required_params()
-
- # Disable retries and run test_update_firmware_for_bare_metal_server_required_params.
- _service.disable_retries()
- self.test_update_firmware_for_bare_metal_server_required_params()
-
- @responses.activate
- def test_update_firmware_for_bare_metal_server_value_error(self):
- """
- test_update_firmware_for_bare_metal_server_value_error()
- """
- # Set up mock
- url = preprocess_url('/bare_metal_servers/testString/firmware/update')
- 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.update_firmware_for_bare_metal_server(**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 'start={}'.format(start) in query_string
+ assert 'limit={}'.format(limit) in query_string
- def test_update_firmware_for_bare_metal_server_value_error_with_retries(self):
- # Enable retries and run test_update_firmware_for_bare_metal_server_value_error.
+ def test_list_instance_network_interface_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_network_interface_ips_all_params.
_service.enable_retries()
- self.test_update_firmware_for_bare_metal_server_value_error()
+ self.test_list_instance_network_interface_ips_all_params()
- # Disable retries and run test_update_firmware_for_bare_metal_server_value_error.
+ # Disable retries and run test_list_instance_network_interface_ips_all_params.
_service.disable_retries()
- self.test_update_firmware_for_bare_metal_server_value_error()
-
-
-class TestGetBareMetalServerInitialization:
- """
- Test Class for get_bare_metal_server_initialization
- """
+ self.test_list_instance_network_interface_ips_all_params()
@responses.activate
- def test_get_bare_metal_server_initialization_all_params(self):
+ def test_list_instance_network_interface_ips_required_params(self):
"""
- get_bare_metal_server_initialization()
+ test_list_instance_network_interface_ips_required_params()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/initialization')
- mock_response = '{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
+ url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -23495,11 +23467,13 @@ def test_get_bare_metal_server_initialization_all_params(self):
)
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
+ network_interface_id = 'testString'
# Invoke method
- response = _service.get_bare_metal_server_initialization(
- id,
+ response = _service.list_instance_network_interface_ips(
+ instance_id,
+ network_interface_id,
headers={},
)
@@ -23507,23 +23481,23 @@ def test_get_bare_metal_server_initialization_all_params(self):
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.
+ def test_list_instance_network_interface_ips_required_params_with_retries(self):
+ # Enable retries and run test_list_instance_network_interface_ips_required_params.
_service.enable_retries()
- self.test_get_bare_metal_server_initialization_all_params()
+ self.test_list_instance_network_interface_ips_required_params()
- # Disable retries and run test_get_bare_metal_server_initialization_all_params.
+ # Disable retries and run test_list_instance_network_interface_ips_required_params.
_service.disable_retries()
- self.test_get_bare_metal_server_initialization_all_params()
+ self.test_list_instance_network_interface_ips_required_params()
@responses.activate
- def test_get_bare_metal_server_initialization_value_error(self):
+ def test_list_instance_network_interface_ips_value_error(self):
"""
- test_get_bare_metal_server_initialization_value_error()
+ test_list_instance_network_interface_ips_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/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
+ url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -23533,442 +23507,468 @@ def test_get_bare_metal_server_initialization_value_error(self):
)
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
+ network_interface_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "instance_id": instance_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.get_bare_metal_server_initialization(**req_copy)
+ _service.list_instance_network_interface_ips(**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.
+ def test_list_instance_network_interface_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_network_interface_ips_value_error.
_service.enable_retries()
- self.test_get_bare_metal_server_initialization_value_error()
+ self.test_list_instance_network_interface_ips_value_error()
- # Disable retries and run test_get_bare_metal_server_initialization_value_error.
+ # Disable retries and run test_list_instance_network_interface_ips_value_error.
_service.disable_retries()
- self.test_get_bare_metal_server_initialization_value_error()
+ self.test_list_instance_network_interface_ips_value_error()
+ @responses.activate
+ def test_list_instance_network_interface_ips_with_pager_get_next(self):
+ """
+ test_list_instance_network_interface_ips_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestReplaceBareMetalServerInitialization:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = InstanceNetworkInterfaceIpsPager(
+ client=_service,
+ instance_id='testString',
+ network_interface_id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_instance_network_interface_ips_with_pager_get_all(self):
+ """
+ test_list_instance_network_interface_ips_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/instances/testString/network_interfaces/testString/ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = InstanceNetworkInterfaceIpsPager(
+ client=_service,
+ instance_id='testString',
+ network_interface_id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestGetInstanceNetworkInterfaceIp:
"""
- Test Class for replace_bare_metal_server_initialization
+ Test Class for get_instance_network_interface_ip
"""
@responses.activate
- def test_replace_bare_metal_server_initialization_all_params(self):
+ def test_get_instance_network_interface_ip_all_params(self):
"""
- replace_bare_metal_server_initialization()
+ get_instance_network_interface_ip()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/initialization')
- mock_response = '{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
+ url = preprocess_url('/instances/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.PUT,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
-
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
- image = image_identity_model
- keys = [key_identity_model]
- user_data = 'testString'
# Invoke method
- response = _service.replace_bare_metal_server_initialization(
+ response = _service.get_instance_network_interface_ip(
+ instance_id,
+ network_interface_id,
id,
- image,
- keys,
- user_data=user_data,
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['image'] == image_identity_model
- assert req_body['keys'] == [key_identity_model]
- assert req_body['user_data'] == 'testString'
- def test_replace_bare_metal_server_initialization_all_params_with_retries(self):
- # Enable retries and run test_replace_bare_metal_server_initialization_all_params.
+ def test_get_instance_network_interface_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_network_interface_ip_all_params.
_service.enable_retries()
- self.test_replace_bare_metal_server_initialization_all_params()
+ self.test_get_instance_network_interface_ip_all_params()
- # Disable retries and run test_replace_bare_metal_server_initialization_all_params.
+ # Disable retries and run test_get_instance_network_interface_ip_all_params.
_service.disable_retries()
- self.test_replace_bare_metal_server_initialization_all_params()
+ self.test_get_instance_network_interface_ip_all_params()
@responses.activate
- def test_replace_bare_metal_server_initialization_value_error(self):
+ def test_get_instance_network_interface_ip_value_error(self):
"""
- test_replace_bare_metal_server_initialization_value_error()
+ test_get_instance_network_interface_ip_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/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "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/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}'
+ url = preprocess_url('/instances/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.PUT,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ImageIdentityById model
- image_identity_model = {}
- image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
-
- # Construct a dict representation of a KeyIdentityById model
- key_identity_model = {}
- key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
-
# Set up parameter values
+ instance_id = 'testString'
+ network_interface_id = 'testString'
id = 'testString'
- image = image_identity_model
- keys = [key_identity_model]
- user_data = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_id": instance_id,
+ "network_interface_id": network_interface_id,
"id": id,
- "image": image,
- "keys": keys,
}
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.replace_bare_metal_server_initialization(**req_copy)
+ _service.get_instance_network_interface_ip(**req_copy)
- def test_replace_bare_metal_server_initialization_value_error_with_retries(self):
- # Enable retries and run test_replace_bare_metal_server_initialization_value_error.
+ def test_get_instance_network_interface_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_network_interface_ip_value_error.
_service.enable_retries()
- self.test_replace_bare_metal_server_initialization_value_error()
+ self.test_get_instance_network_interface_ip_value_error()
- # Disable retries and run test_replace_bare_metal_server_initialization_value_error.
+ # Disable retries and run test_get_instance_network_interface_ip_value_error.
_service.disable_retries()
- self.test_replace_bare_metal_server_initialization_value_error()
+ self.test_get_instance_network_interface_ip_value_error()
-class TestRestartBareMetalServer:
+class TestListInstanceVolumeAttachments:
"""
- Test Class for restart_bare_metal_server
+ Test Class for list_instance_volume_attachments
"""
@responses.activate
- def test_restart_bare_metal_server_all_params(self):
+ def test_list_instance_volume_attachments_all_params(self):
"""
- restart_bare_metal_server()
+ list_instance_volume_attachments()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/restart')
+ url = preprocess_url('/instances/testString/volume_attachments')
+ mock_response = '{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
# Invoke method
- response = _service.restart_bare_metal_server(
- id,
+ response = _service.list_instance_volume_attachments(
+ instance_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_restart_bare_metal_server_all_params_with_retries(self):
- # Enable retries and run test_restart_bare_metal_server_all_params.
+ def test_list_instance_volume_attachments_all_params_with_retries(self):
+ # Enable retries and run test_list_instance_volume_attachments_all_params.
_service.enable_retries()
- self.test_restart_bare_metal_server_all_params()
+ self.test_list_instance_volume_attachments_all_params()
- # Disable retries and run test_restart_bare_metal_server_all_params.
+ # Disable retries and run test_list_instance_volume_attachments_all_params.
_service.disable_retries()
- self.test_restart_bare_metal_server_all_params()
+ self.test_list_instance_volume_attachments_all_params()
@responses.activate
- def test_restart_bare_metal_server_value_error(self):
+ def test_list_instance_volume_attachments_value_error(self):
"""
- test_restart_bare_metal_server_value_error()
+ test_list_instance_volume_attachments_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/restart')
+ url = preprocess_url('/instances/testString/volume_attachments')
+ mock_response = '{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "instance_id": instance_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)
+ _service.list_instance_volume_attachments(**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_list_instance_volume_attachments_value_error_with_retries(self):
+ # Enable retries and run test_list_instance_volume_attachments_value_error.
_service.enable_retries()
- self.test_restart_bare_metal_server_value_error()
+ self.test_list_instance_volume_attachments_value_error()
- # Disable retries and run test_restart_bare_metal_server_value_error.
+ # Disable retries and run test_list_instance_volume_attachments_value_error.
_service.disable_retries()
- self.test_restart_bare_metal_server_value_error()
+ self.test_list_instance_volume_attachments_value_error()
-class TestStartBareMetalServer:
+class TestCreateInstanceVolumeAttachment:
"""
- Test Class for start_bare_metal_server
+ Test Class for create_instance_volume_attachment
"""
@responses.activate
- def test_start_bare_metal_server_all_params(self):
+ def test_create_instance_volume_attachment_all_params(self):
"""
- start_bare_metal_server()
+ create_instance_volume_attachment()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/start')
+ url = preprocess_url('/instances/testString/volume_attachments')
+ mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
responses.add(
responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
+ volume_attachment_prototype_volume_model = {}
+ volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
+ volume = volume_attachment_prototype_volume_model
+ delete_volume_on_instance_delete = False
+ name = 'my-volume-attachment'
# Invoke method
- response = _service.start_bare_metal_server(
- id,
+ response = _service.create_instance_volume_attachment(
+ instance_id,
+ volume,
+ delete_volume_on_instance_delete=delete_volume_on_instance_delete,
+ name=name,
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['volume'] == volume_attachment_prototype_volume_model
+ assert req_body['delete_volume_on_instance_delete'] == False
+ assert req_body['name'] == 'my-volume-attachment'
- def test_start_bare_metal_server_all_params_with_retries(self):
- # Enable retries and run test_start_bare_metal_server_all_params.
+ def test_create_instance_volume_attachment_all_params_with_retries(self):
+ # Enable retries and run test_create_instance_volume_attachment_all_params.
_service.enable_retries()
- self.test_start_bare_metal_server_all_params()
+ self.test_create_instance_volume_attachment_all_params()
- # Disable retries and run test_start_bare_metal_server_all_params.
+ # Disable retries and run test_create_instance_volume_attachment_all_params.
_service.disable_retries()
- self.test_start_bare_metal_server_all_params()
+ self.test_create_instance_volume_attachment_all_params()
@responses.activate
- def test_start_bare_metal_server_value_error(self):
+ def test_create_instance_volume_attachment_value_error(self):
"""
- test_start_bare_metal_server_value_error()
+ test_create_instance_volume_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/start')
+ url = preprocess_url('/instances/testString/volume_attachments')
+ mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
responses.add(
responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityById model
+ volume_attachment_prototype_volume_model = {}
+ volume_attachment_prototype_volume_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+
# Set up parameter values
- id = 'testString'
+ instance_id = 'testString'
+ volume = volume_attachment_prototype_volume_model
+ delete_volume_on_instance_delete = False
+ name = 'my-volume-attachment'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "instance_id": instance_id,
+ "volume": volume,
}
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.create_instance_volume_attachment(**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_create_instance_volume_attachment_value_error_with_retries(self):
+ # Enable retries and run test_create_instance_volume_attachment_value_error.
_service.enable_retries()
- self.test_start_bare_metal_server_value_error()
+ self.test_create_instance_volume_attachment_value_error()
- # Disable retries and run test_start_bare_metal_server_value_error.
+ # Disable retries and run test_create_instance_volume_attachment_value_error.
_service.disable_retries()
- self.test_start_bare_metal_server_value_error()
+ self.test_create_instance_volume_attachment_value_error()
-class TestStopBareMetalServer:
+class TestDeleteInstanceVolumeAttachment:
"""
- Test Class for stop_bare_metal_server
+ Test Class for delete_instance_volume_attachment
"""
@responses.activate
- def test_stop_bare_metal_server_all_params(self):
+ def test_delete_instance_volume_attachment_all_params(self):
"""
- stop_bare_metal_server()
+ delete_instance_volume_attachment()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/stop')
+ url = preprocess_url('/instances/testString/volume_attachments/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
status=204,
)
# Set up parameter values
+ instance_id = 'testString'
id = 'testString'
- type = 'hard'
# Invoke method
- response = _service.stop_bare_metal_server(
+ response = _service.delete_instance_volume_attachment(
+ instance_id,
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.
+ def test_delete_instance_volume_attachment_all_params_with_retries(self):
+ # Enable retries and run test_delete_instance_volume_attachment_all_params.
_service.enable_retries()
- self.test_stop_bare_metal_server_all_params()
+ self.test_delete_instance_volume_attachment_all_params()
- # Disable retries and run test_stop_bare_metal_server_all_params.
+ # Disable retries and run test_delete_instance_volume_attachment_all_params.
_service.disable_retries()
- self.test_stop_bare_metal_server_all_params()
+ self.test_delete_instance_volume_attachment_all_params()
@responses.activate
- def test_stop_bare_metal_server_value_error(self):
+ def test_delete_instance_volume_attachment_value_error(self):
"""
- test_stop_bare_metal_server_value_error()
+ test_delete_instance_volume_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/bare_metal_servers/testString/stop')
+ url = preprocess_url('/instances/testString/volume_attachments/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
status=204,
)
# Set up parameter values
+ instance_id = 'testString'
id = 'testString'
- type = 'hard'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_id": instance_id,
"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)
+ _service.delete_instance_volume_attachment(**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_delete_instance_volume_attachment_value_error_with_retries(self):
+ # Enable retries and run test_delete_instance_volume_attachment_value_error.
_service.enable_retries()
- self.test_stop_bare_metal_server_value_error()
+ self.test_delete_instance_volume_attachment_value_error()
- # Disable retries and run test_stop_bare_metal_server_value_error.
+ # Disable retries and run test_delete_instance_volume_attachment_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,
- )
+ self.test_delete_instance_volume_attachment_value_error()
-class TestListVolumeProfiles:
+class TestGetInstanceVolumeAttachment:
"""
- Test Class for list_volume_profiles
+ Test Class for get_instance_volume_attachment
"""
@responses.activate
- def test_list_volume_profiles_all_params(self):
+ def test_get_instance_volume_attachment_all_params(self):
"""
- list_volume_profiles()
+ get_instance_volume_attachment()
"""
# Set up mock
- url = preprocess_url('/volume/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}], "total_count": 132}'
+ url = preprocess_url('/instances/testString/volume_attachments/testString')
+ mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
responses.add(
responses.GET,
url,
@@ -23978,74 +23978,37 @@ def test_list_volume_profiles_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
+ instance_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_volume_profiles(
- start=start,
- limit=limit,
+ response = _service.get_instance_volume_attachment(
+ instance_id,
+ 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
-
- 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": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}], "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.
+ def test_get_instance_volume_attachment_all_params_with_retries(self):
+ # Enable retries and run test_get_instance_volume_attachment_all_params.
_service.enable_retries()
- self.test_list_volume_profiles_required_params()
+ self.test_get_instance_volume_attachment_all_params()
- # Disable retries and run test_list_volume_profiles_required_params.
+ # Disable retries and run test_get_instance_volume_attachment_all_params.
_service.disable_retries()
- self.test_list_volume_profiles_required_params()
+ self.test_get_instance_volume_attachment_all_params()
@responses.activate
- def test_list_volume_profiles_value_error(self):
+ def test_get_instance_volume_attachment_value_error(self):
"""
- test_list_volume_profiles_value_error()
+ test_get_instance_volume_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/volume/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}], "total_count": 132}'
+ url = preprocess_url('/instances/testString/volume_attachments/testString')
+ mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
responses.add(
responses.GET,
url,
@@ -24054,187 +24017,202 @@ def test_list_volume_profiles_value_error(self):
status=200,
)
+ # Set up parameter values
+ instance_id = 'testString'
+ id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "instance_id": instance_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_volume_profiles(**req_copy)
+ _service.get_instance_volume_attachment(**req_copy)
- def test_list_volume_profiles_value_error_with_retries(self):
- # Enable retries and run test_list_volume_profiles_value_error.
+ def test_get_instance_volume_attachment_value_error_with_retries(self):
+ # Enable retries and run test_get_instance_volume_attachment_value_error.
_service.enable_retries()
- self.test_list_volume_profiles_value_error()
+ self.test_get_instance_volume_attachment_value_error()
- # Disable retries and run test_list_volume_profiles_value_error.
+ # Disable retries and run test_get_instance_volume_attachment_value_error.
_service.disable_retries()
- self.test_list_volume_profiles_value_error()
-
- @responses.activate
- def test_list_volume_profiles_with_pager_get_next(self):
- """
- test_list_volume_profiles_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/volume/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = VolumeProfilesPager(
- client=_service,
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_volume_profiles_with_pager_get_all(self):
- """
- test_list_volume_profiles_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/volume/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = VolumeProfilesPager(
- client=_service,
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_get_instance_volume_attachment_value_error()
-class TestGetVolumeProfile:
+class TestUpdateInstanceVolumeAttachment:
"""
- Test Class for get_volume_profile
+ Test Class for update_instance_volume_attachment
"""
@responses.activate
- def test_get_volume_profile_all_params(self):
+ def test_update_instance_volume_attachment_all_params(self):
"""
- get_volume_profile()
+ update_instance_volume_attachment()
"""
# Set up mock
- url = preprocess_url('/volume/profiles/10iops-tier')
- mock_response = '{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}'
+ url = preprocess_url('/instances/testString/volume_attachments/testString')
+ mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a VolumeAttachmentPatch model
+ volume_attachment_patch_model = {}
+ volume_attachment_patch_model['delete_volume_on_instance_delete'] = True
+ volume_attachment_patch_model['name'] = 'my-volume-attachment'
+
# Set up parameter values
- name = '10iops-tier'
+ instance_id = 'testString'
+ id = 'testString'
+ volume_attachment_patch = volume_attachment_patch_model
# Invoke method
- response = _service.get_volume_profile(
- name,
+ response = _service.update_instance_volume_attachment(
+ instance_id,
+ id,
+ volume_attachment_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_attachment_patch
- def test_get_volume_profile_all_params_with_retries(self):
- # Enable retries and run test_get_volume_profile_all_params.
+ def test_update_instance_volume_attachment_all_params_with_retries(self):
+ # Enable retries and run test_update_instance_volume_attachment_all_params.
_service.enable_retries()
- self.test_get_volume_profile_all_params()
+ self.test_update_instance_volume_attachment_all_params()
- # Disable retries and run test_get_volume_profile_all_params.
+ # Disable retries and run test_update_instance_volume_attachment_all_params.
_service.disable_retries()
- self.test_get_volume_profile_all_params()
+ self.test_update_instance_volume_attachment_all_params()
@responses.activate
- def test_get_volume_profile_value_error(self):
+ def test_update_instance_volume_attachment_value_error(self):
"""
- test_get_volume_profile_value_error()
+ test_update_instance_volume_attachment_value_error()
"""
# Set up mock
- url = preprocess_url('/volume/profiles/10iops-tier')
- mock_response = '{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}'
+ url = preprocess_url('/instances/testString/volume_attachments/testString')
+ mock_response = '{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a VolumeAttachmentPatch model
+ volume_attachment_patch_model = {}
+ volume_attachment_patch_model['delete_volume_on_instance_delete'] = True
+ volume_attachment_patch_model['name'] = 'my-volume-attachment'
+
# Set up parameter values
- name = '10iops-tier'
+ instance_id = 'testString'
+ id = 'testString'
+ volume_attachment_patch = volume_attachment_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "name": name,
+ "instance_id": instance_id,
+ "id": id,
+ "volume_attachment_patch": volume_attachment_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_volume_profile(**req_copy)
+ _service.update_instance_volume_attachment(**req_copy)
- def test_get_volume_profile_value_error_with_retries(self):
- # Enable retries and run test_get_volume_profile_value_error.
+ def test_update_instance_volume_attachment_value_error_with_retries(self):
+ # Enable retries and run test_update_instance_volume_attachment_value_error.
_service.enable_retries()
- self.test_get_volume_profile_value_error()
+ self.test_update_instance_volume_attachment_value_error()
- # Disable retries and run test_get_volume_profile_value_error.
+ # Disable retries and run test_update_instance_volume_attachment_value_error.
_service.disable_retries()
- self.test_get_volume_profile_value_error()
+ self.test_update_instance_volume_attachment_value_error()
-class TestListVolumes:
+# endregion
+##############################################################################
+# End of Service: Instances
+##############################################################################
+
+##############################################################################
+# Start of Service: Keys
+##############################################################################
+# 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 TestListKeys:
+ """
+ Test Class for list_keys
"""
@responses.activate
- def test_list_volumes_all_params(self):
+ def test_list_keys_all_params(self):
"""
- list_volumes()
+ list_keys()
"""
# Set up mock
- url = preprocess_url('/volumes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys')
+ mock_response = '{"first": {"href": "href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -24246,25 +24224,13 @@ def test_list_volumes_all_params(self):
# Set up parameter values
start = 'testString'
limit = 50
- attachment_state = 'attached'
- encryption = 'provider_managed'
- name = 'my-name'
- operating_system_family = 'Ubuntu Server'
- operating_system_architecture = 'amd64'
- tag = 'testString'
- zone_name = 'us-south-1'
+ resource_group_id = 'testString'
# Invoke method
- response = _service.list_volumes(
+ response = _service.list_keys(
start=start,
limit=limit,
- attachment_state=attachment_state,
- encryption=encryption,
- name=name,
- operating_system_family=operating_system_family,
- operating_system_architecture=operating_system_architecture,
- tag=tag,
- zone_name=zone_name,
+ resource_group_id=resource_group_id,
headers={},
)
@@ -24276,31 +24242,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 'attachment_state={}'.format(attachment_state) in query_string
- assert 'encryption={}'.format(encryption) in query_string
- assert 'name={}'.format(name) in query_string
- assert 'operating_system.family={}'.format(operating_system_family) in query_string
- assert 'operating_system.architecture={}'.format(operating_system_architecture) in query_string
- assert 'tag={}'.format(tag) 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_keys_all_params_with_retries(self):
+ # Enable retries and run test_list_keys_all_params.
_service.enable_retries()
- self.test_list_volumes_all_params()
+ self.test_list_keys_all_params()
- # Disable retries and run test_list_volumes_all_params.
+ # Disable retries and run test_list_keys_all_params.
_service.disable_retries()
- self.test_list_volumes_all_params()
+ self.test_list_keys_all_params()
@responses.activate
- def test_list_volumes_required_params(self):
+ def test_list_keys_required_params(self):
"""
- test_list_volumes_required_params()
+ test_list_keys_required_params()
"""
# Set up mock
- url = preprocess_url('/volumes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys')
+ mock_response = '{"first": {"href": "href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -24310,29 +24270,29 @@ def test_list_volumes_required_params(self):
)
# Invoke method
- response = _service.list_volumes()
+ response = _service.list_keys()
# 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_keys_required_params_with_retries(self):
+ # Enable retries and run test_list_keys_required_params.
_service.enable_retries()
- self.test_list_volumes_required_params()
+ self.test_list_keys_required_params()
- # Disable retries and run test_list_volumes_required_params.
+ # Disable retries and run test_list_keys_required_params.
_service.disable_retries()
- self.test_list_volumes_required_params()
+ self.test_list_keys_required_params()
@responses.activate
- def test_list_volumes_value_error(self):
+ def test_list_keys_value_error(self):
"""
- test_list_volumes_value_error()
+ test_list_keys_value_error()
"""
# Set up mock
- url = preprocess_url('/volumes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys')
+ mock_response = '{"first": {"href": "href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -24347,26 +24307,26 @@ 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_keys(**req_copy)
- def test_list_volumes_value_error_with_retries(self):
- # Enable retries and run test_list_volumes_value_error.
+ def test_list_keys_value_error_with_retries(self):
+ # Enable retries and run test_list_keys_value_error.
_service.enable_retries()
- self.test_list_volumes_value_error()
+ self.test_list_keys_value_error()
- # Disable retries and run test_list_volumes_value_error.
+ # Disable retries and run test_list_keys_value_error.
_service.disable_retries()
- self.test_list_volumes_value_error()
+ self.test_list_keys_value_error()
@responses.activate
- def test_list_volumes_with_pager_get_next(self):
+ def test_list_keys_with_pager_get_next(self):
"""
- test_list_volumes_with_pager_get_next()
+ test_list_keys_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/volumes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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('/keys')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
+ mock_response2 = '{"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
responses.add(
responses.GET,
url,
@@ -24384,16 +24344,10 @@ def test_list_volumes_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VolumesPager(
+ pager = KeysPager(
client=_service,
limit=10,
- attachment_state='attached',
- encryption='provider_managed',
- name='my-name',
- operating_system_family='Ubuntu Server',
- operating_system_architecture='amd64',
- tag='testString',
- zone_name='us-south-1',
+ resource_group_id='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -24402,14 +24356,14 @@ def test_list_volumes_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_volumes_with_pager_get_all(self):
+ def test_list_keys_with_pager_get_all(self):
"""
- test_list_volumes_with_pager_get_all()
+ test_list_keys_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/volumes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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('/keys')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
+ mock_response2 = '{"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}'
responses.add(
responses.GET,
url,
@@ -24426,35 +24380,29 @@ def test_list_volumes_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VolumesPager(
+ pager = KeysPager(
client=_service,
limit=10,
- attachment_state='attached',
- encryption='provider_managed',
- name='my-name',
- operating_system_family='Ubuntu Server',
- operating_system_architecture='amd64',
- tag='testString',
- zone_name='us-south-1',
+ resource_group_id='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVolume:
+class TestCreateKey:
"""
- Test Class for create_volume
+ Test Class for create_key
"""
@responses.activate
- def test_create_volume_all_params(self):
+ def test_create_key_all_params(self):
"""
- create_volume()
+ create_key()
"""
# Set up mock
- url = preprocess_url('/volumes')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
responses.add(
responses.POST,
url,
@@ -24463,40 +24411,22 @@ def test_create_volume_all_params(self):
status=201,
)
- # Construct a dict representation of a VolumeProfileIdentityByName model
- volume_profile_identity_model = {}
- volume_profile_identity_model['name'] = 'custom'
-
# 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/aa2432b1fa4d4ace891e9b80fc104e34: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['bandwidth'] = 1000
- 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'] = []
- 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
+ public_key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En'
+ name = 'my-key-1'
+ resource_group = resource_group_identity_model
+ type = 'rsa'
# Invoke method
- response = _service.create_volume(
- volume_prototype,
+ response = _service.create_key(
+ public_key,
+ name=name,
+ resource_group=resource_group,
+ type=type,
headers={},
)
@@ -24505,25 +24435,28 @@ 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['public_key'] == 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En'
+ assert req_body['name'] == 'my-key-1'
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['type'] == 'rsa'
- def test_create_volume_all_params_with_retries(self):
- # Enable retries and run test_create_volume_all_params.
+ def test_create_key_all_params_with_retries(self):
+ # Enable retries and run test_create_key_all_params.
_service.enable_retries()
- self.test_create_volume_all_params()
+ self.test_create_key_all_params()
- # Disable retries and run test_create_volume_all_params.
+ # Disable retries and run test_create_key_all_params.
_service.disable_retries()
- self.test_create_volume_all_params()
+ self.test_create_key_all_params()
@responses.activate
- def test_create_volume_value_error(self):
+ def test_create_key_value_error(self):
"""
- test_create_volume_value_error()
+ test_create_key_value_error()
"""
# Set up mock
- url = preprocess_url('/volumes')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
responses.add(
responses.POST,
url,
@@ -24532,105 +24465,47 @@ def test_create_volume_value_error(self):
status=201,
)
- # Construct a dict representation of a VolumeProfileIdentityByName model
- volume_profile_identity_model = {}
- volume_profile_identity_model['name'] = 'custom'
-
# 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/aa2432b1fa4d4ace891e9b80fc104e34: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['bandwidth'] = 1000
- 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'] = []
- 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_create_volume_value_error()
-
- # Disable retries and run test_create_volume_value_error.
- _service.disable_retries()
- self.test_create_volume_value_error()
-
-
-class TestDeleteVolume:
- """
- Test Class for delete_volume
- """
-
- @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
+ public_key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En'
+ name = 'my-key-1'
+ resource_group = resource_group_identity_model
+ type = 'rsa'
- def test_delete_volume_all_params_with_retries(self):
- # Enable retries and run test_delete_volume_all_params.
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "public_key": public_key,
+ }
+ 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_key(**req_copy)
+
+ def test_create_key_value_error_with_retries(self):
+ # Enable retries and run test_create_key_value_error.
_service.enable_retries()
- self.test_delete_volume_all_params()
+ self.test_create_key_value_error()
- # Disable retries and run test_delete_volume_all_params.
+ # Disable retries and run test_create_key_value_error.
_service.disable_retries()
- self.test_delete_volume_all_params()
+ self.test_create_key_value_error()
+
+
+class TestDeleteKey:
+ """
+ Test Class for delete_key
+ """
@responses.activate
- def test_delete_volume_required_params(self):
+ def test_delete_key_all_params(self):
"""
- test_delete_volume_required_params()
+ delete_key()
"""
# Set up mock
- url = preprocess_url('/volumes/testString')
+ url = preprocess_url('/keys/testString')
responses.add(
responses.DELETE,
url,
@@ -24641,7 +24516,7 @@ def test_delete_volume_required_params(self):
id = 'testString'
# Invoke method
- response = _service.delete_volume(
+ response = _service.delete_key(
id,
headers={},
)
@@ -24650,22 +24525,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_key_all_params_with_retries(self):
+ # Enable retries and run test_delete_key_all_params.
_service.enable_retries()
- self.test_delete_volume_required_params()
+ self.test_delete_key_all_params()
- # Disable retries and run test_delete_volume_required_params.
+ # Disable retries and run test_delete_key_all_params.
_service.disable_retries()
- self.test_delete_volume_required_params()
+ self.test_delete_key_all_params()
@responses.activate
- def test_delete_volume_value_error(self):
+ def test_delete_key_value_error(self):
"""
- test_delete_volume_value_error()
+ test_delete_key_value_error()
"""
# Set up mock
- url = preprocess_url('/volumes/testString')
+ url = preprocess_url('/keys/testString')
responses.add(
responses.DELETE,
url,
@@ -24682,31 +24557,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_key(**req_copy)
- def test_delete_volume_value_error_with_retries(self):
- # Enable retries and run test_delete_volume_value_error.
+ def test_delete_key_value_error_with_retries(self):
+ # Enable retries and run test_delete_key_value_error.
_service.enable_retries()
- self.test_delete_volume_value_error()
+ self.test_delete_key_value_error()
- # Disable retries and run test_delete_volume_value_error.
+ # Disable retries and run test_delete_key_value_error.
_service.disable_retries()
- self.test_delete_volume_value_error()
+ self.test_delete_key_value_error()
-class TestGetVolume:
+class TestGetKey:
"""
- Test Class for get_volume
+ Test Class for get_key
"""
@responses.activate
- def test_get_volume_all_params(self):
+ def test_get_key_all_params(self):
"""
- get_volume()
+ get_key()
"""
# Set up mock
- url = preprocess_url('/volumes/testString')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
responses.add(
responses.GET,
url,
@@ -24719,7 +24594,7 @@ def test_get_volume_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_volume(
+ response = _service.get_key(
id,
headers={},
)
@@ -24728,23 +24603,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_key_all_params_with_retries(self):
+ # Enable retries and run test_get_key_all_params.
_service.enable_retries()
- self.test_get_volume_all_params()
+ self.test_get_key_all_params()
- # Disable retries and run test_get_volume_all_params.
+ # Disable retries and run test_get_key_all_params.
_service.disable_retries()
- self.test_get_volume_all_params()
+ self.test_get_key_all_params()
@responses.activate
- def test_get_volume_value_error(self):
+ def test_get_key_value_error(self):
"""
- test_get_volume_value_error()
+ test_get_key_value_error()
"""
# Set up mock
- url = preprocess_url('/volumes/testString')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
responses.add(
responses.GET,
url,
@@ -24763,89 +24638,31 @@ 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_key(**req_copy)
- def test_get_volume_value_error_with_retries(self):
- # Enable retries and run test_get_volume_value_error.
+ def test_get_key_value_error_with_retries(self):
+ # Enable retries and run test_get_key_value_error.
_service.enable_retries()
- self.test_get_volume_value_error()
+ self.test_get_key_value_error()
- # Disable retries and run test_get_volume_value_error.
+ # Disable retries and run test_get_key_value_error.
_service.disable_retries()
- self.test_get_volume_value_error()
+ self.test_get_key_value_error()
-class TestUpdateVolume:
+class TestUpdateKey:
"""
- Test Class for update_volume
+ Test Class for update_key
"""
@responses.activate
- def test_update_volume_all_params(self):
- """
- update_volume()
- """
- # Set up mock
- url = preprocess_url('/volumes/testString')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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['bandwidth'] = 1000
- 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_key_all_params(self):
"""
- test_update_volume_required_params()
+ update_key()
"""
# Set up mock
- url = preprocess_url('/volumes/testString')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
responses.add(
responses.PATCH,
url,
@@ -24854,27 +24671,18 @@ def test_update_volume_required_params(self):
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['bandwidth'] = 1000
- 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 KeyPatch model
+ key_patch_model = {}
+ key_patch_model['name'] = 'my-key-1'
# Set up parameter values
id = 'testString'
- volume_patch = volume_patch_model
+ key_patch = key_patch_model
# Invoke method
- response = _service.update_volume(
+ response = _service.update_key(
id,
- volume_patch,
+ key_patch,
headers={},
)
@@ -24883,25 +24691,25 @@ 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 == key_patch
- def test_update_volume_required_params_with_retries(self):
- # Enable retries and run test_update_volume_required_params.
+ def test_update_key_all_params_with_retries(self):
+ # Enable retries and run test_update_key_all_params.
_service.enable_retries()
- self.test_update_volume_required_params()
+ self.test_update_key_all_params()
- # Disable retries and run test_update_volume_required_params.
+ # Disable retries and run test_update_key_all_params.
_service.disable_retries()
- self.test_update_volume_required_params()
+ self.test_update_key_all_params()
@responses.activate
- def test_update_volume_value_error(self):
+ def test_update_key_value_error(self):
"""
- test_update_volume_value_error()
+ test_update_key_value_error()
"""
# Set up mock
- url = preprocess_url('/volumes/testString')
- mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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('/keys/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}'
responses.add(
responses.PATCH,
url,
@@ -24910,50 +24718,41 @@ def test_update_volume_value_error(self):
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['bandwidth'] = 1000
- 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 KeyPatch model
+ key_patch_model = {}
+ key_patch_model['name'] = 'my-key-1'
# Set up parameter values
id = 'testString'
- volume_patch = volume_patch_model
+ key_patch = key_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "volume_patch": volume_patch,
+ "key_patch": key_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_key(**req_copy)
- def test_update_volume_value_error_with_retries(self):
- # Enable retries and run test_update_volume_value_error.
+ def test_update_key_value_error_with_retries(self):
+ # Enable retries and run test_update_key_value_error.
_service.enable_retries()
- self.test_update_volume_value_error()
+ self.test_update_key_value_error()
- # Disable retries and run test_update_volume_value_error.
+ # Disable retries and run test_update_key_value_error.
_service.disable_retries()
- self.test_update_volume_value_error()
+ self.test_update_key_value_error()
# endregion
##############################################################################
-# End of Service: Volumes
+# End of Service: Keys
##############################################################################
##############################################################################
-# Start of Service: Snapshots
+# Start of Service: LoadBalancers
##############################################################################
# region
@@ -25004,19 +24803,19 @@ def test_new_instance_required_param_none(self):
)
-class TestListSnapshotConsistencyGroups:
+class TestListLoadBalancerProfiles:
"""
- Test Class for list_snapshot_consistency_groups
+ Test Class for list_load_balancer_profiles
"""
@responses.activate
- def test_list_snapshot_consistency_groups_all_params(self):
+ def test_list_load_balancer_profiles_all_params(self):
"""
- list_snapshot_consistency_groups()
+ list_load_balancer_profiles()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshot_consistency_groups": [{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}'
+ url = preprocess_url('/load_balancer/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "targetable_resource_types": {"type": "enum", "values": ["instance"]}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -25028,19 +24827,11 @@ def test_list_snapshot_consistency_groups_all_params(self):
# Set up parameter values
start = 'testString'
limit = 50
- resource_group_id = 'testString'
- name = 'my-name'
- sort = 'name'
- backup_policy_plan_id = 'testString'
# Invoke method
- response = _service.list_snapshot_consistency_groups(
+ response = _service.list_load_balancer_profiles(
start=start,
limit=limit,
- resource_group_id=resource_group_id,
- name=name,
- sort=sort,
- backup_policy_plan_id=backup_policy_plan_id,
headers={},
)
@@ -25052,28 +24843,24 @@ def test_list_snapshot_consistency_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 'sort={}'.format(sort) in query_string
- assert 'backup_policy_plan.id={}'.format(backup_policy_plan_id) in query_string
- def test_list_snapshot_consistency_groups_all_params_with_retries(self):
- # Enable retries and run test_list_snapshot_consistency_groups_all_params.
+ def test_list_load_balancer_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_profiles_all_params.
_service.enable_retries()
- self.test_list_snapshot_consistency_groups_all_params()
+ self.test_list_load_balancer_profiles_all_params()
- # Disable retries and run test_list_snapshot_consistency_groups_all_params.
+ # Disable retries and run test_list_load_balancer_profiles_all_params.
_service.disable_retries()
- self.test_list_snapshot_consistency_groups_all_params()
+ self.test_list_load_balancer_profiles_all_params()
@responses.activate
- def test_list_snapshot_consistency_groups_required_params(self):
+ def test_list_load_balancer_profiles_required_params(self):
"""
- test_list_snapshot_consistency_groups_required_params()
+ test_list_load_balancer_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshot_consistency_groups": [{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}'
+ url = preprocess_url('/load_balancer/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "targetable_resource_types": {"type": "enum", "values": ["instance"]}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -25083,29 +24870,29 @@ def test_list_snapshot_consistency_groups_required_params(self):
)
# Invoke method
- response = _service.list_snapshot_consistency_groups()
+ response = _service.list_load_balancer_profiles()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_snapshot_consistency_groups_required_params_with_retries(self):
- # Enable retries and run test_list_snapshot_consistency_groups_required_params.
+ def test_list_load_balancer_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_profiles_required_params.
_service.enable_retries()
- self.test_list_snapshot_consistency_groups_required_params()
+ self.test_list_load_balancer_profiles_required_params()
- # Disable retries and run test_list_snapshot_consistency_groups_required_params.
+ # Disable retries and run test_list_load_balancer_profiles_required_params.
_service.disable_retries()
- self.test_list_snapshot_consistency_groups_required_params()
+ self.test_list_load_balancer_profiles_required_params()
@responses.activate
- def test_list_snapshot_consistency_groups_value_error(self):
+ def test_list_load_balancer_profiles_value_error(self):
"""
- test_list_snapshot_consistency_groups_value_error()
+ test_list_load_balancer_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshot_consistency_groups": [{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}'
+ url = preprocess_url('/load_balancer/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "targetable_resource_types": {"type": "enum", "values": ["instance"]}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -25120,26 +24907,26 @@ def test_list_snapshot_consistency_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_snapshot_consistency_groups(**req_copy)
+ _service.list_load_balancer_profiles(**req_copy)
- def test_list_snapshot_consistency_groups_value_error_with_retries(self):
- # Enable retries and run test_list_snapshot_consistency_groups_value_error.
+ def test_list_load_balancer_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancer_profiles_value_error.
_service.enable_retries()
- self.test_list_snapshot_consistency_groups_value_error()
+ self.test_list_load_balancer_profiles_value_error()
- # Disable retries and run test_list_snapshot_consistency_groups_value_error.
+ # Disable retries and run test_list_load_balancer_profiles_value_error.
_service.disable_retries()
- self.test_list_snapshot_consistency_groups_value_error()
+ self.test_list_load_balancer_profiles_value_error()
@responses.activate
- def test_list_snapshot_consistency_groups_with_pager_get_next(self):
+ def test_list_load_balancer_profiles_with_pager_get_next(self):
"""
- test_list_snapshot_consistency_groups_with_pager_get_next()
+ test_list_load_balancer_profiles_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/snapshot_consistency_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
- mock_response2 = '{"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
+ url = preprocess_url('/load_balancer/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"targetable_resource_types":{"type":"enum","values":["instance"]},"udp_supported":{"type":"fixed","value":true}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"targetable_resource_types":{"type":"enum","values":["instance"]},"udp_supported":{"type":"fixed","value":true}}]}'
responses.add(
responses.GET,
url,
@@ -25157,13 +24944,9 @@ def test_list_snapshot_consistency_groups_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = SnapshotConsistencyGroupsPager(
+ pager = LoadBalancerProfilesPager(
client=_service,
limit=10,
- resource_group_id='testString',
- name='my-name',
- sort='name',
- backup_policy_plan_id='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -25172,14 +24955,14 @@ def test_list_snapshot_consistency_groups_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_snapshot_consistency_groups_with_pager_get_all(self):
+ def test_list_load_balancer_profiles_with_pager_get_all(self):
"""
- test_list_snapshot_consistency_groups_with_pager_get_all()
+ test_list_load_balancer_profiles_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/snapshot_consistency_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
- mock_response2 = '{"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
+ url = preprocess_url('/load_balancer/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"targetable_resource_types":{"type":"enum","values":["instance"]},"udp_supported":{"type":"fixed","value":true}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"targetable_resource_types":{"type":"enum","values":["instance"]},"udp_supported":{"type":"fixed","value":true}}]}'
responses.add(
responses.GET,
url,
@@ -25196,467 +24979,661 @@ def test_list_snapshot_consistency_groups_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = SnapshotConsistencyGroupsPager(
+ pager = LoadBalancerProfilesPager(
client=_service,
limit=10,
- resource_group_id='testString',
- name='my-name',
- sort='name',
- backup_policy_plan_id='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateSnapshotConsistencyGroup:
+class TestGetLoadBalancerProfile:
"""
- Test Class for create_snapshot_consistency_group
+ Test Class for get_load_balancer_profile
"""
@responses.activate
- def test_create_snapshot_consistency_group_all_params(self):
+ def test_get_load_balancer_profile_all_params(self):
"""
- create_snapshot_consistency_group()
+ get_load_balancer_profile()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups')
- 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancer/profiles/network-fixed')
+ mock_response = '{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "targetable_resource_types": {"type": "enum", "values": ["instance"]}, "udp_supported": {"type": "fixed", "value": true}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # 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'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
-
- # Construct a dict representation of a SnapshotPrototypeSnapshotConsistencyGroupContext model
- snapshot_prototype_snapshot_consistency_group_context_model = {}
- snapshot_prototype_snapshot_consistency_group_context_model['name'] = 'my-snapshot'
- snapshot_prototype_snapshot_consistency_group_context_model['source_volume'] = volume_identity_model
- snapshot_prototype_snapshot_consistency_group_context_model['user_tags'] = ['testString']
-
- # Construct a dict representation of a SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model
- snapshot_consistency_group_prototype_model = {}
- snapshot_consistency_group_prototype_model['delete_snapshots_on_delete'] = True
- snapshot_consistency_group_prototype_model['name'] = 'my-snapshot-consistency-group'
- snapshot_consistency_group_prototype_model['resource_group'] = resource_group_identity_model
- snapshot_consistency_group_prototype_model['snapshots'] = [snapshot_prototype_snapshot_consistency_group_context_model]
-
# Set up parameter values
- snapshot_consistency_group_prototype = snapshot_consistency_group_prototype_model
+ name = 'network-fixed'
# Invoke method
- response = _service.create_snapshot_consistency_group(
- snapshot_consistency_group_prototype,
+ response = _service.get_load_balancer_profile(
+ name,
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 == snapshot_consistency_group_prototype
+ assert response.status_code == 200
- def test_create_snapshot_consistency_group_all_params_with_retries(self):
- # Enable retries and run test_create_snapshot_consistency_group_all_params.
+ def test_get_load_balancer_profile_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_profile_all_params.
_service.enable_retries()
- self.test_create_snapshot_consistency_group_all_params()
+ self.test_get_load_balancer_profile_all_params()
- # Disable retries and run test_create_snapshot_consistency_group_all_params.
+ # Disable retries and run test_get_load_balancer_profile_all_params.
_service.disable_retries()
- self.test_create_snapshot_consistency_group_all_params()
+ self.test_get_load_balancer_profile_all_params()
@responses.activate
- def test_create_snapshot_consistency_group_value_error(self):
+ def test_get_load_balancer_profile_value_error(self):
"""
- test_create_snapshot_consistency_group_value_error()
+ test_get_load_balancer_profile_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups')
- 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancer/profiles/network-fixed')
+ mock_response = '{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "targetable_resource_types": {"type": "enum", "values": ["instance"]}, "udp_supported": {"type": "fixed", "value": true}}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # 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'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
-
- # Construct a dict representation of a SnapshotPrototypeSnapshotConsistencyGroupContext model
- snapshot_prototype_snapshot_consistency_group_context_model = {}
- snapshot_prototype_snapshot_consistency_group_context_model['name'] = 'my-snapshot'
- snapshot_prototype_snapshot_consistency_group_context_model['source_volume'] = volume_identity_model
- snapshot_prototype_snapshot_consistency_group_context_model['user_tags'] = ['testString']
-
- # Construct a dict representation of a SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model
- snapshot_consistency_group_prototype_model = {}
- snapshot_consistency_group_prototype_model['delete_snapshots_on_delete'] = True
- snapshot_consistency_group_prototype_model['name'] = 'my-snapshot-consistency-group'
- snapshot_consistency_group_prototype_model['resource_group'] = resource_group_identity_model
- snapshot_consistency_group_prototype_model['snapshots'] = [snapshot_prototype_snapshot_consistency_group_context_model]
-
# Set up parameter values
- snapshot_consistency_group_prototype = snapshot_consistency_group_prototype_model
+ name = 'network-fixed'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "snapshot_consistency_group_prototype": snapshot_consistency_group_prototype,
+ "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.create_snapshot_consistency_group(**req_copy)
+ _service.get_load_balancer_profile(**req_copy)
- def test_create_snapshot_consistency_group_value_error_with_retries(self):
- # Enable retries and run test_create_snapshot_consistency_group_value_error.
+ def test_get_load_balancer_profile_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_profile_value_error.
_service.enable_retries()
- self.test_create_snapshot_consistency_group_value_error()
+ self.test_get_load_balancer_profile_value_error()
- # Disable retries and run test_create_snapshot_consistency_group_value_error.
+ # Disable retries and run test_get_load_balancer_profile_value_error.
_service.disable_retries()
- self.test_create_snapshot_consistency_group_value_error()
+ self.test_get_load_balancer_profile_value_error()
-class TestDeleteSnapshotConsistencyGroup:
+class TestListLoadBalancers:
"""
- Test Class for delete_snapshot_consistency_group
+ Test Class for list_load_balancers
"""
@responses.activate
- def test_delete_snapshot_consistency_group_all_params(self):
+ def test_list_load_balancers_all_params(self):
"""
- delete_snapshot_consistency_group()
+ list_load_balancers()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ start = 'testString'
+ limit = 50
+
+ # Invoke method
+ response = _service.list_load_balancers(
+ 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_load_balancers_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancers_all_params.
+ _service.enable_retries()
+ self.test_list_load_balancers_all_params()
+
+ # Disable retries and run test_list_load_balancers_all_params.
+ _service.disable_retries()
+ self.test_list_load_balancers_all_params()
+
+ @responses.activate
+ def test_list_load_balancers_required_params(self):
+ """
+ test_list_load_balancers_required_params()
+ """
+ # Set up mock
+ url = preprocess_url('/load_balancers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
- # Set up parameter values
- id = 'testString'
-
# Invoke method
- response = _service.delete_snapshot_consistency_group(
- id,
- headers={},
- )
+ response = _service.list_load_balancers()
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_snapshot_consistency_group_all_params_with_retries(self):
- # Enable retries and run test_delete_snapshot_consistency_group_all_params.
+ def test_list_load_balancers_required_params_with_retries(self):
+ # Enable retries and run test_list_load_balancers_required_params.
_service.enable_retries()
- self.test_delete_snapshot_consistency_group_all_params()
+ self.test_list_load_balancers_required_params()
- # Disable retries and run test_delete_snapshot_consistency_group_all_params.
+ # Disable retries and run test_list_load_balancers_required_params.
_service.disable_retries()
- self.test_delete_snapshot_consistency_group_all_params()
+ self.test_list_load_balancers_required_params()
@responses.activate
- def test_delete_snapshot_consistency_group_value_error(self):
+ def test_list_load_balancers_value_error(self):
"""
- test_delete_snapshot_consistency_group_value_error()
+ test_list_load_balancers_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ 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.delete_snapshot_consistency_group(**req_copy)
+ _service.list_load_balancers(**req_copy)
- def test_delete_snapshot_consistency_group_value_error_with_retries(self):
- # Enable retries and run test_delete_snapshot_consistency_group_value_error.
+ def test_list_load_balancers_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancers_value_error.
_service.enable_retries()
- self.test_delete_snapshot_consistency_group_value_error()
+ self.test_list_load_balancers_value_error()
- # Disable retries and run test_delete_snapshot_consistency_group_value_error.
+ # Disable retries and run test_list_load_balancers_value_error.
_service.disable_retries()
- self.test_delete_snapshot_consistency_group_value_error()
-
-
-class TestGetSnapshotConsistencyGroup:
- """
- Test Class for get_snapshot_consistency_group
- """
+ self.test_list_load_balancers_value_error()
@responses.activate
- def test_get_snapshot_consistency_group_all_params(self):
+ def test_list_load_balancers_with_pager_get_next(self):
"""
- get_snapshot_consistency_group()
+ test_list_load_balancers_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/load_balancers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
content_type='application/json',
status=200,
)
-
- # Set up parameter values
- id = 'testString'
-
- # Invoke method
- response = _service.get_snapshot_consistency_group(
- id,
- headers={},
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_snapshot_consistency_group_all_params_with_retries(self):
- # Enable retries and run test_get_snapshot_consistency_group_all_params.
- _service.enable_retries()
- self.test_get_snapshot_consistency_group_all_params()
-
- # Disable retries and run test_get_snapshot_consistency_group_all_params.
- _service.disable_retries()
- self.test_get_snapshot_consistency_group_all_params()
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = LoadBalancersPager(
+ client=_service,
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_get_snapshot_consistency_group_value_error(self):
+ def test_list_load_balancers_with_pager_get_all(self):
"""
- test_get_snapshot_consistency_group_value_error()
+ test_list_load_balancers_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/load_balancers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
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_snapshot_consistency_group(**req_copy)
-
- def test_get_snapshot_consistency_group_value_error_with_retries(self):
- # Enable retries and run test_get_snapshot_consistency_group_value_error.
- _service.enable_retries()
- self.test_get_snapshot_consistency_group_value_error()
-
- # Disable retries and run test_get_snapshot_consistency_group_value_error.
- _service.disable_retries()
- self.test_get_snapshot_consistency_group_value_error()
+ # Exercise the pager class for this operation
+ pager = LoadBalancersPager(
+ client=_service,
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestUpdateSnapshotConsistencyGroup:
+class TestCreateLoadBalancer:
"""
- Test Class for update_snapshot_consistency_group
+ Test Class for create_load_balancer
"""
@responses.activate
- def test_update_snapshot_consistency_group_all_params(self):
+ def test_create_load_balancer_all_params(self):
"""
- update_snapshot_consistency_group()
+ create_load_balancer()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancers')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
- responses.PATCH,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a SnapshotConsistencyGroupPatch model
- snapshot_consistency_group_patch_model = {}
- snapshot_consistency_group_patch_model['delete_snapshots_on_delete'] = False
- snapshot_consistency_group_patch_model['name'] = 'my-snapshot-consistency-group'
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a DNSInstanceIdentityByCRN model
+ dns_instance_identity_model = {}
+ dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
+
+ # Construct a dict representation of a DNSZoneIdentityById model
+ dns_zone_identity_model = {}
+ dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
+
+ # Construct a dict representation of a LoadBalancerDNSPrototype model
+ load_balancer_dns_prototype_model = {}
+ load_balancer_dns_prototype_model['instance'] = dns_instance_identity_model
+ load_balancer_dns_prototype_model['zone'] = dns_zone_identity_model
+
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityByName model
+ load_balancer_pool_identity_by_name_model = {}
+ load_balancer_pool_identity_by_name_model['name'] = 'my-load-balancer-pool'
+
+ # Construct a dict representation of a LoadBalancerListenerIdentityById model
+ load_balancer_listener_identity_model = {}
+ load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
+
+ # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
+ load_balancer_listener_https_redirect_prototype_model = {}
+ load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
+ load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
+ load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
+
+ # Construct a dict representation of a LoadBalancerListenerPrototypeLoadBalancerContext model
+ load_balancer_listener_prototype_load_balancer_context_model = {}
+ load_balancer_listener_prototype_load_balancer_context_model['accept_proxy_protocol'] = True
+ load_balancer_listener_prototype_load_balancer_context_model['certificate_instance'] = certificate_instance_identity_model
+ load_balancer_listener_prototype_load_balancer_context_model['connection_limit'] = 2000
+ load_balancer_listener_prototype_load_balancer_context_model['default_pool'] = load_balancer_pool_identity_by_name_model
+ load_balancer_listener_prototype_load_balancer_context_model['https_redirect'] = load_balancer_listener_https_redirect_prototype_model
+ load_balancer_listener_prototype_load_balancer_context_model['idle_connection_timeout'] = 100
+ load_balancer_listener_prototype_load_balancer_context_model['port'] = 443
+ load_balancer_listener_prototype_load_balancer_context_model['port_max'] = 499
+ load_balancer_listener_prototype_load_balancer_context_model['port_min'] = 443
+ load_balancer_listener_prototype_load_balancer_context_model['protocol'] = 'http'
+
+ # Construct a dict representation of a LoadBalancerLoggingDatapathPrototype model
+ load_balancer_logging_datapath_prototype_model = {}
+ load_balancer_logging_datapath_prototype_model['active'] = True
+
+ # Construct a dict representation of a LoadBalancerLoggingPrototype model
+ load_balancer_logging_prototype_model = {}
+ load_balancer_logging_prototype_model['datapath'] = load_balancer_logging_datapath_prototype_model
+
+ # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
+ load_balancer_pool_health_monitor_prototype_model = {}
+ load_balancer_pool_health_monitor_prototype_model['delay'] = 5
+ load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
+ load_balancer_pool_health_monitor_prototype_model['port'] = 22
+ load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
+ load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
+ load_balancer_pool_member_prototype_model = {}
+ load_balancer_pool_member_prototype_model['port'] = 80
+ load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_prototype_model['weight'] = 50
+
+ # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
+ load_balancer_pool_session_persistence_prototype_model = {}
+ load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
+ load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
+
+ # Construct a dict representation of a LoadBalancerPoolPrototypeLoadBalancerContext model
+ load_balancer_pool_prototype_load_balancer_context_model = {}
+ load_balancer_pool_prototype_load_balancer_context_model['algorithm'] = 'least_connections'
+ load_balancer_pool_prototype_load_balancer_context_model['health_monitor'] = load_balancer_pool_health_monitor_prototype_model
+ load_balancer_pool_prototype_load_balancer_context_model['members'] = [load_balancer_pool_member_prototype_model]
+ load_balancer_pool_prototype_load_balancer_context_model['name'] = 'my-load-balancer-pool'
+ load_balancer_pool_prototype_load_balancer_context_model['protocol'] = 'http'
+ load_balancer_pool_prototype_load_balancer_context_model['proxy_protocol'] = 'disabled'
+ load_balancer_pool_prototype_load_balancer_context_model['session_persistence'] = load_balancer_pool_session_persistence_prototype_model
+
+ # Construct a dict representation of a LoadBalancerProfileIdentityByName model
+ load_balancer_profile_identity_model = {}
+ load_balancer_profile_identity_model['name'] = 'network-fixed'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
# Set up parameter values
- id = 'testString'
- snapshot_consistency_group_patch = snapshot_consistency_group_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ is_public = True
+ subnets = [subnet_identity_model]
+ dns = load_balancer_dns_prototype_model
+ is_private_path = True
+ listeners = [load_balancer_listener_prototype_load_balancer_context_model]
+ logging = load_balancer_logging_prototype_model
+ name = 'my-load-balancer'
+ pools = [load_balancer_pool_prototype_load_balancer_context_model]
+ profile = load_balancer_profile_identity_model
+ resource_group = resource_group_identity_model
+ route_mode = True
+ security_groups = [security_group_identity_model]
# Invoke method
- response = _service.update_snapshot_consistency_group(
- id,
- snapshot_consistency_group_patch,
- if_match=if_match,
+ response = _service.create_load_balancer(
+ is_public,
+ subnets,
+ dns=dns,
+ is_private_path=is_private_path,
+ listeners=listeners,
+ logging=logging,
+ name=name,
+ pools=pools,
+ profile=profile,
+ resource_group=resource_group,
+ route_mode=route_mode,
+ security_groups=security_groups,
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 == snapshot_consistency_group_patch
+ assert req_body['is_public'] == True
+ assert req_body['subnets'] == [subnet_identity_model]
+ assert req_body['dns'] == load_balancer_dns_prototype_model
+ assert req_body['is_private_path'] == True
+ assert req_body['listeners'] == [load_balancer_listener_prototype_load_balancer_context_model]
+ assert req_body['logging'] == load_balancer_logging_prototype_model
+ assert req_body['name'] == 'my-load-balancer'
+ assert req_body['pools'] == [load_balancer_pool_prototype_load_balancer_context_model]
+ assert req_body['profile'] == load_balancer_profile_identity_model
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['route_mode'] == True
+ assert req_body['security_groups'] == [security_group_identity_model]
- def test_update_snapshot_consistency_group_all_params_with_retries(self):
- # Enable retries and run test_update_snapshot_consistency_group_all_params.
+ def test_create_load_balancer_all_params_with_retries(self):
+ # Enable retries and run test_create_load_balancer_all_params.
_service.enable_retries()
- self.test_update_snapshot_consistency_group_all_params()
+ self.test_create_load_balancer_all_params()
- # Disable retries and run test_update_snapshot_consistency_group_all_params.
+ # Disable retries and run test_create_load_balancer_all_params.
_service.disable_retries()
- self.test_update_snapshot_consistency_group_all_params()
+ self.test_create_load_balancer_all_params()
@responses.activate
- def test_update_snapshot_consistency_group_required_params(self):
+ def test_create_load_balancer_value_error(self):
"""
- test_update_snapshot_consistency_group_required_params()
+ test_create_load_balancer_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancers')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
- responses.PATCH,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a SnapshotConsistencyGroupPatch model
- snapshot_consistency_group_patch_model = {}
- snapshot_consistency_group_patch_model['delete_snapshots_on_delete'] = False
- snapshot_consistency_group_patch_model['name'] = 'my-snapshot-consistency-group'
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- # Set up parameter values
- id = 'testString'
- snapshot_consistency_group_patch = snapshot_consistency_group_patch_model
+ # Construct a dict representation of a DNSInstanceIdentityByCRN model
+ dns_instance_identity_model = {}
+ dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
- # Invoke method
- response = _service.update_snapshot_consistency_group(
- id,
- snapshot_consistency_group_patch,
- headers={},
- )
+ # Construct a dict representation of a DNSZoneIdentityById model
+ dns_zone_identity_model = {}
+ dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
- # 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_consistency_group_patch
+ # Construct a dict representation of a LoadBalancerDNSPrototype model
+ load_balancer_dns_prototype_model = {}
+ load_balancer_dns_prototype_model['instance'] = dns_instance_identity_model
+ load_balancer_dns_prototype_model['zone'] = dns_zone_identity_model
- def test_update_snapshot_consistency_group_required_params_with_retries(self):
- # Enable retries and run test_update_snapshot_consistency_group_required_params.
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityByName model
+ load_balancer_pool_identity_by_name_model = {}
+ load_balancer_pool_identity_by_name_model['name'] = 'my-load-balancer-pool'
+
+ # Construct a dict representation of a LoadBalancerListenerIdentityById model
+ load_balancer_listener_identity_model = {}
+ load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
+
+ # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
+ load_balancer_listener_https_redirect_prototype_model = {}
+ load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
+ load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
+ load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
+
+ # Construct a dict representation of a LoadBalancerListenerPrototypeLoadBalancerContext model
+ load_balancer_listener_prototype_load_balancer_context_model = {}
+ load_balancer_listener_prototype_load_balancer_context_model['accept_proxy_protocol'] = True
+ load_balancer_listener_prototype_load_balancer_context_model['certificate_instance'] = certificate_instance_identity_model
+ load_balancer_listener_prototype_load_balancer_context_model['connection_limit'] = 2000
+ load_balancer_listener_prototype_load_balancer_context_model['default_pool'] = load_balancer_pool_identity_by_name_model
+ load_balancer_listener_prototype_load_balancer_context_model['https_redirect'] = load_balancer_listener_https_redirect_prototype_model
+ load_balancer_listener_prototype_load_balancer_context_model['idle_connection_timeout'] = 100
+ load_balancer_listener_prototype_load_balancer_context_model['port'] = 443
+ load_balancer_listener_prototype_load_balancer_context_model['port_max'] = 499
+ load_balancer_listener_prototype_load_balancer_context_model['port_min'] = 443
+ load_balancer_listener_prototype_load_balancer_context_model['protocol'] = 'http'
+
+ # Construct a dict representation of a LoadBalancerLoggingDatapathPrototype model
+ load_balancer_logging_datapath_prototype_model = {}
+ load_balancer_logging_datapath_prototype_model['active'] = True
+
+ # Construct a dict representation of a LoadBalancerLoggingPrototype model
+ load_balancer_logging_prototype_model = {}
+ load_balancer_logging_prototype_model['datapath'] = load_balancer_logging_datapath_prototype_model
+
+ # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
+ load_balancer_pool_health_monitor_prototype_model = {}
+ load_balancer_pool_health_monitor_prototype_model['delay'] = 5
+ load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
+ load_balancer_pool_health_monitor_prototype_model['port'] = 22
+ load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
+ load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
+ load_balancer_pool_member_prototype_model = {}
+ load_balancer_pool_member_prototype_model['port'] = 80
+ load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_prototype_model['weight'] = 50
+
+ # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
+ load_balancer_pool_session_persistence_prototype_model = {}
+ load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
+ load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
+
+ # Construct a dict representation of a LoadBalancerPoolPrototypeLoadBalancerContext model
+ load_balancer_pool_prototype_load_balancer_context_model = {}
+ load_balancer_pool_prototype_load_balancer_context_model['algorithm'] = 'least_connections'
+ load_balancer_pool_prototype_load_balancer_context_model['health_monitor'] = load_balancer_pool_health_monitor_prototype_model
+ load_balancer_pool_prototype_load_balancer_context_model['members'] = [load_balancer_pool_member_prototype_model]
+ load_balancer_pool_prototype_load_balancer_context_model['name'] = 'my-load-balancer-pool'
+ load_balancer_pool_prototype_load_balancer_context_model['protocol'] = 'http'
+ load_balancer_pool_prototype_load_balancer_context_model['proxy_protocol'] = 'disabled'
+ load_balancer_pool_prototype_load_balancer_context_model['session_persistence'] = load_balancer_pool_session_persistence_prototype_model
+
+ # Construct a dict representation of a LoadBalancerProfileIdentityByName model
+ load_balancer_profile_identity_model = {}
+ load_balancer_profile_identity_model['name'] = 'network-fixed'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Set up parameter values
+ is_public = True
+ subnets = [subnet_identity_model]
+ dns = load_balancer_dns_prototype_model
+ is_private_path = True
+ listeners = [load_balancer_listener_prototype_load_balancer_context_model]
+ logging = load_balancer_logging_prototype_model
+ name = 'my-load-balancer'
+ pools = [load_balancer_pool_prototype_load_balancer_context_model]
+ profile = load_balancer_profile_identity_model
+ resource_group = resource_group_identity_model
+ route_mode = True
+ security_groups = [security_group_identity_model]
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "is_public": is_public,
+ "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_load_balancer(**req_copy)
+
+ def test_create_load_balancer_value_error_with_retries(self):
+ # Enable retries and run test_create_load_balancer_value_error.
_service.enable_retries()
- self.test_update_snapshot_consistency_group_required_params()
+ self.test_create_load_balancer_value_error()
- # Disable retries and run test_update_snapshot_consistency_group_required_params.
+ # Disable retries and run test_create_load_balancer_value_error.
_service.disable_retries()
- self.test_update_snapshot_consistency_group_required_params()
+ self.test_create_load_balancer_value_error()
+
+
+class TestDeleteLoadBalancer:
+ """
+ Test Class for delete_load_balancer
+ """
@responses.activate
- def test_update_snapshot_consistency_group_value_error(self):
+ def test_delete_load_balancer_all_params(self):
"""
- test_update_snapshot_consistency_group_value_error()
+ delete_load_balancer()
"""
# Set up mock
- url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/load_balancers/testString')
responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ responses.DELETE,
+ url,
+ status=202,
)
- # Construct a dict representation of a SnapshotConsistencyGroupPatch model
- snapshot_consistency_group_patch_model = {}
- snapshot_consistency_group_patch_model['delete_snapshots_on_delete'] = False
- snapshot_consistency_group_patch_model['name'] = 'my-snapshot-consistency-group'
-
# Set up parameter values
id = 'testString'
- snapshot_consistency_group_patch = snapshot_consistency_group_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "snapshot_consistency_group_patch": snapshot_consistency_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_snapshot_consistency_group(**req_copy)
+ # Invoke method
+ response = _service.delete_load_balancer(
+ id,
+ if_match=if_match,
+ headers={},
+ )
- def test_update_snapshot_consistency_group_value_error_with_retries(self):
- # Enable retries and run test_update_snapshot_consistency_group_value_error.
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_load_balancer_all_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_all_params.
_service.enable_retries()
- self.test_update_snapshot_consistency_group_value_error()
+ self.test_delete_load_balancer_all_params()
- # Disable retries and run test_update_snapshot_consistency_group_value_error.
+ # Disable retries and run test_delete_load_balancer_all_params.
_service.disable_retries()
- self.test_update_snapshot_consistency_group_value_error()
-
-
-class TestDeleteSnapshots:
- """
- Test Class for delete_snapshots
- """
+ self.test_delete_load_balancer_all_params()
@responses.activate
- def test_delete_snapshots_all_params(self):
+ def test_delete_load_balancer_required_params(self):
"""
- delete_snapshots()
+ test_delete_load_balancer_required_params()
"""
# Set up mock
- url = preprocess_url('/snapshots')
+ url = preprocess_url('/load_balancers/testString')
responses.add(
responses.DELETE,
url,
@@ -25664,38 +25641,34 @@ def test_delete_snapshots_all_params(self):
)
# Set up parameter values
- source_volume_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.delete_snapshots(
- source_volume_id,
+ response = _service.delete_load_balancer(
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 202
- # 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.
+ def test_delete_load_balancer_required_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_required_params.
_service.enable_retries()
- self.test_delete_snapshots_all_params()
+ self.test_delete_load_balancer_required_params()
- # Disable retries and run test_delete_snapshots_all_params.
+ # Disable retries and run test_delete_load_balancer_required_params.
_service.disable_retries()
- self.test_delete_snapshots_all_params()
+ self.test_delete_load_balancer_required_params()
@responses.activate
- def test_delete_snapshots_value_error(self):
+ def test_delete_load_balancer_value_error(self):
"""
- test_delete_snapshots_value_error()
+ test_delete_load_balancer_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots')
+ url = preprocess_url('/load_balancers/testString')
responses.add(
responses.DELETE,
url,
@@ -25703,40 +25676,40 @@ def test_delete_snapshots_value_error(self):
)
# Set up parameter values
- source_volume_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "source_volume_id": source_volume_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_snapshots(**req_copy)
+ _service.delete_load_balancer(**req_copy)
- def test_delete_snapshots_value_error_with_retries(self):
- # Enable retries and run test_delete_snapshots_value_error.
+ def test_delete_load_balancer_value_error_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_value_error.
_service.enable_retries()
- self.test_delete_snapshots_value_error()
+ self.test_delete_load_balancer_value_error()
- # Disable retries and run test_delete_snapshots_value_error.
+ # Disable retries and run test_delete_load_balancer_value_error.
_service.disable_retries()
- self.test_delete_snapshots_value_error()
+ self.test_delete_load_balancer_value_error()
-class TestListSnapshots:
+class TestGetLoadBalancer:
"""
- Test Class for list_snapshots
+ Test Class for get_load_balancer
"""
@responses.activate
- def test_list_snapshots_all_params(self):
+ def test_get_load_balancer_all_params(self):
"""
- list_snapshots()
+ get_load_balancer()
"""
# Set up mock
- url = preprocess_url('/snapshots')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}], "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
responses.GET,
url,
@@ -25746,102 +25719,35 @@ def test_list_snapshots_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
- tag = 'testString'
- resource_group_id = 'testString'
- name = 'my-name'
- source_volume_id = 'testString'
- source_volume_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
- source_image_id = 'testString'
- source_image_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
- sort = 'name'
- backup_policy_plan_id = 'testString'
- copies_id = 'testString'
- copies_name = 'my-snapshot-copy'
- copies_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
- copies_remote_region_name = 'us-south'
- source_snapshot_id = 'testString'
- source_snapshot_remote_region_name = 'us-south'
- source_volume_remote_region_name = 'us-east'
- source_image_remote_region_name = 'us-south'
- clones_zone_name = 'us-south-1'
- snapshot_consistency_group_id = 'testString'
- snapshot_consistency_group_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263'
+ 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,
- copies_id=copies_id,
- copies_name=copies_name,
- copies_crn=copies_crn,
- copies_remote_region_name=copies_remote_region_name,
- source_snapshot_id=source_snapshot_id,
- source_snapshot_remote_region_name=source_snapshot_remote_region_name,
- source_volume_remote_region_name=source_volume_remote_region_name,
- source_image_remote_region_name=source_image_remote_region_name,
- clones_zone_name=clones_zone_name,
- snapshot_consistency_group_id=snapshot_consistency_group_id,
- snapshot_consistency_group_crn=snapshot_consistency_group_crn,
+ response = _service.get_load_balancer(
+ 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
- assert 'copies[].id={}'.format(copies_id) in query_string
- assert 'copies[].name={}'.format(copies_name) in query_string
- assert 'copies[].crn={}'.format(copies_crn) in query_string
- assert 'copies[].remote.region.name={}'.format(copies_remote_region_name) in query_string
- assert 'source_snapshot.id={}'.format(source_snapshot_id) in query_string
- assert 'source_snapshot.remote.region.name={}'.format(source_snapshot_remote_region_name) in query_string
- assert 'source_volume.remote.region.name={}'.format(source_volume_remote_region_name) in query_string
- assert 'source_image.remote.region.name={}'.format(source_image_remote_region_name) in query_string
- assert 'clones[].zone.name={}'.format(clones_zone_name) in query_string
- assert 'snapshot_consistency_group.id={}'.format(snapshot_consistency_group_id) in query_string
- assert 'snapshot_consistency_group.crn={}'.format(snapshot_consistency_group_crn) in query_string
- def test_list_snapshots_all_params_with_retries(self):
- # Enable retries and run test_list_snapshots_all_params.
+ def test_get_load_balancer_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_all_params.
_service.enable_retries()
- self.test_list_snapshots_all_params()
+ self.test_get_load_balancer_all_params()
- # Disable retries and run test_list_snapshots_all_params.
+ # Disable retries and run test_get_load_balancer_all_params.
_service.disable_retries()
- self.test_list_snapshots_all_params()
+ self.test_get_load_balancer_all_params()
@responses.activate
- def test_list_snapshots_required_params(self):
+ def test_get_load_balancer_value_error(self):
"""
- test_list_snapshots_required_params()
+ test_get_load_balancer_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}], "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
responses.GET,
url,
@@ -25850,422 +25756,270 @@ def test_list_snapshots_required_params(self):
status=200,
)
- # Invoke method
- response = _service.list_snapshots()
-
- # 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.
- _service.enable_retries()
- self.test_list_snapshots_required_params()
-
- # Disable retries and run test_list_snapshots_required_params.
- _service.disable_retries()
- self.test_list_snapshots_required_params()
-
- @responses.activate
- def test_list_snapshots_value_error(self):
- """
- test_list_snapshots_value_error()
- """
- # Set up mock
- url = preprocess_url('/snapshots')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "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.list_snapshots(**req_copy)
+ _service.get_load_balancer(**req_copy)
- def test_list_snapshots_value_error_with_retries(self):
- # Enable retries and run test_list_snapshots_value_error.
+ def test_get_load_balancer_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_value_error.
_service.enable_retries()
- self.test_list_snapshots_value_error()
+ self.test_get_load_balancer_value_error()
- # Disable retries and run test_list_snapshots_value_error.
+ # Disable retries and run test_get_load_balancer_value_error.
_service.disable_retries()
- self.test_list_snapshots_value_error()
-
- @responses.activate
- def test_list_snapshots_with_pager_get_next(self):
- """
- test_list_snapshots_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/snapshots')
- mock_response1 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = SnapshotsPager(
- client=_service,
- limit=10,
- tag='testString',
- resource_group_id='testString',
- name='my-name',
- source_volume_id='testString',
- source_volume_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5',
- source_image_id='testString',
- source_image_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8',
- sort='name',
- backup_policy_plan_id='testString',
- copies_id='testString',
- copies_name='my-snapshot-copy',
- copies_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
- copies_remote_region_name='us-south',
- source_snapshot_id='testString',
- source_snapshot_remote_region_name='us-south',
- source_volume_remote_region_name='us-east',
- source_image_remote_region_name='us-south',
- clones_zone_name='us-south-1',
- snapshot_consistency_group_id='testString',
- snapshot_consistency_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_snapshots_with_pager_get_all(self):
- """
- test_list_snapshots_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/snapshots')
- mock_response1 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = SnapshotsPager(
- client=_service,
- limit=10,
- tag='testString',
- resource_group_id='testString',
- name='my-name',
- source_volume_id='testString',
- source_volume_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5',
- source_image_id='testString',
- source_image_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8',
- sort='name',
- backup_policy_plan_id='testString',
- copies_id='testString',
- copies_name='my-snapshot-copy',
- copies_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
- copies_remote_region_name='us-south',
- source_snapshot_id='testString',
- source_snapshot_remote_region_name='us-south',
- source_volume_remote_region_name='us-east',
- source_image_remote_region_name='us-south',
- clones_zone_name='us-south-1',
- snapshot_consistency_group_id='testString',
- snapshot_consistency_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_get_load_balancer_value_error()
-class TestCreateSnapshot:
+class TestUpdateLoadBalancer:
"""
- Test Class for create_snapshot
+ Test Class for update_load_balancer
"""
@responses.activate
- def test_create_snapshot_all_params(self):
+ def test_update_load_balancer_all_params(self):
"""
- create_snapshot()
+ update_load_balancer()
"""
# Set up mock
- 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ url = preprocess_url('/load_balancers/testString')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a DNSInstanceIdentityByCRN model
+ dns_instance_identity_model = {}
+ dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
- # Construct a dict representation of a SnapshotClonePrototype model
- snapshot_clone_prototype_model = {}
- snapshot_clone_prototype_model['zone'] = zone_identity_model
+ # Construct a dict representation of a DNSZoneIdentityById model
+ dns_zone_identity_model = {}
+ dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Construct a dict representation of a LoadBalancerDNSPatch model
+ load_balancer_dns_patch_model = {}
+ load_balancer_dns_patch_model['instance'] = dns_instance_identity_model
+ load_balancer_dns_patch_model['zone'] = dns_zone_identity_model
- # Construct a dict representation of a VolumeIdentityById model
- volume_identity_model = {}
- volume_identity_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+ # Construct a dict representation of a LoadBalancerLoggingDatapathPatch model
+ load_balancer_logging_datapath_patch_model = {}
+ load_balancer_logging_datapath_patch_model['active'] = True
- # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model
- snapshot_prototype_model = {}
- snapshot_prototype_model['clones'] = [snapshot_clone_prototype_model]
- snapshot_prototype_model['name'] = 'my-snapshot'
- snapshot_prototype_model['resource_group'] = resource_group_identity_model
- snapshot_prototype_model['user_tags'] = []
- snapshot_prototype_model['source_volume'] = volume_identity_model
+ # Construct a dict representation of a LoadBalancerLoggingPatch model
+ load_balancer_logging_patch_model = {}
+ load_balancer_logging_patch_model['datapath'] = load_balancer_logging_datapath_patch_model
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a LoadBalancerPatch model
+ load_balancer_patch_model = {}
+ load_balancer_patch_model['dns'] = load_balancer_dns_patch_model
+ load_balancer_patch_model['logging'] = load_balancer_logging_patch_model
+ load_balancer_patch_model['name'] = 'my-load-balancer'
+ load_balancer_patch_model['subnets'] = [subnet_identity_model]
# Set up parameter values
- snapshot_prototype = snapshot_prototype_model
+ id = 'testString'
+ load_balancer_patch = load_balancer_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.create_snapshot(
- snapshot_prototype,
+ response = _service.update_load_balancer(
+ id,
+ load_balancer_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 == snapshot_prototype
+ assert req_body == load_balancer_patch
- def test_create_snapshot_all_params_with_retries(self):
- # Enable retries and run test_create_snapshot_all_params.
+ def test_update_load_balancer_all_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_all_params.
_service.enable_retries()
- self.test_create_snapshot_all_params()
+ self.test_update_load_balancer_all_params()
- # Disable retries and run test_create_snapshot_all_params.
+ # Disable retries and run test_update_load_balancer_all_params.
_service.disable_retries()
- self.test_create_snapshot_all_params()
+ self.test_update_load_balancer_all_params()
@responses.activate
- def test_create_snapshot_value_error(self):
+ def test_update_load_balancer_required_params(self):
"""
- test_create_snapshot_value_error()
+ test_update_load_balancer_required_params()
"""
# Set up mock
- 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ url = preprocess_url('/load_balancers/testString')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a SnapshotClonePrototype model
- snapshot_clone_prototype_model = {}
- snapshot_clone_prototype_model['zone'] = zone_identity_model
-
- # 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'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
-
- # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model
- snapshot_prototype_model = {}
- snapshot_prototype_model['clones'] = [snapshot_clone_prototype_model]
- snapshot_prototype_model['name'] = 'my-snapshot'
- snapshot_prototype_model['resource_group'] = resource_group_identity_model
- snapshot_prototype_model['user_tags'] = []
- snapshot_prototype_model['source_volume'] = volume_identity_model
-
- # Set up parameter values
- snapshot_prototype = snapshot_prototype_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "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.create_snapshot(**req_copy)
-
- def test_create_snapshot_value_error_with_retries(self):
- # Enable retries and run test_create_snapshot_value_error.
- _service.enable_retries()
- self.test_create_snapshot_value_error()
-
- # Disable retries and run test_create_snapshot_value_error.
- _service.disable_retries()
- self.test_create_snapshot_value_error()
+ # Construct a dict representation of a DNSInstanceIdentityByCRN model
+ dns_instance_identity_model = {}
+ dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
+ # Construct a dict representation of a DNSZoneIdentityById model
+ dns_zone_identity_model = {}
+ dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
-class TestDeleteSnapshot:
- """
- Test Class for delete_snapshot
- """
+ # Construct a dict representation of a LoadBalancerDNSPatch model
+ load_balancer_dns_patch_model = {}
+ load_balancer_dns_patch_model['instance'] = dns_instance_identity_model
+ load_balancer_dns_patch_model['zone'] = dns_zone_identity_model
- @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=202,
- )
+ # Construct a dict representation of a LoadBalancerLoggingDatapathPatch model
+ load_balancer_logging_datapath_patch_model = {}
+ load_balancer_logging_datapath_patch_model['active'] = True
+
+ # Construct a dict representation of a LoadBalancerLoggingPatch model
+ load_balancer_logging_patch_model = {}
+ load_balancer_logging_patch_model['datapath'] = load_balancer_logging_datapath_patch_model
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a LoadBalancerPatch model
+ load_balancer_patch_model = {}
+ load_balancer_patch_model['dns'] = load_balancer_dns_patch_model
+ load_balancer_patch_model['logging'] = load_balancer_logging_patch_model
+ load_balancer_patch_model['name'] = 'my-load-balancer'
+ load_balancer_patch_model['subnets'] = [subnet_identity_model]
# Set up parameter values
id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ load_balancer_patch = load_balancer_patch_model
# Invoke method
- response = _service.delete_snapshot(
+ response = _service.update_load_balancer(
id,
- if_match=if_match,
+ load_balancer_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 == load_balancer_patch
- def test_delete_snapshot_all_params_with_retries(self):
- # Enable retries and run test_delete_snapshot_all_params.
+ def test_update_load_balancer_required_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_required_params.
_service.enable_retries()
- self.test_delete_snapshot_all_params()
+ self.test_update_load_balancer_required_params()
- # Disable retries and run test_delete_snapshot_all_params.
+ # Disable retries and run test_update_load_balancer_required_params.
_service.disable_retries()
- self.test_delete_snapshot_all_params()
+ self.test_update_load_balancer_required_params()
@responses.activate
- def test_delete_snapshot_required_params(self):
+ def test_update_load_balancer_value_error(self):
"""
- test_delete_snapshot_required_params()
+ test_update_load_balancer_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString')
+ url = preprocess_url('/load_balancers/testString')
+ mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
responses.add(
- responses.DELETE,
+ responses.PATCH,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Set up parameter values
- id = 'testString'
+ # Construct a dict representation of a DNSInstanceIdentityByCRN model
+ dns_instance_identity_model = {}
+ dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
- # Invoke method
- response = _service.delete_snapshot(
- id,
- headers={},
- )
+ # Construct a dict representation of a DNSZoneIdentityById model
+ dns_zone_identity_model = {}
+ dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
+ # Construct a dict representation of a LoadBalancerDNSPatch model
+ load_balancer_dns_patch_model = {}
+ load_balancer_dns_patch_model['instance'] = dns_instance_identity_model
+ load_balancer_dns_patch_model['zone'] = dns_zone_identity_model
- def test_delete_snapshot_required_params_with_retries(self):
- # Enable retries and run test_delete_snapshot_required_params.
- _service.enable_retries()
- self.test_delete_snapshot_required_params()
+ # Construct a dict representation of a LoadBalancerLoggingDatapathPatch model
+ load_balancer_logging_datapath_patch_model = {}
+ load_balancer_logging_datapath_patch_model['active'] = True
- # Disable retries and run test_delete_snapshot_required_params.
- _service.disable_retries()
- self.test_delete_snapshot_required_params()
+ # Construct a dict representation of a LoadBalancerLoggingPatch model
+ load_balancer_logging_patch_model = {}
+ load_balancer_logging_patch_model['datapath'] = load_balancer_logging_datapath_patch_model
- @responses.activate
- def test_delete_snapshot_value_error(self):
- """
- test_delete_snapshot_value_error()
- """
- # Set up mock
- url = preprocess_url('/snapshots/testString')
- responses.add(
- responses.DELETE,
- url,
- status=202,
- )
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a LoadBalancerPatch model
+ load_balancer_patch_model = {}
+ load_balancer_patch_model['dns'] = load_balancer_dns_patch_model
+ load_balancer_patch_model['logging'] = load_balancer_logging_patch_model
+ load_balancer_patch_model['name'] = 'my-load-balancer'
+ load_balancer_patch_model['subnets'] = [subnet_identity_model]
# Set up parameter values
id = 'testString'
+ load_balancer_patch = load_balancer_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
+ "load_balancer_patch": load_balancer_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_snapshot(**req_copy)
+ _service.update_load_balancer(**req_copy)
- def test_delete_snapshot_value_error_with_retries(self):
- # Enable retries and run test_delete_snapshot_value_error.
+ def test_update_load_balancer_value_error_with_retries(self):
+ # Enable retries and run test_update_load_balancer_value_error.
_service.enable_retries()
- self.test_delete_snapshot_value_error()
+ self.test_update_load_balancer_value_error()
- # Disable retries and run test_delete_snapshot_value_error.
+ # Disable retries and run test_update_load_balancer_value_error.
_service.disable_retries()
- self.test_delete_snapshot_value_error()
+ self.test_update_load_balancer_value_error()
-class TestGetSnapshot:
+class TestGetLoadBalancerStatistics:
"""
- Test Class for get_snapshot
+ Test Class for get_load_balancer_statistics
"""
@responses.activate
- def test_get_snapshot_all_params(self):
+ def test_get_load_balancer_statistics_all_params(self):
"""
- get_snapshot()
+ get_load_balancer_statistics()
"""
# 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ url = preprocess_url('/load_balancers/testString/statistics')
+ mock_response = '{"active_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}'
responses.add(
responses.GET,
url,
@@ -26278,7 +26032,7 @@ def test_get_snapshot_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_snapshot(
+ response = _service.get_load_balancer_statistics(
id,
headers={},
)
@@ -26287,23 +26041,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_load_balancer_statistics_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_statistics_all_params.
_service.enable_retries()
- self.test_get_snapshot_all_params()
+ self.test_get_load_balancer_statistics_all_params()
- # Disable retries and run test_get_snapshot_all_params.
+ # Disable retries and run test_get_load_balancer_statistics_all_params.
_service.disable_retries()
- self.test_get_snapshot_all_params()
+ self.test_get_load_balancer_statistics_all_params()
@responses.activate
- def test_get_snapshot_value_error(self):
+ def test_get_load_balancer_statistics_value_error(self):
"""
- test_get_snapshot_value_error()
+ test_get_load_balancer_statistics_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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ url = preprocess_url('/load_balancers/testString/statistics')
+ mock_response = '{"active_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}'
responses.add(
responses.GET,
url,
@@ -26322,259 +26076,313 @@ 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_load_balancer_statistics(**req_copy)
- def test_get_snapshot_value_error_with_retries(self):
- # Enable retries and run test_get_snapshot_value_error.
+ def test_get_load_balancer_statistics_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_statistics_value_error.
_service.enable_retries()
- self.test_get_snapshot_value_error()
+ self.test_get_load_balancer_statistics_value_error()
- # Disable retries and run test_get_snapshot_value_error.
+ # Disable retries and run test_get_load_balancer_statistics_value_error.
_service.disable_retries()
- self.test_get_snapshot_value_error()
+ self.test_get_load_balancer_statistics_value_error()
-class TestUpdateSnapshot:
+class TestListLoadBalancerListeners:
"""
- Test Class for update_snapshot
+ Test Class for list_load_balancer_listeners
"""
@responses.activate
- def test_update_snapshot_all_params(self):
- """
- update_snapshot()
- """
- # 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "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-updated'
- 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):
+ def test_list_load_balancer_listeners_all_params(self):
"""
- test_update_snapshot_required_params()
+ list_load_balancer_listeners()
"""
# 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ url = preprocess_url('/load_balancers/testString/listeners')
+ mock_response = '{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}'
responses.add(
- responses.PATCH,
+ responses.GET,
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-updated'
- snapshot_patch_model['user_tags'] = ['testString']
-
# Set up parameter values
- id = 'testString'
- snapshot_patch = snapshot_patch_model
+ load_balancer_id = 'testString'
# Invoke method
- response = _service.update_snapshot(
- id,
- snapshot_patch,
+ response = _service.list_load_balancer_listeners(
+ load_balancer_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 == snapshot_patch
- def test_update_snapshot_required_params_with_retries(self):
- # Enable retries and run test_update_snapshot_required_params.
+ def test_list_load_balancer_listeners_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_listeners_all_params.
_service.enable_retries()
- self.test_update_snapshot_required_params()
+ self.test_list_load_balancer_listeners_all_params()
- # Disable retries and run test_update_snapshot_required_params.
+ # Disable retries and run test_list_load_balancer_listeners_all_params.
_service.disable_retries()
- self.test_update_snapshot_required_params()
+ self.test_list_load_balancer_listeners_all_params()
@responses.activate
- def test_update_snapshot_value_error(self):
+ def test_list_load_balancer_listeners_value_error(self):
"""
- test_update_snapshot_value_error()
+ test_list_load_balancer_listeners_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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ url = preprocess_url('/load_balancers/testString/listeners')
+ mock_response = '{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}'
responses.add(
- responses.PATCH,
+ responses.GET,
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-updated'
- snapshot_patch_model['user_tags'] = ['testString']
-
# Set up parameter values
- id = 'testString'
- snapshot_patch = snapshot_patch_model
+ load_balancer_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "snapshot_patch": snapshot_patch,
+ "load_balancer_id": load_balancer_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_snapshot(**req_copy)
+ _service.list_load_balancer_listeners(**req_copy)
- def test_update_snapshot_value_error_with_retries(self):
- # Enable retries and run test_update_snapshot_value_error.
+ def test_list_load_balancer_listeners_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancer_listeners_value_error.
_service.enable_retries()
- self.test_update_snapshot_value_error()
+ self.test_list_load_balancer_listeners_value_error()
- # Disable retries and run test_update_snapshot_value_error.
+ # Disable retries and run test_list_load_balancer_listeners_value_error.
_service.disable_retries()
- self.test_update_snapshot_value_error()
+ self.test_list_load_balancer_listeners_value_error()
-class TestListSnapshotClones:
+class TestCreateLoadBalancerListener:
"""
- Test Class for list_snapshot_clones
+ Test Class for create_load_balancer_listener
"""
@responses.activate
- def test_list_snapshot_clones_all_params(self):
+ def test_create_load_balancer_listener_all_params(self):
"""
- list_snapshot_clones()
+ create_load_balancer_listener()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones')
- mock_response = '{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}'
+ url = preprocess_url('/load_balancers/testString/listeners')
+ mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerIdentityById model
+ load_balancer_listener_identity_model = {}
+ load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
+
+ # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
+ load_balancer_listener_https_redirect_prototype_model = {}
+ load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
+ load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
+ load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
+ load_balancer_listener_policy_rule_prototype_model = {}
+ load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
+ load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
+ load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
+ load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_listener_policy_target_prototype_model = {}
+ load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyPrototype model
+ load_balancer_listener_policy_prototype_model = {}
+ load_balancer_listener_policy_prototype_model['action'] = 'forward_to_listener'
+ load_balancer_listener_policy_prototype_model['name'] = 'my-load-balancer-listener-policy'
+ load_balancer_listener_policy_prototype_model['priority'] = 5
+ load_balancer_listener_policy_prototype_model['rules'] = [load_balancer_listener_policy_rule_prototype_model]
+ load_balancer_listener_policy_prototype_model['target'] = load_balancer_listener_policy_target_prototype_model
+
# Set up parameter values
- id = 'testString'
+ load_balancer_id = 'testString'
+ protocol = 'http'
+ accept_proxy_protocol = True
+ certificate_instance = certificate_instance_identity_model
+ connection_limit = 2000
+ default_pool = load_balancer_pool_identity_model
+ https_redirect = load_balancer_listener_https_redirect_prototype_model
+ idle_connection_timeout = 100
+ policies = [load_balancer_listener_policy_prototype_model]
+ port = 443
+ port_max = 499
+ port_min = 443
# Invoke method
- response = _service.list_snapshot_clones(
- id,
+ response = _service.create_load_balancer_listener(
+ load_balancer_id,
+ protocol,
+ accept_proxy_protocol=accept_proxy_protocol,
+ certificate_instance=certificate_instance,
+ connection_limit=connection_limit,
+ default_pool=default_pool,
+ https_redirect=https_redirect,
+ idle_connection_timeout=idle_connection_timeout,
+ policies=policies,
+ port=port,
+ port_max=port_max,
+ port_min=port_min,
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['protocol'] == 'http'
+ assert req_body['accept_proxy_protocol'] == True
+ assert req_body['certificate_instance'] == certificate_instance_identity_model
+ assert req_body['connection_limit'] == 2000
+ assert req_body['default_pool'] == load_balancer_pool_identity_model
+ assert req_body['https_redirect'] == load_balancer_listener_https_redirect_prototype_model
+ assert req_body['idle_connection_timeout'] == 100
+ assert req_body['policies'] == [load_balancer_listener_policy_prototype_model]
+ assert req_body['port'] == 443
+ assert req_body['port_max'] == 499
+ assert req_body['port_min'] == 443
- def test_list_snapshot_clones_all_params_with_retries(self):
- # Enable retries and run test_list_snapshot_clones_all_params.
+ def test_create_load_balancer_listener_all_params_with_retries(self):
+ # Enable retries and run test_create_load_balancer_listener_all_params.
_service.enable_retries()
- self.test_list_snapshot_clones_all_params()
+ self.test_create_load_balancer_listener_all_params()
- # Disable retries and run test_list_snapshot_clones_all_params.
+ # Disable retries and run test_create_load_balancer_listener_all_params.
_service.disable_retries()
- self.test_list_snapshot_clones_all_params()
+ self.test_create_load_balancer_listener_all_params()
@responses.activate
- def test_list_snapshot_clones_value_error(self):
+ def test_create_load_balancer_listener_value_error(self):
"""
- test_list_snapshot_clones_value_error()
+ test_create_load_balancer_listener_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones')
- mock_response = '{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}'
+ url = preprocess_url('/load_balancers/testString/listeners')
+ mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerIdentityById model
+ load_balancer_listener_identity_model = {}
+ load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
+
+ # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
+ load_balancer_listener_https_redirect_prototype_model = {}
+ load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
+ load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
+ load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
+ load_balancer_listener_policy_rule_prototype_model = {}
+ load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
+ load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
+ load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
+ load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_listener_policy_target_prototype_model = {}
+ load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyPrototype model
+ load_balancer_listener_policy_prototype_model = {}
+ load_balancer_listener_policy_prototype_model['action'] = 'forward_to_listener'
+ load_balancer_listener_policy_prototype_model['name'] = 'my-load-balancer-listener-policy'
+ load_balancer_listener_policy_prototype_model['priority'] = 5
+ load_balancer_listener_policy_prototype_model['rules'] = [load_balancer_listener_policy_rule_prototype_model]
+ load_balancer_listener_policy_prototype_model['target'] = load_balancer_listener_policy_target_prototype_model
+
# Set up parameter values
- id = 'testString'
+ load_balancer_id = 'testString'
+ protocol = 'http'
+ accept_proxy_protocol = True
+ certificate_instance = certificate_instance_identity_model
+ connection_limit = 2000
+ default_pool = load_balancer_pool_identity_model
+ https_redirect = load_balancer_listener_https_redirect_prototype_model
+ idle_connection_timeout = 100
+ policies = [load_balancer_listener_policy_prototype_model]
+ port = 443
+ port_max = 499
+ port_min = 443
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "load_balancer_id": load_balancer_id,
+ "protocol": protocol,
}
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_snapshot_clones(**req_copy)
+ _service.create_load_balancer_listener(**req_copy)
- def test_list_snapshot_clones_value_error_with_retries(self):
- # Enable retries and run test_list_snapshot_clones_value_error.
+ def test_create_load_balancer_listener_value_error_with_retries(self):
+ # Enable retries and run test_create_load_balancer_listener_value_error.
_service.enable_retries()
- self.test_list_snapshot_clones_value_error()
+ self.test_create_load_balancer_listener_value_error()
- # Disable retries and run test_list_snapshot_clones_value_error.
+ # Disable retries and run test_create_load_balancer_listener_value_error.
_service.disable_retries()
- self.test_list_snapshot_clones_value_error()
+ self.test_create_load_balancer_listener_value_error()
-class TestDeleteSnapshotClone:
+class TestDeleteLoadBalancerListener:
"""
- Test Class for delete_snapshot_clone
+ Test Class for delete_load_balancer_listener
"""
@responses.activate
- def test_delete_snapshot_clone_all_params(self):
+ def test_delete_load_balancer_listener_all_params(self):
"""
- delete_snapshot_clone()
+ delete_load_balancer_listener()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones/us-south-1')
+ url = preprocess_url('/load_balancers/testString/listeners/testString')
responses.add(
responses.DELETE,
url,
@@ -26582,13 +26390,13 @@ def test_delete_snapshot_clone_all_params(self):
)
# Set up parameter values
+ load_balancer_id = 'testString'
id = 'testString'
- zone_name = 'us-south-1'
# Invoke method
- response = _service.delete_snapshot_clone(
+ response = _service.delete_load_balancer_listener(
+ load_balancer_id,
id,
- zone_name,
headers={},
)
@@ -26596,22 +26404,22 @@ def test_delete_snapshot_clone_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 202
- def test_delete_snapshot_clone_all_params_with_retries(self):
- # Enable retries and run test_delete_snapshot_clone_all_params.
+ def test_delete_load_balancer_listener_all_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_listener_all_params.
_service.enable_retries()
- self.test_delete_snapshot_clone_all_params()
+ self.test_delete_load_balancer_listener_all_params()
- # Disable retries and run test_delete_snapshot_clone_all_params.
+ # Disable retries and run test_delete_load_balancer_listener_all_params.
_service.disable_retries()
- self.test_delete_snapshot_clone_all_params()
+ self.test_delete_load_balancer_listener_all_params()
@responses.activate
- def test_delete_snapshot_clone_value_error(self):
+ def test_delete_load_balancer_listener_value_error(self):
"""
- test_delete_snapshot_clone_value_error()
+ test_delete_load_balancer_listener_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones/us-south-1')
+ url = preprocess_url('/load_balancers/testString/listeners/testString')
responses.add(
responses.DELETE,
url,
@@ -26619,42 +26427,42 @@ def test_delete_snapshot_clone_value_error(self):
)
# Set up parameter values
+ load_balancer_id = 'testString'
id = 'testString'
- zone_name = 'us-south-1'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
"id": id,
- "zone_name": zone_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.delete_snapshot_clone(**req_copy)
+ _service.delete_load_balancer_listener(**req_copy)
- def test_delete_snapshot_clone_value_error_with_retries(self):
- # Enable retries and run test_delete_snapshot_clone_value_error.
+ def test_delete_load_balancer_listener_value_error_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_listener_value_error.
_service.enable_retries()
- self.test_delete_snapshot_clone_value_error()
+ self.test_delete_load_balancer_listener_value_error()
- # Disable retries and run test_delete_snapshot_clone_value_error.
+ # Disable retries and run test_delete_load_balancer_listener_value_error.
_service.disable_retries()
- self.test_delete_snapshot_clone_value_error()
+ self.test_delete_load_balancer_listener_value_error()
-class TestGetSnapshotClone:
+class TestGetLoadBalancerListener:
"""
- Test Class for get_snapshot_clone
+ Test Class for get_load_balancer_listener
"""
@responses.activate
- def test_get_snapshot_clone_all_params(self):
+ def test_get_load_balancer_listener_all_params(self):
"""
- get_snapshot_clone()
+ get_load_balancer_listener()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones/us-south-1')
- mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString')
+ mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
responses.add(
responses.GET,
url,
@@ -26664,13 +26472,13 @@ def test_get_snapshot_clone_all_params(self):
)
# Set up parameter values
+ load_balancer_id = 'testString'
id = 'testString'
- zone_name = 'us-south-1'
# Invoke method
- response = _service.get_snapshot_clone(
+ response = _service.get_load_balancer_listener(
+ load_balancer_id,
id,
- zone_name,
headers={},
)
@@ -26678,23 +26486,23 @@ def test_get_snapshot_clone_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_snapshot_clone_all_params_with_retries(self):
- # Enable retries and run test_get_snapshot_clone_all_params.
+ def test_get_load_balancer_listener_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_listener_all_params.
_service.enable_retries()
- self.test_get_snapshot_clone_all_params()
+ self.test_get_load_balancer_listener_all_params()
- # Disable retries and run test_get_snapshot_clone_all_params.
+ # Disable retries and run test_get_load_balancer_listener_all_params.
_service.disable_retries()
- self.test_get_snapshot_clone_all_params()
+ self.test_get_load_balancer_listener_all_params()
@responses.activate
- def test_get_snapshot_clone_value_error(self):
+ def test_get_load_balancer_listener_value_error(self):
"""
- test_get_snapshot_clone_value_error()
+ test_get_load_balancer_listener_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones/us-south-1')
- mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString')
+ mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
responses.add(
responses.GET,
url,
@@ -26704,184 +26512,196 @@ def test_get_snapshot_clone_value_error(self):
)
# Set up parameter values
+ load_balancer_id = 'testString'
id = 'testString'
- zone_name = 'us-south-1'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
"id": id,
- "zone_name": zone_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_snapshot_clone(**req_copy)
+ _service.get_load_balancer_listener(**req_copy)
- def test_get_snapshot_clone_value_error_with_retries(self):
- # Enable retries and run test_get_snapshot_clone_value_error.
+ def test_get_load_balancer_listener_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_listener_value_error.
_service.enable_retries()
- self.test_get_snapshot_clone_value_error()
+ self.test_get_load_balancer_listener_value_error()
- # Disable retries and run test_get_snapshot_clone_value_error.
+ # Disable retries and run test_get_load_balancer_listener_value_error.
_service.disable_retries()
- self.test_get_snapshot_clone_value_error()
+ self.test_get_load_balancer_listener_value_error()
-class TestCreateSnapshotClone:
+class TestUpdateLoadBalancerListener:
"""
- Test Class for create_snapshot_clone
+ Test Class for update_load_balancer_listener
"""
@responses.activate
- def test_create_snapshot_clone_all_params(self):
+ def test_update_load_balancer_listener_all_params(self):
"""
- create_snapshot_clone()
+ update_load_balancer_listener()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones/us-south-1')
- mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString')
+ mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
responses.add(
- responses.PUT,
+ responses.PATCH,
url,
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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
+
+ # Construct a dict representation of a LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityById model
+ load_balancer_listener_default_pool_patch_model = {}
+ load_balancer_listener_default_pool_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerIdentityById model
+ load_balancer_listener_identity_model = {}
+ load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
+
+ # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPatch model
+ load_balancer_listener_https_redirect_patch_model = {}
+ load_balancer_listener_https_redirect_patch_model['http_status_code'] = 301
+ load_balancer_listener_https_redirect_patch_model['listener'] = load_balancer_listener_identity_model
+ load_balancer_listener_https_redirect_patch_model['uri'] = '/example?doc=get'
+
+ # Construct a dict representation of a LoadBalancerListenerPatch model
+ load_balancer_listener_patch_model = {}
+ load_balancer_listener_patch_model['accept_proxy_protocol'] = True
+ load_balancer_listener_patch_model['certificate_instance'] = certificate_instance_identity_model
+ load_balancer_listener_patch_model['connection_limit'] = 2000
+ load_balancer_listener_patch_model['default_pool'] = load_balancer_listener_default_pool_patch_model
+ load_balancer_listener_patch_model['https_redirect'] = load_balancer_listener_https_redirect_patch_model
+ load_balancer_listener_patch_model['idle_connection_timeout'] = 100
+ load_balancer_listener_patch_model['port'] = 443
+ load_balancer_listener_patch_model['port_max'] = 499
+ load_balancer_listener_patch_model['port_min'] = 443
+ load_balancer_listener_patch_model['protocol'] = 'http'
+
# Set up parameter values
+ load_balancer_id = 'testString'
id = 'testString'
- zone_name = 'us-south-1'
+ load_balancer_listener_patch = load_balancer_listener_patch_model
# Invoke method
- response = _service.create_snapshot_clone(
+ response = _service.update_load_balancer_listener(
+ load_balancer_id,
id,
- zone_name,
+ load_balancer_listener_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 == load_balancer_listener_patch
- def test_create_snapshot_clone_all_params_with_retries(self):
- # Enable retries and run test_create_snapshot_clone_all_params.
+ def test_update_load_balancer_listener_all_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_listener_all_params.
_service.enable_retries()
- self.test_create_snapshot_clone_all_params()
+ self.test_update_load_balancer_listener_all_params()
- # Disable retries and run test_create_snapshot_clone_all_params.
+ # Disable retries and run test_update_load_balancer_listener_all_params.
_service.disable_retries()
- self.test_create_snapshot_clone_all_params()
+ self.test_update_load_balancer_listener_all_params()
@responses.activate
- def test_create_snapshot_clone_value_error(self):
+ def test_update_load_balancer_listener_value_error(self):
"""
- test_create_snapshot_clone_value_error()
+ test_update_load_balancer_listener_value_error()
"""
# Set up mock
- url = preprocess_url('/snapshots/testString/clones/us-south-1')
- mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString')
+ mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
responses.add(
- responses.PUT,
+ responses.PATCH,
url,
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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
+
+ # Construct a dict representation of a LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityById model
+ load_balancer_listener_default_pool_patch_model = {}
+ load_balancer_listener_default_pool_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerIdentityById model
+ load_balancer_listener_identity_model = {}
+ load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
+
+ # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPatch model
+ load_balancer_listener_https_redirect_patch_model = {}
+ load_balancer_listener_https_redirect_patch_model['http_status_code'] = 301
+ load_balancer_listener_https_redirect_patch_model['listener'] = load_balancer_listener_identity_model
+ load_balancer_listener_https_redirect_patch_model['uri'] = '/example?doc=get'
+
+ # Construct a dict representation of a LoadBalancerListenerPatch model
+ load_balancer_listener_patch_model = {}
+ load_balancer_listener_patch_model['accept_proxy_protocol'] = True
+ load_balancer_listener_patch_model['certificate_instance'] = certificate_instance_identity_model
+ load_balancer_listener_patch_model['connection_limit'] = 2000
+ load_balancer_listener_patch_model['default_pool'] = load_balancer_listener_default_pool_patch_model
+ load_balancer_listener_patch_model['https_redirect'] = load_balancer_listener_https_redirect_patch_model
+ load_balancer_listener_patch_model['idle_connection_timeout'] = 100
+ load_balancer_listener_patch_model['port'] = 443
+ load_balancer_listener_patch_model['port_max'] = 499
+ load_balancer_listener_patch_model['port_min'] = 443
+ load_balancer_listener_patch_model['protocol'] = 'http'
+
# Set up parameter values
+ load_balancer_id = 'testString'
id = 'testString'
- zone_name = 'us-south-1'
+ load_balancer_listener_patch = load_balancer_listener_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
"id": id,
- "zone_name": zone_name,
+ "load_balancer_listener_patch": load_balancer_listener_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.create_snapshot_clone(**req_copy)
+ _service.update_load_balancer_listener(**req_copy)
- def test_create_snapshot_clone_value_error_with_retries(self):
- # Enable retries and run test_create_snapshot_clone_value_error.
+ def test_update_load_balancer_listener_value_error_with_retries(self):
+ # Enable retries and run test_update_load_balancer_listener_value_error.
_service.enable_retries()
- self.test_create_snapshot_clone_value_error()
+ self.test_update_load_balancer_listener_value_error()
- # Disable retries and run test_create_snapshot_clone_value_error.
+ # Disable retries and run test_update_load_balancer_listener_value_error.
_service.disable_retries()
- self.test_create_snapshot_clone_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: Snapshots
-##############################################################################
-
-##############################################################################
-# Start of Service: Shares
-##############################################################################
-# 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,
- )
+ self.test_update_load_balancer_listener_value_error()
-class TestListShareProfiles:
+class TestListLoadBalancerListenerPolicies:
"""
- Test Class for list_share_profiles
+ Test Class for list_load_balancer_listener_policies
"""
@responses.activate
- def test_list_share_profiles_all_params(self):
+ def test_list_load_balancer_listener_policies_all_params(self):
"""
- list_share_profiles()
+ list_load_balancer_listener_policies()
"""
# Set up mock
- url = preprocess_url('/share/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
+ mock_response = '{"policies": [{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}]}'
responses.add(
responses.GET,
url,
@@ -26891,45 +26711,37 @@ def test_list_share_profiles_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
- sort = 'name'
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
# Invoke method
- response = _service.list_share_profiles(
- start=start,
- limit=limit,
- sort=sort,
+ response = _service.list_load_balancer_listener_policies(
+ load_balancer_id,
+ listener_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 'sort={}'.format(sort) in query_string
- def test_list_share_profiles_all_params_with_retries(self):
- # Enable retries and run test_list_share_profiles_all_params.
+ def test_list_load_balancer_listener_policies_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_listener_policies_all_params.
_service.enable_retries()
- self.test_list_share_profiles_all_params()
+ self.test_list_load_balancer_listener_policies_all_params()
- # Disable retries and run test_list_share_profiles_all_params.
+ # Disable retries and run test_list_load_balancer_listener_policies_all_params.
_service.disable_retries()
- self.test_list_share_profiles_all_params()
+ self.test_list_load_balancer_listener_policies_all_params()
@responses.activate
- def test_list_share_profiles_required_params(self):
+ def test_list_load_balancer_listener_policies_value_error(self):
"""
- test_list_share_profiles_required_params()
+ test_list_load_balancer_listener_policies_value_error()
"""
# Set up mock
- url = preprocess_url('/share/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
+ mock_response = '{"policies": [{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}]}'
responses.add(
responses.GET,
url,
@@ -26938,140 +26750,257 @@ def test_list_share_profiles_required_params(self):
status=200,
)
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_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_load_balancer_listener_policies(**req_copy)
+
+ def test_list_load_balancer_listener_policies_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancer_listener_policies_value_error.
+ _service.enable_retries()
+ self.test_list_load_balancer_listener_policies_value_error()
+
+ # Disable retries and run test_list_load_balancer_listener_policies_value_error.
+ _service.disable_retries()
+ self.test_list_load_balancer_listener_policies_value_error()
+
+
+class TestCreateLoadBalancerListenerPolicy:
+ """
+ Test Class for create_load_balancer_listener_policy
+ """
+
+ @responses.activate
+ def test_create_load_balancer_listener_policy_all_params(self):
+ """
+ create_load_balancer_listener_policy()
+ """
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
+ mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
+ responses.add(
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
+ )
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
+ load_balancer_listener_policy_rule_prototype_model = {}
+ load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
+ load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
+ load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
+ load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_listener_policy_target_prototype_model = {}
+ load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ action = 'forward_to_listener'
+ priority = 5
+ name = 'my-load-balancer-listener-policy'
+ rules = [load_balancer_listener_policy_rule_prototype_model]
+ target = load_balancer_listener_policy_target_prototype_model
+
# Invoke method
- response = _service.list_share_profiles()
+ response = _service.create_load_balancer_listener_policy(
+ load_balancer_id,
+ listener_id,
+ action,
+ priority,
+ name=name,
+ rules=rules,
+ target=target,
+ 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['action'] == 'forward_to_listener'
+ assert req_body['priority'] == 5
+ assert req_body['name'] == 'my-load-balancer-listener-policy'
+ assert req_body['rules'] == [load_balancer_listener_policy_rule_prototype_model]
+ assert req_body['target'] == load_balancer_listener_policy_target_prototype_model
- def test_list_share_profiles_required_params_with_retries(self):
- # Enable retries and run test_list_share_profiles_required_params.
+ def test_create_load_balancer_listener_policy_all_params_with_retries(self):
+ # Enable retries and run test_create_load_balancer_listener_policy_all_params.
_service.enable_retries()
- self.test_list_share_profiles_required_params()
+ self.test_create_load_balancer_listener_policy_all_params()
- # Disable retries and run test_list_share_profiles_required_params.
+ # Disable retries and run test_create_load_balancer_listener_policy_all_params.
_service.disable_retries()
- self.test_list_share_profiles_required_params()
+ self.test_create_load_balancer_listener_policy_all_params()
@responses.activate
- def test_list_share_profiles_value_error(self):
+ def test_create_load_balancer_listener_policy_value_error(self):
"""
- test_list_share_profiles_value_error()
+ test_create_load_balancer_listener_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/share/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
+ mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
+ load_balancer_listener_policy_rule_prototype_model = {}
+ load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
+ load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
+ load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
+ load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_listener_policy_target_prototype_model = {}
+ load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ action = 'forward_to_listener'
+ priority = 5
+ name = 'my-load-balancer-listener-policy'
+ rules = [load_balancer_listener_policy_rule_prototype_model]
+ target = load_balancer_listener_policy_target_prototype_model
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "action": action,
+ "priority": priority,
}
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_share_profiles(**req_copy)
+ _service.create_load_balancer_listener_policy(**req_copy)
- def test_list_share_profiles_value_error_with_retries(self):
- # Enable retries and run test_list_share_profiles_value_error.
+ def test_create_load_balancer_listener_policy_value_error_with_retries(self):
+ # Enable retries and run test_create_load_balancer_listener_policy_value_error.
_service.enable_retries()
- self.test_list_share_profiles_value_error()
+ self.test_create_load_balancer_listener_policy_value_error()
- # Disable retries and run test_list_share_profiles_value_error.
+ # Disable retries and run test_create_load_balancer_listener_policy_value_error.
_service.disable_retries()
- self.test_list_share_profiles_value_error()
+ self.test_create_load_balancer_listener_policy_value_error()
+
+
+class TestDeleteLoadBalancerListenerPolicy:
+ """
+ Test Class for delete_load_balancer_listener_policy
+ """
@responses.activate
- def test_list_share_profiles_with_pager_get_next(self):
+ def test_delete_load_balancer_listener_policy_all_params(self):
"""
- test_list_share_profiles_with_pager_get_next()
+ delete_load_balancer_listener_policy()
"""
- # Set up a two-page mock response
- url = preprocess_url('/share/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response2,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = ShareProfilesPager(
- client=_service,
- limit=10,
- sort='name',
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_load_balancer_listener_policy(
+ load_balancer_id,
+ listener_id,
+ id,
+ headers={},
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_load_balancer_listener_policy_all_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_listener_policy_all_params.
+ _service.enable_retries()
+ self.test_delete_load_balancer_listener_policy_all_params()
+
+ # Disable retries and run test_delete_load_balancer_listener_policy_all_params.
+ _service.disable_retries()
+ self.test_delete_load_balancer_listener_policy_all_params()
@responses.activate
- def test_list_share_profiles_with_pager_get_all(self):
+ def test_delete_load_balancer_listener_policy_value_error(self):
"""
- test_list_share_profiles_with_pager_get_all()
+ test_delete_load_balancer_listener_policy_value_error()
"""
- # Set up a two-page mock response
- url = preprocess_url('/share/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response2,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Exercise the pager class for this operation
- pager = ShareProfilesPager(
- client=_service,
- limit=10,
- sort='name',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ id = 'testString'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_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_load_balancer_listener_policy(**req_copy)
+
+ def test_delete_load_balancer_listener_policy_value_error_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_listener_policy_value_error.
+ _service.enable_retries()
+ self.test_delete_load_balancer_listener_policy_value_error()
+
+ # Disable retries and run test_delete_load_balancer_listener_policy_value_error.
+ _service.disable_retries()
+ self.test_delete_load_balancer_listener_policy_value_error()
-class TestGetShareProfile:
+class TestGetLoadBalancerListenerPolicy:
"""
- Test Class for get_share_profile
+ Test Class for get_load_balancer_listener_policy
"""
@responses.activate
- def test_get_share_profile_all_params(self):
+ def test_get_load_balancer_listener_policy_all_params(self):
"""
- get_share_profile()
+ get_load_balancer_listener_policy()
"""
# Set up mock
- url = preprocess_url('/share/profiles/dp2')
- mock_response = '{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
+ mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
responses.add(
responses.GET,
url,
@@ -27081,11 +27010,15 @@ def test_get_share_profile_all_params(self):
)
# Set up parameter values
- name = 'dp2'
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.get_share_profile(
- name,
+ response = _service.get_load_balancer_listener_policy(
+ load_balancer_id,
+ listener_id,
+ id,
headers={},
)
@@ -27093,23 +27026,23 @@ def test_get_share_profile_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_share_profile_all_params_with_retries(self):
- # Enable retries and run test_get_share_profile_all_params.
+ def test_get_load_balancer_listener_policy_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_listener_policy_all_params.
_service.enable_retries()
- self.test_get_share_profile_all_params()
+ self.test_get_load_balancer_listener_policy_all_params()
- # Disable retries and run test_get_share_profile_all_params.
+ # Disable retries and run test_get_load_balancer_listener_policy_all_params.
_service.disable_retries()
- self.test_get_share_profile_all_params()
+ self.test_get_load_balancer_listener_policy_all_params()
@responses.activate
- def test_get_share_profile_value_error(self):
+ def test_get_load_balancer_listener_policy_value_error(self):
"""
- test_get_share_profile_value_error()
+ test_get_load_balancer_listener_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/share/profiles/dp2')
- mock_response = '{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
+ mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
responses.add(
responses.GET,
url,
@@ -27119,558 +27052,375 @@ def test_get_share_profile_value_error(self):
)
# Set up parameter values
- name = 'dp2'
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "name": name,
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_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_share_profile(**req_copy)
+ _service.get_load_balancer_listener_policy(**req_copy)
- def test_get_share_profile_value_error_with_retries(self):
- # Enable retries and run test_get_share_profile_value_error.
+ def test_get_load_balancer_listener_policy_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_listener_policy_value_error.
_service.enable_retries()
- self.test_get_share_profile_value_error()
+ self.test_get_load_balancer_listener_policy_value_error()
- # Disable retries and run test_get_share_profile_value_error.
+ # Disable retries and run test_get_load_balancer_listener_policy_value_error.
_service.disable_retries()
- self.test_get_share_profile_value_error()
+ self.test_get_load_balancer_listener_policy_value_error()
-class TestListShares:
+class TestUpdateLoadBalancerListenerPolicy:
"""
- Test Class for list_shares
+ Test Class for update_load_balancer_listener_policy
"""
@responses.activate
- def test_list_shares_all_params(self):
+ def test_update_load_balancer_listener_policy_all_params(self):
"""
- list_shares()
+ update_load_balancer_listener_policy()
"""
# Set up mock
- url = preprocess_url('/shares')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "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('/load_balancers/testString/listeners/testString/policies/testString')
+ mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_listener_policy_target_patch_model = {}
+ load_balancer_listener_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerListenerPolicyPatch model
+ load_balancer_listener_policy_patch_model = {}
+ load_balancer_listener_policy_patch_model['name'] = 'my-load-balancer-listener-policy-updated'
+ load_balancer_listener_policy_patch_model['priority'] = 5
+ load_balancer_listener_policy_patch_model['target'] = load_balancer_listener_policy_target_patch_model
+
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- name = 'my-name'
- sort = 'name'
- replication_role = 'none'
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ id = 'testString'
+ load_balancer_listener_policy_patch = load_balancer_listener_policy_patch_model
# Invoke method
- response = _service.list_shares(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
- name=name,
- sort=sort,
- replication_role=replication_role,
+ response = _service.update_load_balancer_listener_policy(
+ load_balancer_id,
+ listener_id,
+ id,
+ load_balancer_listener_policy_patch,
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 'sort={}'.format(sort) in query_string
- assert 'replication_role={}'.format(replication_role) in query_string
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body == load_balancer_listener_policy_patch
- def test_list_shares_all_params_with_retries(self):
- # Enable retries and run test_list_shares_all_params.
+ def test_update_load_balancer_listener_policy_all_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_listener_policy_all_params.
_service.enable_retries()
- self.test_list_shares_all_params()
+ self.test_update_load_balancer_listener_policy_all_params()
- # Disable retries and run test_list_shares_all_params.
+ # Disable retries and run test_update_load_balancer_listener_policy_all_params.
_service.disable_retries()
- self.test_list_shares_all_params()
+ self.test_update_load_balancer_listener_policy_all_params()
@responses.activate
- def test_list_shares_required_params(self):
+ def test_update_load_balancer_listener_policy_value_error(self):
"""
- test_list_shares_required_params()
+ test_update_load_balancer_listener_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/shares')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "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('/load_balancers/testString/listeners/testString/policies/testString')
+ mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Invoke method
- response = _service.list_shares()
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_shares_required_params_with_retries(self):
- # Enable retries and run test_list_shares_required_params.
- _service.enable_retries()
- self.test_list_shares_required_params()
+ # Construct a dict representation of a LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_listener_policy_target_patch_model = {}
+ load_balancer_listener_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
- # Disable retries and run test_list_shares_required_params.
- _service.disable_retries()
- self.test_list_shares_required_params()
+ # Construct a dict representation of a LoadBalancerListenerPolicyPatch model
+ load_balancer_listener_policy_patch_model = {}
+ load_balancer_listener_policy_patch_model['name'] = 'my-load-balancer-listener-policy-updated'
+ load_balancer_listener_policy_patch_model['priority'] = 5
+ load_balancer_listener_policy_patch_model['target'] = load_balancer_listener_policy_target_patch_model
- @responses.activate
- def test_list_shares_value_error(self):
- """
- test_list_shares_value_error()
- """
- # Set up mock
- url = preprocess_url('/shares')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "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,
- content_type='application/json',
- status=200,
- )
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ id = 'testString'
+ load_balancer_listener_policy_patch = load_balancer_listener_policy_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "id": id,
+ "load_balancer_listener_policy_patch": load_balancer_listener_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.list_shares(**req_copy)
+ _service.update_load_balancer_listener_policy(**req_copy)
- def test_list_shares_value_error_with_retries(self):
- # Enable retries and run test_list_shares_value_error.
+ def test_update_load_balancer_listener_policy_value_error_with_retries(self):
+ # Enable retries and run test_update_load_balancer_listener_policy_value_error.
_service.enable_retries()
- self.test_list_shares_value_error()
+ self.test_update_load_balancer_listener_policy_value_error()
- # Disable retries and run test_list_shares_value_error.
+ # Disable retries and run test_update_load_balancer_listener_policy_value_error.
_service.disable_retries()
- self.test_list_shares_value_error()
-
- @responses.activate
- def test_list_shares_with_pager_get_next(self):
- """
- test_list_shares_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/shares')
- mock_response1 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = SharesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- sort='name',
- replication_role='none',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_shares_with_pager_get_all(self):
- """
- test_list_shares_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/shares')
- mock_response1 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = SharesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- sort='name',
- replication_role='none',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_update_load_balancer_listener_policy_value_error()
-class TestCreateShare:
+class TestListLoadBalancerListenerPolicyRules:
"""
- Test Class for create_share
+ Test Class for list_load_balancer_listener_policy_rules
"""
@responses.activate
- def test_create_share_all_params(self):
+ def test_list_load_balancer_listener_policy_rules_all_params(self):
"""
- create_share()
+ list_load_balancer_listener_policy_rules()
"""
# Set up mock
- url = preprocess_url('/shares')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
+ mock_response = '{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
- share_mount_target_virtual_network_interface_prototype_model = {}
- share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
- share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
- share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
- share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
- share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
- share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
- share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
- share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
- share_mount_target_prototype_model = {}
- share_mount_target_prototype_model['name'] = 'my-share-mount-target'
- share_mount_target_prototype_model['transit_encryption'] = 'none'
- share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
-
- # Construct a dict representation of a ShareProfileIdentityByName model
- share_profile_identity_model = {}
- share_profile_identity_model['name'] = 'tier-3iops'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a SharePrototypeShareContext model
- share_prototype_share_context_model = {}
- share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['none']
- share_prototype_share_context_model['iops'] = 100
- share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
- share_prototype_share_context_model['name'] = 'my-share'
- share_prototype_share_context_model['profile'] = share_profile_identity_model
- share_prototype_share_context_model['replication_cron_spec'] = '0 */5 * * *'
- share_prototype_share_context_model['resource_group'] = resource_group_identity_model
- share_prototype_share_context_model['user_tags'] = []
- share_prototype_share_context_model['zone'] = zone_identity_model
-
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a ShareInitialOwner model
- share_initial_owner_model = {}
- share_initial_owner_model['gid'] = 50
- share_initial_owner_model['uid'] = 50
-
- # Construct a dict representation of a SharePrototypeShareBySize model
- share_prototype_model = {}
- share_prototype_model['allowed_transit_encryption_modes'] = ['none']
- share_prototype_model['mount_targets'] = [share_mount_target_prototype_model]
- share_prototype_model['name'] = 'my-share'
- share_prototype_model['replica_share'] = share_prototype_share_context_model
- share_prototype_model['user_tags'] = []
- share_prototype_model['access_control_mode'] = 'security_group'
- share_prototype_model['encryption_key'] = encryption_key_identity_model
- share_prototype_model['initial_owner'] = share_initial_owner_model
- share_prototype_model['iops'] = 100
- share_prototype_model['profile'] = share_profile_identity_model
- share_prototype_model['resource_group'] = resource_group_identity_model
- share_prototype_model['size'] = 200
- share_prototype_model['zone'] = zone_identity_model
-
# Set up parameter values
- share_prototype = share_prototype_model
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
# Invoke method
- response = _service.create_share(
- share_prototype,
+ response = _service.list_load_balancer_listener_policy_rules(
+ load_balancer_id,
+ listener_id,
+ policy_id,
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 == share_prototype
+ assert response.status_code == 200
- def test_create_share_all_params_with_retries(self):
- # Enable retries and run test_create_share_all_params.
+ def test_list_load_balancer_listener_policy_rules_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_listener_policy_rules_all_params.
_service.enable_retries()
- self.test_create_share_all_params()
+ self.test_list_load_balancer_listener_policy_rules_all_params()
- # Disable retries and run test_create_share_all_params.
+ # Disable retries and run test_list_load_balancer_listener_policy_rules_all_params.
_service.disable_retries()
- self.test_create_share_all_params()
+ self.test_list_load_balancer_listener_policy_rules_all_params()
@responses.activate
- def test_create_share_value_error(self):
+ def test_list_load_balancer_listener_policy_rules_value_error(self):
"""
- test_create_share_value_error()
+ test_list_load_balancer_listener_policy_rules_value_error()
"""
# Set up mock
- url = preprocess_url('/shares')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
+ mock_response = '{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
- )
-
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
- share_mount_target_virtual_network_interface_prototype_model = {}
- share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
- share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
- share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
- share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
- share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
- share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
- share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
- share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
-
- # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
- share_mount_target_prototype_model = {}
- share_mount_target_prototype_model['name'] = 'my-share-mount-target'
- share_mount_target_prototype_model['transit_encryption'] = 'none'
- share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
-
- # Construct a dict representation of a ShareProfileIdentityByName model
- share_profile_identity_model = {}
- share_profile_identity_model['name'] = 'tier-3iops'
-
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a SharePrototypeShareContext model
- share_prototype_share_context_model = {}
- share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['none']
- share_prototype_share_context_model['iops'] = 100
- share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
- share_prototype_share_context_model['name'] = 'my-share'
- share_prototype_share_context_model['profile'] = share_profile_identity_model
- share_prototype_share_context_model['replication_cron_spec'] = '0 */5 * * *'
- share_prototype_share_context_model['resource_group'] = resource_group_identity_model
- share_prototype_share_context_model['user_tags'] = []
- share_prototype_share_context_model['zone'] = zone_identity_model
-
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a ShareInitialOwner model
- share_initial_owner_model = {}
- share_initial_owner_model['gid'] = 50
- share_initial_owner_model['uid'] = 50
-
- # Construct a dict representation of a SharePrototypeShareBySize model
- share_prototype_model = {}
- share_prototype_model['allowed_transit_encryption_modes'] = ['none']
- share_prototype_model['mount_targets'] = [share_mount_target_prototype_model]
- share_prototype_model['name'] = 'my-share'
- share_prototype_model['replica_share'] = share_prototype_share_context_model
- share_prototype_model['user_tags'] = []
- share_prototype_model['access_control_mode'] = 'security_group'
- share_prototype_model['encryption_key'] = encryption_key_identity_model
- share_prototype_model['initial_owner'] = share_initial_owner_model
- share_prototype_model['iops'] = 100
- share_prototype_model['profile'] = share_profile_identity_model
- share_prototype_model['resource_group'] = resource_group_identity_model
- share_prototype_model['size'] = 200
- share_prototype_model['zone'] = zone_identity_model
+ status=200,
+ )
# Set up parameter values
- share_prototype = share_prototype_model
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_prototype": share_prototype,
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "policy_id": 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.create_share(**req_copy)
+ _service.list_load_balancer_listener_policy_rules(**req_copy)
- def test_create_share_value_error_with_retries(self):
- # Enable retries and run test_create_share_value_error.
+ def test_list_load_balancer_listener_policy_rules_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancer_listener_policy_rules_value_error.
_service.enable_retries()
- self.test_create_share_value_error()
+ self.test_list_load_balancer_listener_policy_rules_value_error()
- # Disable retries and run test_create_share_value_error.
+ # Disable retries and run test_list_load_balancer_listener_policy_rules_value_error.
_service.disable_retries()
- self.test_create_share_value_error()
+ self.test_list_load_balancer_listener_policy_rules_value_error()
-class TestDeleteShare:
+class TestCreateLoadBalancerListenerPolicyRule:
"""
- Test Class for delete_share
+ Test Class for create_load_balancer_listener_policy_rule
"""
@responses.activate
- def test_delete_share_all_params(self):
+ def test_create_load_balancer_listener_policy_rule_all_params(self):
"""
- delete_share()
+ create_load_balancer_listener_policy_rule()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
+ mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=201,
)
# Set up parameter values
- id = 'testString'
- if_match = 'W/96d225c4-56bd-43d9-98fc-d7148e5c5028'
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
+ condition = 'contains'
+ type = 'body'
+ value = 'testString'
+ field = 'MY-APP-HEADER'
# Invoke method
- response = _service.delete_share(
- id,
- if_match=if_match,
+ response = _service.create_load_balancer_listener_policy_rule(
+ load_balancer_id,
+ listener_id,
+ policy_id,
+ condition,
+ type,
+ value,
+ field=field,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 201
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body['condition'] == 'contains'
+ assert req_body['type'] == 'body'
+ assert req_body['value'] == 'testString'
+ assert req_body['field'] == 'MY-APP-HEADER'
- def test_delete_share_all_params_with_retries(self):
- # Enable retries and run test_delete_share_all_params.
+ def test_create_load_balancer_listener_policy_rule_all_params_with_retries(self):
+ # Enable retries and run test_create_load_balancer_listener_policy_rule_all_params.
_service.enable_retries()
- self.test_delete_share_all_params()
+ self.test_create_load_balancer_listener_policy_rule_all_params()
- # Disable retries and run test_delete_share_all_params.
+ # Disable retries and run test_create_load_balancer_listener_policy_rule_all_params.
_service.disable_retries()
- self.test_delete_share_all_params()
+ self.test_create_load_balancer_listener_policy_rule_all_params()
@responses.activate
- def test_delete_share_required_params(self):
+ def test_create_load_balancer_listener_policy_rule_value_error(self):
"""
- test_delete_share_required_params()
+ test_create_load_balancer_listener_policy_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
+ mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
+ status=201,
+ )
+
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
+ condition = 'contains'
+ type = 'body'
+ value = 'testString'
+ field = 'MY-APP-HEADER'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "policy_id": policy_id,
+ "condition": condition,
+ "type": type,
+ "value": value,
+ }
+ 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_load_balancer_listener_policy_rule(**req_copy)
+
+ def test_create_load_balancer_listener_policy_rule_value_error_with_retries(self):
+ # Enable retries and run test_create_load_balancer_listener_policy_rule_value_error.
+ _service.enable_retries()
+ self.test_create_load_balancer_listener_policy_rule_value_error()
+
+ # Disable retries and run test_create_load_balancer_listener_policy_rule_value_error.
+ _service.disable_retries()
+ self.test_create_load_balancer_listener_policy_rule_value_error()
+
+
+class TestDeleteLoadBalancerListenerPolicyRule:
+ """
+ Test Class for delete_load_balancer_listener_policy_rule
+ """
+
+ @responses.activate
+ def test_delete_load_balancer_listener_policy_rule_all_params(self):
+ """
+ delete_load_balancer_listener_policy_rule()
+ """
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
+ responses.add(
+ responses.DELETE,
+ url,
status=202,
)
# Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_share(
+ response = _service.delete_load_balancer_listener_policy_rule(
+ load_balancer_id,
+ listener_id,
+ policy_id,
id,
headers={},
)
@@ -27679,66 +27429,69 @@ def test_delete_share_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 202
- def test_delete_share_required_params_with_retries(self):
- # Enable retries and run test_delete_share_required_params.
+ def test_delete_load_balancer_listener_policy_rule_all_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_listener_policy_rule_all_params.
_service.enable_retries()
- self.test_delete_share_required_params()
+ self.test_delete_load_balancer_listener_policy_rule_all_params()
- # Disable retries and run test_delete_share_required_params.
+ # Disable retries and run test_delete_load_balancer_listener_policy_rule_all_params.
_service.disable_retries()
- self.test_delete_share_required_params()
+ self.test_delete_load_balancer_listener_policy_rule_all_params()
@responses.activate
- def test_delete_share_value_error(self):
+ def test_delete_load_balancer_listener_policy_rule_value_error(self):
"""
- test_delete_share_value_error()
+ test_delete_load_balancer_listener_policy_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
status=202,
)
# Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "policy_id": 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.delete_share(**req_copy)
+ _service.delete_load_balancer_listener_policy_rule(**req_copy)
- def test_delete_share_value_error_with_retries(self):
- # Enable retries and run test_delete_share_value_error.
+ def test_delete_load_balancer_listener_policy_rule_value_error_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_listener_policy_rule_value_error.
_service.enable_retries()
- self.test_delete_share_value_error()
+ self.test_delete_load_balancer_listener_policy_rule_value_error()
- # Disable retries and run test_delete_share_value_error.
+ # Disable retries and run test_delete_load_balancer_listener_policy_rule_value_error.
_service.disable_retries()
- self.test_delete_share_value_error()
+ self.test_delete_load_balancer_listener_policy_rule_value_error()
-class TestGetShare:
+class TestGetLoadBalancerListenerPolicyRule:
"""
- Test Class for get_share
+ Test Class for get_load_balancer_listener_policy_rule
"""
@responses.activate
- def test_get_share_all_params(self):
+ def test_get_load_balancer_listener_policy_rule_all_params(self):
"""
- get_share()
+ get_load_balancer_listener_policy_rule()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
+ mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
responses.add(
responses.GET,
url,
@@ -27748,10 +27501,16 @@ def test_get_share_all_params(self):
)
# Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_share(
+ response = _service.get_load_balancer_listener_policy_rule(
+ load_balancer_id,
+ listener_id,
+ policy_id,
id,
headers={},
)
@@ -27760,23 +27519,23 @@ def test_get_share_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_share_all_params_with_retries(self):
- # Enable retries and run test_get_share_all_params.
+ def test_get_load_balancer_listener_policy_rule_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_listener_policy_rule_all_params.
_service.enable_retries()
- self.test_get_share_all_params()
+ self.test_get_load_balancer_listener_policy_rule_all_params()
- # Disable retries and run test_get_share_all_params.
+ # Disable retries and run test_get_load_balancer_listener_policy_rule_all_params.
_service.disable_retries()
- self.test_get_share_all_params()
+ self.test_get_load_balancer_listener_policy_rule_all_params()
@responses.activate
- def test_get_share_value_error(self):
+ def test_get_load_balancer_listener_policy_rule_value_error(self):
"""
- test_get_share_value_error()
+ test_get_load_balancer_listener_policy_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
+ mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
responses.add(
responses.GET,
url,
@@ -27786,40 +27545,46 @@ def test_get_share_value_error(self):
)
# Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "policy_id": 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_share(**req_copy)
+ _service.get_load_balancer_listener_policy_rule(**req_copy)
- def test_get_share_value_error_with_retries(self):
- # Enable retries and run test_get_share_value_error.
+ def test_get_load_balancer_listener_policy_rule_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_listener_policy_rule_value_error.
_service.enable_retries()
- self.test_get_share_value_error()
+ self.test_get_load_balancer_listener_policy_rule_value_error()
- # Disable retries and run test_get_share_value_error.
+ # Disable retries and run test_get_load_balancer_listener_policy_rule_value_error.
_service.disable_retries()
- self.test_get_share_value_error()
+ self.test_get_load_balancer_listener_policy_rule_value_error()
-class TestUpdateShare:
+class TestUpdateLoadBalancerListenerPolicyRule:
"""
- Test Class for update_share
+ Test Class for update_load_balancer_listener_policy_rule
"""
@responses.activate
- def test_update_share_all_params(self):
+ def test_update_load_balancer_listener_policy_rule_all_params(self):
"""
- update_share()
+ update_load_balancer_listener_policy_rule()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
+ mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
responses.add(
responses.PATCH,
url,
@@ -27828,31 +27593,27 @@ def test_update_share_all_params(self):
status=200,
)
- # Construct a dict representation of a ShareProfileIdentityByName model
- share_profile_identity_model = {}
- share_profile_identity_model['name'] = 'tier-3iops'
-
- # Construct a dict representation of a SharePatch model
- share_patch_model = {}
- share_patch_model['access_control_mode'] = 'security_group'
- share_patch_model['allowed_transit_encryption_modes'] = ['none']
- share_patch_model['iops'] = 100
- share_patch_model['name'] = 'my-share'
- share_patch_model['profile'] = share_profile_identity_model
- share_patch_model['replication_cron_spec'] = '0 */5 * * *'
- share_patch_model['size'] = 8000
- share_patch_model['user_tags'] = ['testString']
+ # Construct a dict representation of a LoadBalancerListenerPolicyRulePatch model
+ load_balancer_listener_policy_rule_patch_model = {}
+ load_balancer_listener_policy_rule_patch_model['condition'] = 'contains'
+ load_balancer_listener_policy_rule_patch_model['field'] = 'MY-APP-HEADER'
+ load_balancer_listener_policy_rule_patch_model['type'] = 'body'
+ load_balancer_listener_policy_rule_patch_model['value'] = 'my-example-hostname-updated'
# Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
id = 'testString'
- share_patch = share_patch_model
- if_match = 'W/96d225c4-56bd-43d9-98fc-d7148e5c5028'
+ load_balancer_listener_policy_rule_patch = load_balancer_listener_policy_rule_patch_model
# Invoke method
- response = _service.update_share(
+ response = _service.update_load_balancer_listener_policy_rule(
+ load_balancer_id,
+ listener_id,
+ policy_id,
id,
- share_patch,
- if_match=if_match,
+ load_balancer_listener_policy_rule_patch,
headers={},
)
@@ -27861,25 +27622,25 @@ def test_update_share_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 == share_patch
+ assert req_body == load_balancer_listener_policy_rule_patch
- def test_update_share_all_params_with_retries(self):
- # Enable retries and run test_update_share_all_params.
+ def test_update_load_balancer_listener_policy_rule_all_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_listener_policy_rule_all_params.
_service.enable_retries()
- self.test_update_share_all_params()
+ self.test_update_load_balancer_listener_policy_rule_all_params()
- # Disable retries and run test_update_share_all_params.
+ # Disable retries and run test_update_load_balancer_listener_policy_rule_all_params.
_service.disable_retries()
- self.test_update_share_all_params()
+ self.test_update_load_balancer_listener_policy_rule_all_params()
@responses.activate
- def test_update_share_required_params(self):
+ def test_update_load_balancer_listener_policy_rule_value_error(self):
"""
- test_update_share_required_params()
+ test_update_load_balancer_listener_policy_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
+ mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
responses.add(
responses.PATCH,
url,
@@ -27888,394 +27649,398 @@ def test_update_share_required_params(self):
status=200,
)
- # Construct a dict representation of a ShareProfileIdentityByName model
- share_profile_identity_model = {}
- share_profile_identity_model['name'] = 'tier-3iops'
-
- # Construct a dict representation of a SharePatch model
- share_patch_model = {}
- share_patch_model['access_control_mode'] = 'security_group'
- share_patch_model['allowed_transit_encryption_modes'] = ['none']
- share_patch_model['iops'] = 100
- share_patch_model['name'] = 'my-share'
- share_patch_model['profile'] = share_profile_identity_model
- share_patch_model['replication_cron_spec'] = '0 */5 * * *'
- share_patch_model['size'] = 8000
- share_patch_model['user_tags'] = ['testString']
+ # Construct a dict representation of a LoadBalancerListenerPolicyRulePatch model
+ load_balancer_listener_policy_rule_patch_model = {}
+ load_balancer_listener_policy_rule_patch_model['condition'] = 'contains'
+ load_balancer_listener_policy_rule_patch_model['field'] = 'MY-APP-HEADER'
+ load_balancer_listener_policy_rule_patch_model['type'] = 'body'
+ load_balancer_listener_policy_rule_patch_model['value'] = 'my-example-hostname-updated'
# Set up parameter values
+ load_balancer_id = 'testString'
+ listener_id = 'testString'
+ policy_id = 'testString'
id = 'testString'
- share_patch = share_patch_model
+ load_balancer_listener_policy_rule_patch = load_balancer_listener_policy_rule_patch_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "listener_id": listener_id,
+ "policy_id": policy_id,
+ "id": id,
+ "load_balancer_listener_policy_rule_patch": load_balancer_listener_policy_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_load_balancer_listener_policy_rule(**req_copy)
+
+ def test_update_load_balancer_listener_policy_rule_value_error_with_retries(self):
+ # Enable retries and run test_update_load_balancer_listener_policy_rule_value_error.
+ _service.enable_retries()
+ self.test_update_load_balancer_listener_policy_rule_value_error()
+
+ # Disable retries and run test_update_load_balancer_listener_policy_rule_value_error.
+ _service.disable_retries()
+ self.test_update_load_balancer_listener_policy_rule_value_error()
+
+
+class TestListLoadBalancerPools:
+ """
+ Test Class for list_load_balancer_pools
+ """
+
+ @responses.activate
+ def test_list_load_balancer_pools_all_params(self):
+ """
+ list_load_balancer_pools()
+ """
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/pools')
+ mock_response = '{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ load_balancer_id = 'testString'
# Invoke method
- response = _service.update_share(
- id,
- share_patch,
+ response = _service.list_load_balancer_pools(
+ load_balancer_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 == share_patch
- def test_update_share_required_params_with_retries(self):
- # Enable retries and run test_update_share_required_params.
+ def test_list_load_balancer_pools_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_pools_all_params.
_service.enable_retries()
- self.test_update_share_required_params()
+ self.test_list_load_balancer_pools_all_params()
- # Disable retries and run test_update_share_required_params.
+ # Disable retries and run test_list_load_balancer_pools_all_params.
_service.disable_retries()
- self.test_update_share_required_params()
+ self.test_list_load_balancer_pools_all_params()
@responses.activate
- def test_update_share_value_error(self):
+ def test_list_load_balancer_pools_value_error(self):
"""
- test_update_share_value_error()
+ test_list_load_balancer_pools_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString')
- mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ url = preprocess_url('/load_balancers/testString/pools')
+ mock_response = '{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ShareProfileIdentityByName model
- share_profile_identity_model = {}
- share_profile_identity_model['name'] = 'tier-3iops'
-
- # Construct a dict representation of a SharePatch model
- share_patch_model = {}
- share_patch_model['access_control_mode'] = 'security_group'
- share_patch_model['allowed_transit_encryption_modes'] = ['none']
- share_patch_model['iops'] = 100
- share_patch_model['name'] = 'my-share'
- share_patch_model['profile'] = share_profile_identity_model
- share_patch_model['replication_cron_spec'] = '0 */5 * * *'
- share_patch_model['size'] = 8000
- share_patch_model['user_tags'] = ['testString']
-
# Set up parameter values
- id = 'testString'
- share_patch = share_patch_model
+ load_balancer_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "share_patch": share_patch,
+ "load_balancer_id": load_balancer_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_share(**req_copy)
+ _service.list_load_balancer_pools(**req_copy)
- def test_update_share_value_error_with_retries(self):
- # Enable retries and run test_update_share_value_error.
+ def test_list_load_balancer_pools_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancer_pools_value_error.
_service.enable_retries()
- self.test_update_share_value_error()
+ self.test_list_load_balancer_pools_value_error()
- # Disable retries and run test_update_share_value_error.
+ # Disable retries and run test_list_load_balancer_pools_value_error.
_service.disable_retries()
- self.test_update_share_value_error()
+ self.test_list_load_balancer_pools_value_error()
-class TestListShareAccessorBindings:
+class TestCreateLoadBalancerPool:
"""
- Test Class for list_share_accessor_bindings
+ Test Class for create_load_balancer_pool
"""
@responses.activate
- def test_list_share_accessor_bindings_all_params(self):
+ def test_create_load_balancer_pool_all_params(self):
"""
- list_share_accessor_bindings()
+ create_load_balancer_pool()
"""
# Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings')
- mock_response = '{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/pools')
+ mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Set up parameter values
- id = 'testString'
- start = 'testString'
- limit = 50
+ # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
+ load_balancer_pool_health_monitor_prototype_model = {}
+ load_balancer_pool_health_monitor_prototype_model['delay'] = 5
+ load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
+ load_balancer_pool_health_monitor_prototype_model['port'] = 22
+ load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
+ load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
- # Invoke method
- response = _service.list_share_accessor_bindings(
- id,
- start=start,
- limit=limit,
- headers={},
- )
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
- # 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
+ # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPrototype model
+ load_balancer_pool_failsafe_policy_prototype_model = {}
+ load_balancer_pool_failsafe_policy_prototype_model['action'] = 'forward'
+ load_balancer_pool_failsafe_policy_prototype_model['target'] = load_balancer_pool_identity_model
- def test_list_share_accessor_bindings_all_params_with_retries(self):
- # Enable retries and run test_list_share_accessor_bindings_all_params.
- _service.enable_retries()
- self.test_list_share_accessor_bindings_all_params()
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
- # Disable retries and run test_list_share_accessor_bindings_all_params.
- _service.disable_retries()
- self.test_list_share_accessor_bindings_all_params()
+ # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
+ load_balancer_pool_member_prototype_model = {}
+ load_balancer_pool_member_prototype_model['port'] = 80
+ load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_prototype_model['weight'] = 50
- @responses.activate
- def test_list_share_accessor_bindings_required_params(self):
- """
- test_list_share_accessor_bindings_required_params()
- """
- # Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings')
- mock_response = '{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
+ load_balancer_pool_session_persistence_prototype_model = {}
+ load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
+ load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
# Set up parameter values
- id = 'testString'
+ load_balancer_id = 'testString'
+ algorithm = 'least_connections'
+ health_monitor = load_balancer_pool_health_monitor_prototype_model
+ protocol = 'http'
+ failsafe_policy = load_balancer_pool_failsafe_policy_prototype_model
+ members = [load_balancer_pool_member_prototype_model]
+ name = 'my-load-balancer-pool'
+ proxy_protocol = 'disabled'
+ session_persistence = load_balancer_pool_session_persistence_prototype_model
# Invoke method
- response = _service.list_share_accessor_bindings(
- id,
+ response = _service.create_load_balancer_pool(
+ load_balancer_id,
+ algorithm,
+ health_monitor,
+ protocol,
+ failsafe_policy=failsafe_policy,
+ members=members,
+ name=name,
+ proxy_protocol=proxy_protocol,
+ session_persistence=session_persistence,
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['algorithm'] == 'least_connections'
+ assert req_body['health_monitor'] == load_balancer_pool_health_monitor_prototype_model
+ assert req_body['protocol'] == 'http'
+ assert req_body['failsafe_policy'] == load_balancer_pool_failsafe_policy_prototype_model
+ assert req_body['members'] == [load_balancer_pool_member_prototype_model]
+ assert req_body['name'] == 'my-load-balancer-pool'
+ assert req_body['proxy_protocol'] == 'disabled'
+ assert req_body['session_persistence'] == load_balancer_pool_session_persistence_prototype_model
- def test_list_share_accessor_bindings_required_params_with_retries(self):
- # Enable retries and run test_list_share_accessor_bindings_required_params.
+ def test_create_load_balancer_pool_all_params_with_retries(self):
+ # Enable retries and run test_create_load_balancer_pool_all_params.
_service.enable_retries()
- self.test_list_share_accessor_bindings_required_params()
+ self.test_create_load_balancer_pool_all_params()
- # Disable retries and run test_list_share_accessor_bindings_required_params.
+ # Disable retries and run test_create_load_balancer_pool_all_params.
_service.disable_retries()
- self.test_list_share_accessor_bindings_required_params()
+ self.test_create_load_balancer_pool_all_params()
@responses.activate
- def test_list_share_accessor_bindings_value_error(self):
+ def test_create_load_balancer_pool_value_error(self):
"""
- test_list_share_accessor_bindings_value_error()
+ test_create_load_balancer_pool_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings')
- mock_response = '{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/pools')
+ mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
+ load_balancer_pool_health_monitor_prototype_model = {}
+ load_balancer_pool_health_monitor_prototype_model['delay'] = 5
+ load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
+ load_balancer_pool_health_monitor_prototype_model['port'] = 22
+ load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
+ load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
+
+ # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
+ load_balancer_pool_identity_model = {}
+ load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPrototype model
+ load_balancer_pool_failsafe_policy_prototype_model = {}
+ load_balancer_pool_failsafe_policy_prototype_model['action'] = 'forward'
+ load_balancer_pool_failsafe_policy_prototype_model['target'] = load_balancer_pool_identity_model
+
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
+ load_balancer_pool_member_prototype_model = {}
+ load_balancer_pool_member_prototype_model['port'] = 80
+ load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_prototype_model['weight'] = 50
+
+ # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
+ load_balancer_pool_session_persistence_prototype_model = {}
+ load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
+ load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
+
# Set up parameter values
- id = 'testString'
+ load_balancer_id = 'testString'
+ algorithm = 'least_connections'
+ health_monitor = load_balancer_pool_health_monitor_prototype_model
+ protocol = 'http'
+ failsafe_policy = load_balancer_pool_failsafe_policy_prototype_model
+ members = [load_balancer_pool_member_prototype_model]
+ name = 'my-load-balancer-pool'
+ proxy_protocol = 'disabled'
+ session_persistence = load_balancer_pool_session_persistence_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "load_balancer_id": load_balancer_id,
+ "algorithm": algorithm,
+ "health_monitor": health_monitor,
+ "protocol": protocol,
}
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_share_accessor_bindings(**req_copy)
+ _service.create_load_balancer_pool(**req_copy)
- def test_list_share_accessor_bindings_value_error_with_retries(self):
- # Enable retries and run test_list_share_accessor_bindings_value_error.
+ def test_create_load_balancer_pool_value_error_with_retries(self):
+ # Enable retries and run test_create_load_balancer_pool_value_error.
_service.enable_retries()
- self.test_list_share_accessor_bindings_value_error()
+ self.test_create_load_balancer_pool_value_error()
- # Disable retries and run test_list_share_accessor_bindings_value_error.
+ # Disable retries and run test_create_load_balancer_pool_value_error.
_service.disable_retries()
- self.test_list_share_accessor_bindings_value_error()
-
- @responses.activate
- def test_list_share_accessor_bindings_with_pager_get_next(self):
- """
- test_list_share_accessor_bindings_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/shares/testString/accessor_bindings')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
- mock_response2 = '{"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = ShareAccessorBindingsPager(
- client=_service,
- id='testString',
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_share_accessor_bindings_with_pager_get_all(self):
- """
- test_list_share_accessor_bindings_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/shares/testString/accessor_bindings')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
- mock_response2 = '{"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = ShareAccessorBindingsPager(
- client=_service,
- id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_create_load_balancer_pool_value_error()
-class TestDeleteShareAccessorBinding:
+class TestDeleteLoadBalancerPool:
"""
- Test Class for delete_share_accessor_binding
+ Test Class for delete_load_balancer_pool
"""
@responses.activate
- def test_delete_share_accessor_binding_all_params(self):
+ def test_delete_load_balancer_pool_all_params(self):
"""
- delete_share_accessor_binding()
+ delete_load_balancer_pool()
"""
# Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings/testString')
+ url = preprocess_url('/load_balancers/testString/pools/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_share_accessor_binding(
- share_id,
+ response = _service.delete_load_balancer_pool(
+ load_balancer_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_share_accessor_binding_all_params_with_retries(self):
- # Enable retries and run test_delete_share_accessor_binding_all_params.
+ def test_delete_load_balancer_pool_all_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_pool_all_params.
_service.enable_retries()
- self.test_delete_share_accessor_binding_all_params()
+ self.test_delete_load_balancer_pool_all_params()
- # Disable retries and run test_delete_share_accessor_binding_all_params.
+ # Disable retries and run test_delete_load_balancer_pool_all_params.
_service.disable_retries()
- self.test_delete_share_accessor_binding_all_params()
+ self.test_delete_load_balancer_pool_all_params()
@responses.activate
- def test_delete_share_accessor_binding_value_error(self):
+ def test_delete_load_balancer_pool_value_error(self):
"""
- test_delete_share_accessor_binding_value_error()
+ test_delete_load_balancer_pool_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings/testString')
+ url = preprocess_url('/load_balancers/testString/pools/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_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_share_accessor_binding(**req_copy)
+ _service.delete_load_balancer_pool(**req_copy)
- def test_delete_share_accessor_binding_value_error_with_retries(self):
- # Enable retries and run test_delete_share_accessor_binding_value_error.
+ def test_delete_load_balancer_pool_value_error_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_pool_value_error.
_service.enable_retries()
- self.test_delete_share_accessor_binding_value_error()
+ self.test_delete_load_balancer_pool_value_error()
- # Disable retries and run test_delete_share_accessor_binding_value_error.
+ # Disable retries and run test_delete_load_balancer_pool_value_error.
_service.disable_retries()
- self.test_delete_share_accessor_binding_value_error()
+ self.test_delete_load_balancer_pool_value_error()
-class TestGetShareAccessorBinding:
+class TestGetLoadBalancerPool:
"""
- Test Class for get_share_accessor_binding
+ Test Class for get_load_balancer_pool
"""
@responses.activate
- def test_get_share_accessor_binding_all_params(self):
+ def test_get_load_balancer_pool_all_params(self):
"""
- get_share_accessor_binding()
+ get_load_balancer_pool()
"""
# Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings/testString')
- mock_response = '{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}'
+ url = preprocess_url('/load_balancers/testString/pools/testString')
+ mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
responses.add(
responses.GET,
url,
@@ -28285,12 +28050,12 @@ def test_get_share_accessor_binding_all_params(self):
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_share_accessor_binding(
- share_id,
+ response = _service.get_load_balancer_pool(
+ load_balancer_id,
id,
headers={},
)
@@ -28299,23 +28064,23 @@ def test_get_share_accessor_binding_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_share_accessor_binding_all_params_with_retries(self):
- # Enable retries and run test_get_share_accessor_binding_all_params.
+ def test_get_load_balancer_pool_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_pool_all_params.
_service.enable_retries()
- self.test_get_share_accessor_binding_all_params()
+ self.test_get_load_balancer_pool_all_params()
- # Disable retries and run test_get_share_accessor_binding_all_params.
+ # Disable retries and run test_get_load_balancer_pool_all_params.
_service.disable_retries()
- self.test_get_share_accessor_binding_all_params()
+ self.test_get_load_balancer_pool_all_params()
@responses.activate
- def test_get_share_accessor_binding_value_error(self):
+ def test_get_load_balancer_pool_value_error(self):
"""
- test_get_share_accessor_binding_value_error()
+ test_get_load_balancer_pool_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/accessor_bindings/testString')
- mock_response = '{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}'
+ url = preprocess_url('/load_balancers/testString/pools/testString')
+ mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
responses.add(
responses.GET,
url,
@@ -28325,210 +28090,200 @@ def test_get_share_accessor_binding_value_error(self):
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_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_share_accessor_binding(**req_copy)
+ _service.get_load_balancer_pool(**req_copy)
- def test_get_share_accessor_binding_value_error_with_retries(self):
- # Enable retries and run test_get_share_accessor_binding_value_error.
+ def test_get_load_balancer_pool_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_pool_value_error.
_service.enable_retries()
- self.test_get_share_accessor_binding_value_error()
+ self.test_get_load_balancer_pool_value_error()
- # Disable retries and run test_get_share_accessor_binding_value_error.
+ # Disable retries and run test_get_load_balancer_pool_value_error.
_service.disable_retries()
- self.test_get_share_accessor_binding_value_error()
+ self.test_get_load_balancer_pool_value_error()
-class TestFailoverShare:
+class TestUpdateLoadBalancerPool:
"""
- Test Class for failover_share
+ Test Class for update_load_balancer_pool
"""
@responses.activate
- def test_failover_share_all_params(self):
+ def test_update_load_balancer_pool_all_params(self):
"""
- failover_share()
+ update_load_balancer_pool()
"""
# Set up mock
- url = preprocess_url('/shares/testString/failover')
+ url = preprocess_url('/load_balancers/testString/pools/testString')
+ mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
+ # Construct a dict representation of a LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityById model
+ load_balancer_pool_failsafe_policy_target_patch_model = {}
+ load_balancer_pool_failsafe_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+
+ # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPatch model
+ load_balancer_pool_failsafe_policy_patch_model = {}
+ load_balancer_pool_failsafe_policy_patch_model['action'] = 'forward'
+ load_balancer_pool_failsafe_policy_patch_model['target'] = load_balancer_pool_failsafe_policy_target_patch_model
+
+ # Construct a dict representation of a LoadBalancerPoolHealthMonitorPatch model
+ load_balancer_pool_health_monitor_patch_model = {}
+ load_balancer_pool_health_monitor_patch_model['delay'] = 5
+ load_balancer_pool_health_monitor_patch_model['max_retries'] = 2
+ load_balancer_pool_health_monitor_patch_model['port'] = 22
+ load_balancer_pool_health_monitor_patch_model['timeout'] = 2
+ load_balancer_pool_health_monitor_patch_model['type'] = 'http'
+ load_balancer_pool_health_monitor_patch_model['url_path'] = '/'
+
+ # Construct a dict representation of a LoadBalancerPoolSessionPersistencePatch model
+ load_balancer_pool_session_persistence_patch_model = {}
+ load_balancer_pool_session_persistence_patch_model['cookie_name'] = 'my-cookie-name'
+ load_balancer_pool_session_persistence_patch_model['type'] = 'app_cookie'
+
+ # Construct a dict representation of a LoadBalancerPoolPatch model
+ load_balancer_pool_patch_model = {}
+ load_balancer_pool_patch_model['algorithm'] = 'weighted_round_robin'
+ load_balancer_pool_patch_model['failsafe_policy'] = load_balancer_pool_failsafe_policy_patch_model
+ load_balancer_pool_patch_model['health_monitor'] = load_balancer_pool_health_monitor_patch_model
+ load_balancer_pool_patch_model['name'] = 'my-load-balancer-pool'
+ load_balancer_pool_patch_model['protocol'] = 'http'
+ load_balancer_pool_patch_model['proxy_protocol'] = 'disabled'
+ load_balancer_pool_patch_model['session_persistence'] = load_balancer_pool_session_persistence_patch_model
+
# Set up parameter values
- share_id = 'testString'
- fallback_policy = 'fail'
- timeout = 600
+ load_balancer_id = 'testString'
+ id = 'testString'
+ load_balancer_pool_patch = load_balancer_pool_patch_model
# Invoke method
- response = _service.failover_share(
- share_id,
- fallback_policy=fallback_policy,
- timeout=timeout,
+ response = _service.update_load_balancer_pool(
+ load_balancer_id,
+ id,
+ load_balancer_pool_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['fallback_policy'] == 'fail'
- assert req_body['timeout'] == 600
+ assert req_body == load_balancer_pool_patch
- def test_failover_share_all_params_with_retries(self):
- # Enable retries and run test_failover_share_all_params.
+ def test_update_load_balancer_pool_all_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_pool_all_params.
_service.enable_retries()
- self.test_failover_share_all_params()
+ self.test_update_load_balancer_pool_all_params()
- # Disable retries and run test_failover_share_all_params.
+ # Disable retries and run test_update_load_balancer_pool_all_params.
_service.disable_retries()
- self.test_failover_share_all_params()
+ self.test_update_load_balancer_pool_all_params()
@responses.activate
- def test_failover_share_required_params(self):
+ def test_update_load_balancer_pool_value_error(self):
"""
- test_failover_share_required_params()
+ test_update_load_balancer_pool_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/failover')
+ url = preprocess_url('/load_balancers/testString/pools/testString')
+ mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Set up parameter values
- share_id = 'testString'
-
- # Invoke method
- response = _service.failover_share(
- share_id,
- headers={},
- )
+ # Construct a dict representation of a LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityById model
+ load_balancer_pool_failsafe_policy_target_patch_model = {}
+ load_balancer_pool_failsafe_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
+ # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPatch model
+ load_balancer_pool_failsafe_policy_patch_model = {}
+ load_balancer_pool_failsafe_policy_patch_model['action'] = 'forward'
+ load_balancer_pool_failsafe_policy_patch_model['target'] = load_balancer_pool_failsafe_policy_target_patch_model
- def test_failover_share_required_params_with_retries(self):
- # Enable retries and run test_failover_share_required_params.
- _service.enable_retries()
- self.test_failover_share_required_params()
+ # Construct a dict representation of a LoadBalancerPoolHealthMonitorPatch model
+ load_balancer_pool_health_monitor_patch_model = {}
+ load_balancer_pool_health_monitor_patch_model['delay'] = 5
+ load_balancer_pool_health_monitor_patch_model['max_retries'] = 2
+ load_balancer_pool_health_monitor_patch_model['port'] = 22
+ load_balancer_pool_health_monitor_patch_model['timeout'] = 2
+ load_balancer_pool_health_monitor_patch_model['type'] = 'http'
+ load_balancer_pool_health_monitor_patch_model['url_path'] = '/'
- # Disable retries and run test_failover_share_required_params.
- _service.disable_retries()
- self.test_failover_share_required_params()
+ # Construct a dict representation of a LoadBalancerPoolSessionPersistencePatch model
+ load_balancer_pool_session_persistence_patch_model = {}
+ load_balancer_pool_session_persistence_patch_model['cookie_name'] = 'my-cookie-name'
+ load_balancer_pool_session_persistence_patch_model['type'] = 'app_cookie'
- @responses.activate
- def test_failover_share_value_error(self):
- """
- test_failover_share_value_error()
- """
- # Set up mock
- url = preprocess_url('/shares/testString/failover')
- responses.add(
- responses.POST,
- url,
- status=202,
- )
+ # Construct a dict representation of a LoadBalancerPoolPatch model
+ load_balancer_pool_patch_model = {}
+ load_balancer_pool_patch_model['algorithm'] = 'weighted_round_robin'
+ load_balancer_pool_patch_model['failsafe_policy'] = load_balancer_pool_failsafe_policy_patch_model
+ load_balancer_pool_patch_model['health_monitor'] = load_balancer_pool_health_monitor_patch_model
+ load_balancer_pool_patch_model['name'] = 'my-load-balancer-pool'
+ load_balancer_pool_patch_model['protocol'] = 'http'
+ load_balancer_pool_patch_model['proxy_protocol'] = 'disabled'
+ load_balancer_pool_patch_model['session_persistence'] = load_balancer_pool_session_persistence_patch_model
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ id = 'testString'
+ load_balancer_pool_patch = load_balancer_pool_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_id,
+ "id": id,
+ "load_balancer_pool_patch": load_balancer_pool_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.failover_share(**req_copy)
+ _service.update_load_balancer_pool(**req_copy)
- def test_failover_share_value_error_with_retries(self):
- # Enable retries and run test_failover_share_value_error.
+ def test_update_load_balancer_pool_value_error_with_retries(self):
+ # Enable retries and run test_update_load_balancer_pool_value_error.
_service.enable_retries()
- self.test_failover_share_value_error()
+ self.test_update_load_balancer_pool_value_error()
- # Disable retries and run test_failover_share_value_error.
+ # Disable retries and run test_update_load_balancer_pool_value_error.
_service.disable_retries()
- self.test_failover_share_value_error()
+ self.test_update_load_balancer_pool_value_error()
-class TestListShareMountTargets:
+class TestListLoadBalancerPoolMembers:
"""
- Test Class for list_share_mount_targets
+ Test Class for list_load_balancer_pool_members
"""
@responses.activate
- def test_list_share_mount_targets_all_params(self):
- """
- list_share_mount_targets()
- """
- # Set up mock
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- share_id = 'testString'
- name = 'my-name'
- start = 'testString'
- limit = 50
-
- # Invoke method
- response = _service.list_share_mount_targets(
- share_id,
- name=name,
- 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 'name={}'.format(name) in query_string
- assert 'start={}'.format(start) in query_string
- assert 'limit={}'.format(limit) in query_string
-
- def test_list_share_mount_targets_all_params_with_retries(self):
- # Enable retries and run test_list_share_mount_targets_all_params.
- _service.enable_retries()
- self.test_list_share_mount_targets_all_params()
-
- # Disable retries and run test_list_share_mount_targets_all_params.
- _service.disable_retries()
- self.test_list_share_mount_targets_all_params()
-
- @responses.activate
- def test_list_share_mount_targets_required_params(self):
+ def test_list_load_balancer_pool_members_all_params(self):
"""
- test_list_share_mount_targets_required_params()
+ list_load_balancer_pool_members()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members')
+ mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
responses.add(
responses.GET,
url,
@@ -28538,11 +28293,13 @@ def test_list_share_mount_targets_required_params(self):
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
# Invoke method
- response = _service.list_share_mount_targets(
- share_id,
+ response = _service.list_load_balancer_pool_members(
+ load_balancer_id,
+ pool_id,
headers={},
)
@@ -28550,23 +28307,23 @@ def test_list_share_mount_targets_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_share_mount_targets_required_params_with_retries(self):
- # Enable retries and run test_list_share_mount_targets_required_params.
+ def test_list_load_balancer_pool_members_all_params_with_retries(self):
+ # Enable retries and run test_list_load_balancer_pool_members_all_params.
_service.enable_retries()
- self.test_list_share_mount_targets_required_params()
+ self.test_list_load_balancer_pool_members_all_params()
- # Disable retries and run test_list_share_mount_targets_required_params.
+ # Disable retries and run test_list_load_balancer_pool_members_all_params.
_service.disable_retries()
- self.test_list_share_mount_targets_required_params()
+ self.test_list_load_balancer_pool_members_all_params()
@responses.activate
- def test_list_share_mount_targets_value_error(self):
+ def test_list_load_balancer_pool_members_value_error(self):
"""
- test_list_share_mount_targets_value_error()
+ test_list_load_balancer_pool_members_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members')
+ mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
responses.add(
responses.GET,
url,
@@ -28576,302 +28333,277 @@ def test_list_share_mount_targets_value_error(self):
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_id,
+ "pool_id": pool_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_share_mount_targets(**req_copy)
+ _service.list_load_balancer_pool_members(**req_copy)
- def test_list_share_mount_targets_value_error_with_retries(self):
- # Enable retries and run test_list_share_mount_targets_value_error.
+ def test_list_load_balancer_pool_members_value_error_with_retries(self):
+ # Enable retries and run test_list_load_balancer_pool_members_value_error.
_service.enable_retries()
- self.test_list_share_mount_targets_value_error()
+ self.test_list_load_balancer_pool_members_value_error()
- # Disable retries and run test_list_share_mount_targets_value_error.
+ # Disable retries and run test_list_load_balancer_pool_members_value_error.
_service.disable_retries()
- self.test_list_share_mount_targets_value_error()
+ self.test_list_load_balancer_pool_members_value_error()
+
+
+class TestCreateLoadBalancerPoolMember:
+ """
+ Test Class for create_load_balancer_pool_member
+ """
@responses.activate
- def test_list_share_mount_targets_with_pager_get_next(self):
+ def test_create_load_balancer_pool_member_all_params(self):
"""
- test_list_share_mount_targets_with_pager_get_next()
+ create_load_balancer_pool_member()
"""
- # Set up a two-page mock response
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/pools/testString/members')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = ShareMountTargetsPager(
- client=_service,
- share_id='testString',
- name='my-name',
- limit=10,
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
+ port = 80
+ target = load_balancer_pool_member_target_prototype_model
+ weight = 50
+
+ # Invoke method
+ response = _service.create_load_balancer_pool_member(
+ load_balancer_id,
+ pool_id,
+ port,
+ target,
+ weight=weight,
+ headers={},
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+
+ # 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['port'] == 80
+ assert req_body['target'] == load_balancer_pool_member_target_prototype_model
+ assert req_body['weight'] == 50
+
+ def test_create_load_balancer_pool_member_all_params_with_retries(self):
+ # Enable retries and run test_create_load_balancer_pool_member_all_params.
+ _service.enable_retries()
+ self.test_create_load_balancer_pool_member_all_params()
+
+ # Disable retries and run test_create_load_balancer_pool_member_all_params.
+ _service.disable_retries()
+ self.test_create_load_balancer_pool_member_all_params()
@responses.activate
- def test_list_share_mount_targets_with_pager_get_all(self):
+ def test_create_load_balancer_pool_member_value_error(self):
"""
- test_list_share_mount_targets_with_pager_get_all()
+ test_create_load_balancer_pool_member_value_error()
"""
- # Set up a two-page mock response
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/load_balancers/testString/pools/testString/members')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Exercise the pager class for this operation
- pager = ShareMountTargetsPager(
- client=_service,
- share_id='testString',
- name='my-name',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+ # Set up parameter values
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
+ port = 80
+ target = load_balancer_pool_member_target_prototype_model
+ weight = 50
-class TestCreateShareMountTarget:
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "load_balancer_id": load_balancer_id,
+ "pool_id": pool_id,
+ "port": port,
+ "target": target,
+ }
+ 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_load_balancer_pool_member(**req_copy)
+
+ def test_create_load_balancer_pool_member_value_error_with_retries(self):
+ # Enable retries and run test_create_load_balancer_pool_member_value_error.
+ _service.enable_retries()
+ self.test_create_load_balancer_pool_member_value_error()
+
+ # Disable retries and run test_create_load_balancer_pool_member_value_error.
+ _service.disable_retries()
+ self.test_create_load_balancer_pool_member_value_error()
+
+
+class TestReplaceLoadBalancerPoolMembers:
"""
- Test Class for create_share_mount_target
+ Test Class for replace_load_balancer_pool_members
"""
@responses.activate
- def test_create_share_mount_target_all_params(self):
+ def test_replace_load_balancer_pool_members_all_params(self):
"""
- create_share_mount_target()
+ replace_load_balancer_pool_members()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members')
+ mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
responses.add(
- responses.POST,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
- share_mount_target_virtual_network_interface_prototype_model = {}
- share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
- share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
- share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
- share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
- share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
- share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
- share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
- share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
- # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
- share_mount_target_prototype_model = {}
- share_mount_target_prototype_model['name'] = 'my-share-mount-target'
- share_mount_target_prototype_model['transit_encryption'] = 'none'
- share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
+ # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
+ load_balancer_pool_member_prototype_model = {}
+ load_balancer_pool_member_prototype_model['port'] = 80
+ load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_prototype_model['weight'] = 50
# Set up parameter values
- share_id = 'testString'
- share_mount_target_prototype = share_mount_target_prototype_model
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
+ members = [load_balancer_pool_member_prototype_model]
# Invoke method
- response = _service.create_share_mount_target(
- share_id,
- share_mount_target_prototype,
+ response = _service.replace_load_balancer_pool_members(
+ load_balancer_id,
+ pool_id,
+ members,
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 == share_mount_target_prototype
+ assert req_body['members'] == [load_balancer_pool_member_prototype_model]
- def test_create_share_mount_target_all_params_with_retries(self):
- # Enable retries and run test_create_share_mount_target_all_params.
+ def test_replace_load_balancer_pool_members_all_params_with_retries(self):
+ # Enable retries and run test_replace_load_balancer_pool_members_all_params.
_service.enable_retries()
- self.test_create_share_mount_target_all_params()
+ self.test_replace_load_balancer_pool_members_all_params()
- # Disable retries and run test_create_share_mount_target_all_params.
+ # Disable retries and run test_replace_load_balancer_pool_members_all_params.
_service.disable_retries()
- self.test_create_share_mount_target_all_params()
+ self.test_replace_load_balancer_pool_members_all_params()
@responses.activate
- def test_create_share_mount_target_value_error(self):
+ def test_replace_load_balancer_pool_members_value_error(self):
"""
- test_create_share_mount_target_value_error()
+ test_replace_load_balancer_pool_members_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members')
+ mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
responses.add(
- responses.POST,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
- share_mount_target_virtual_network_interface_prototype_model = {}
- share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
- share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
- share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
- share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
- share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
- share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
- share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
- share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
- # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
- share_mount_target_prototype_model = {}
- share_mount_target_prototype_model['name'] = 'my-share-mount-target'
- share_mount_target_prototype_model['transit_encryption'] = 'none'
- share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
+ # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
+ load_balancer_pool_member_prototype_model = {}
+ load_balancer_pool_member_prototype_model['port'] = 80
+ load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_prototype_model['weight'] = 50
# Set up parameter values
- share_id = 'testString'
- share_mount_target_prototype = share_mount_target_prototype_model
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
+ members = [load_balancer_pool_member_prototype_model]
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
- "share_mount_target_prototype": share_mount_target_prototype,
+ "load_balancer_id": load_balancer_id,
+ "pool_id": pool_id,
+ "members": members,
}
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_share_mount_target(**req_copy)
+ _service.replace_load_balancer_pool_members(**req_copy)
- def test_create_share_mount_target_value_error_with_retries(self):
- # Enable retries and run test_create_share_mount_target_value_error.
+ def test_replace_load_balancer_pool_members_value_error_with_retries(self):
+ # Enable retries and run test_replace_load_balancer_pool_members_value_error.
_service.enable_retries()
- self.test_create_share_mount_target_value_error()
+ self.test_replace_load_balancer_pool_members_value_error()
- # Disable retries and run test_create_share_mount_target_value_error.
+ # Disable retries and run test_replace_load_balancer_pool_members_value_error.
_service.disable_retries()
- self.test_create_share_mount_target_value_error()
+ self.test_replace_load_balancer_pool_members_value_error()
-class TestDeleteShareMountTarget:
+class TestDeleteLoadBalancerPoolMember:
"""
- Test Class for delete_share_mount_target
+ Test Class for delete_load_balancer_pool_member
"""
@responses.activate
- def test_delete_share_mount_target_all_params(self):
+ def test_delete_load_balancer_pool_member_all_params(self):
"""
- delete_share_mount_target()
+ delete_load_balancer_pool_member()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets/testString')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
status=202,
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_share_mount_target(
- share_id,
+ response = _service.delete_load_balancer_pool_member(
+ load_balancer_id,
+ pool_id,
id,
headers={},
)
@@ -28880,68 +28612,67 @@ def test_delete_share_mount_target_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 202
- def test_delete_share_mount_target_all_params_with_retries(self):
- # Enable retries and run test_delete_share_mount_target_all_params.
+ def test_delete_load_balancer_pool_member_all_params_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_pool_member_all_params.
_service.enable_retries()
- self.test_delete_share_mount_target_all_params()
+ self.test_delete_load_balancer_pool_member_all_params()
- # Disable retries and run test_delete_share_mount_target_all_params.
+ # Disable retries and run test_delete_load_balancer_pool_member_all_params.
_service.disable_retries()
- self.test_delete_share_mount_target_all_params()
+ self.test_delete_load_balancer_pool_member_all_params()
@responses.activate
- def test_delete_share_mount_target_value_error(self):
+ def test_delete_load_balancer_pool_member_value_error(self):
"""
- test_delete_share_mount_target_value_error()
+ test_delete_load_balancer_pool_member_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets/testString')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
status=202,
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_id,
+ "pool_id": pool_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_share_mount_target(**req_copy)
+ _service.delete_load_balancer_pool_member(**req_copy)
- def test_delete_share_mount_target_value_error_with_retries(self):
- # Enable retries and run test_delete_share_mount_target_value_error.
+ def test_delete_load_balancer_pool_member_value_error_with_retries(self):
+ # Enable retries and run test_delete_load_balancer_pool_member_value_error.
_service.enable_retries()
- self.test_delete_share_mount_target_value_error()
+ self.test_delete_load_balancer_pool_member_value_error()
- # Disable retries and run test_delete_share_mount_target_value_error.
+ # Disable retries and run test_delete_load_balancer_pool_member_value_error.
_service.disable_retries()
- self.test_delete_share_mount_target_value_error()
+ self.test_delete_load_balancer_pool_member_value_error()
-class TestGetShareMountTarget:
+class TestGetLoadBalancerPoolMember:
"""
- Test Class for get_share_mount_target
+ Test Class for get_load_balancer_pool_member
"""
@responses.activate
- def test_get_share_mount_target_all_params(self):
+ def test_get_load_balancer_pool_member_all_params(self):
"""
- get_share_mount_target()
+ get_load_balancer_pool_member()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets/testString')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
responses.add(
responses.GET,
url,
@@ -28951,12 +28682,14 @@ def test_get_share_mount_target_all_params(self):
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_share_mount_target(
- share_id,
+ response = _service.get_load_balancer_pool_member(
+ load_balancer_id,
+ pool_id,
id,
headers={},
)
@@ -28965,23 +28698,23 @@ def test_get_share_mount_target_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_share_mount_target_all_params_with_retries(self):
- # Enable retries and run test_get_share_mount_target_all_params.
+ def test_get_load_balancer_pool_member_all_params_with_retries(self):
+ # Enable retries and run test_get_load_balancer_pool_member_all_params.
_service.enable_retries()
- self.test_get_share_mount_target_all_params()
+ self.test_get_load_balancer_pool_member_all_params()
- # Disable retries and run test_get_share_mount_target_all_params.
+ # Disable retries and run test_get_load_balancer_pool_member_all_params.
_service.disable_retries()
- self.test_get_share_mount_target_all_params()
+ self.test_get_load_balancer_pool_member_all_params()
@responses.activate
- def test_get_share_mount_target_value_error(self):
+ def test_get_load_balancer_pool_member_value_error(self):
"""
- test_get_share_mount_target_value_error()
+ test_get_load_balancer_pool_member_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets/testString')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
responses.add(
responses.GET,
url,
@@ -28991,42 +28724,44 @@ def test_get_share_mount_target_value_error(self):
)
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_id,
+ "pool_id": pool_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_share_mount_target(**req_copy)
+ _service.get_load_balancer_pool_member(**req_copy)
- def test_get_share_mount_target_value_error_with_retries(self):
- # Enable retries and run test_get_share_mount_target_value_error.
+ def test_get_load_balancer_pool_member_value_error_with_retries(self):
+ # Enable retries and run test_get_load_balancer_pool_member_value_error.
_service.enable_retries()
- self.test_get_share_mount_target_value_error()
+ self.test_get_load_balancer_pool_member_value_error()
- # Disable retries and run test_get_share_mount_target_value_error.
+ # Disable retries and run test_get_load_balancer_pool_member_value_error.
_service.disable_retries()
- self.test_get_share_mount_target_value_error()
+ self.test_get_load_balancer_pool_member_value_error()
-class TestUpdateShareMountTarget:
+class TestUpdateLoadBalancerPoolMember:
"""
- Test Class for update_share_mount_target
+ Test Class for update_load_balancer_pool_member
"""
@responses.activate
- def test_update_share_mount_target_all_params(self):
+ def test_update_load_balancer_pool_member_all_params(self):
"""
- update_share_mount_target()
+ update_load_balancer_pool_member()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets/testString')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
responses.add(
responses.PATCH,
url,
@@ -29035,20 +28770,28 @@ def test_update_share_mount_target_all_params(self):
status=200,
)
- # Construct a dict representation of a ShareMountTargetPatch model
- share_mount_target_patch_model = {}
- share_mount_target_patch_model['name'] = 'my-share-mount-target'
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberPatch model
+ load_balancer_pool_member_patch_model = {}
+ load_balancer_pool_member_patch_model['port'] = 80
+ load_balancer_pool_member_patch_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_patch_model['weight'] = 99
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
id = 'testString'
- share_mount_target_patch = share_mount_target_patch_model
+ load_balancer_pool_member_patch = load_balancer_pool_member_patch_model
# Invoke method
- response = _service.update_share_mount_target(
- share_id,
+ response = _service.update_load_balancer_pool_member(
+ load_balancer_id,
+ pool_id,
id,
- share_mount_target_patch,
+ load_balancer_pool_member_patch,
headers={},
)
@@ -29057,25 +28800,25 @@ def test_update_share_mount_target_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 == share_mount_target_patch
-
- def test_update_share_mount_target_all_params_with_retries(self):
- # Enable retries and run test_update_share_mount_target_all_params.
+ assert req_body == load_balancer_pool_member_patch
+
+ def test_update_load_balancer_pool_member_all_params_with_retries(self):
+ # Enable retries and run test_update_load_balancer_pool_member_all_params.
_service.enable_retries()
- self.test_update_share_mount_target_all_params()
+ self.test_update_load_balancer_pool_member_all_params()
- # Disable retries and run test_update_share_mount_target_all_params.
+ # Disable retries and run test_update_load_balancer_pool_member_all_params.
_service.disable_retries()
- self.test_update_share_mount_target_all_params()
+ self.test_update_load_balancer_pool_member_all_params()
@responses.activate
- def test_update_share_mount_target_value_error(self):
+ def test_update_load_balancer_pool_member_value_error(self):
"""
- test_update_share_mount_target_value_error()
+ test_update_load_balancer_pool_member_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/mount_targets/testString')
- mock_response = '{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
responses.add(
responses.PATCH,
url,
@@ -29084,49 +28827,114 @@ def test_update_share_mount_target_value_error(self):
status=200,
)
- # Construct a dict representation of a ShareMountTargetPatch model
- share_mount_target_patch_model = {}
- share_mount_target_patch_model['name'] = 'my-share-mount-target'
+ # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
+ load_balancer_pool_member_target_prototype_model = {}
+ load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+
+ # Construct a dict representation of a LoadBalancerPoolMemberPatch model
+ load_balancer_pool_member_patch_model = {}
+ load_balancer_pool_member_patch_model['port'] = 80
+ load_balancer_pool_member_patch_model['target'] = load_balancer_pool_member_target_prototype_model
+ load_balancer_pool_member_patch_model['weight'] = 99
# Set up parameter values
- share_id = 'testString'
+ load_balancer_id = 'testString'
+ pool_id = 'testString'
id = 'testString'
- share_mount_target_patch = share_mount_target_patch_model
+ load_balancer_pool_member_patch = load_balancer_pool_member_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "load_balancer_id": load_balancer_id,
+ "pool_id": pool_id,
"id": id,
- "share_mount_target_patch": share_mount_target_patch,
+ "load_balancer_pool_member_patch": load_balancer_pool_member_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_share_mount_target(**req_copy)
+ _service.update_load_balancer_pool_member(**req_copy)
- def test_update_share_mount_target_value_error_with_retries(self):
- # Enable retries and run test_update_share_mount_target_value_error.
+ def test_update_load_balancer_pool_member_value_error_with_retries(self):
+ # Enable retries and run test_update_load_balancer_pool_member_value_error.
_service.enable_retries()
- self.test_update_share_mount_target_value_error()
+ self.test_update_load_balancer_pool_member_value_error()
- # Disable retries and run test_update_share_mount_target_value_error.
+ # Disable retries and run test_update_load_balancer_pool_member_value_error.
_service.disable_retries()
- self.test_update_share_mount_target_value_error()
+ self.test_update_load_balancer_pool_member_value_error()
-class TestListShareSnapshots:
+# endregion
+##############################################################################
+# End of Service: LoadBalancers
+##############################################################################
+
+##############################################################################
+# Start of Service: NetworkACLs
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_share_snapshots
+ 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 TestListNetworkAcls:
+ """
+ Test Class for list_network_acls
"""
@responses.activate
- def test_list_share_snapshots_all_params(self):
+ def test_list_network_acls_all_params(self):
"""
- list_share_snapshots()
+ list_network_acls()
"""
# Set up mock
- url = preprocess_url('/shares/testString/snapshots')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -29136,21 +28944,15 @@ def test_list_share_snapshots_all_params(self):
)
# Set up parameter values
- share_id = 'testString'
- backup_policy_plan_id = 'testString'
- name = 'my-name'
start = 'testString'
limit = 50
- sort = 'name'
+ resource_group_id = 'testString'
# Invoke method
- response = _service.list_share_snapshots(
- share_id,
- backup_policy_plan_id=backup_policy_plan_id,
- name=name,
+ response = _service.list_network_acls(
start=start,
limit=limit,
- sort=sort,
+ resource_group_id=resource_group_id,
headers={},
)
@@ -29160,29 +28962,27 @@ def test_list_share_snapshots_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 'backup_policy_plan.id={}'.format(backup_policy_plan_id) in query_string
- assert 'name={}'.format(name) in query_string
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- assert 'sort={}'.format(sort) in query_string
+ assert 'resource_group.id={}'.format(resource_group_id) in query_string
- def test_list_share_snapshots_all_params_with_retries(self):
- # Enable retries and run test_list_share_snapshots_all_params.
+ 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_share_snapshots_all_params()
+ self.test_list_network_acls_all_params()
- # Disable retries and run test_list_share_snapshots_all_params.
+ # Disable retries and run test_list_network_acls_all_params.
_service.disable_retries()
- self.test_list_share_snapshots_all_params()
+ self.test_list_network_acls_all_params()
@responses.activate
- def test_list_share_snapshots_required_params(self):
+ def test_list_network_acls_required_params(self):
"""
- test_list_share_snapshots_required_params()
+ test_list_network_acls_required_params()
"""
# Set up mock
- url = preprocess_url('/shares/testString/snapshots')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -29191,36 +28991,30 @@ def test_list_share_snapshots_required_params(self):
status=200,
)
- # Set up parameter values
- share_id = 'testString'
-
# Invoke method
- response = _service.list_share_snapshots(
- share_id,
- headers={},
- )
+ response = _service.list_network_acls()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_share_snapshots_required_params_with_retries(self):
- # Enable retries and run test_list_share_snapshots_required_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_share_snapshots_required_params()
+ self.test_list_network_acls_required_params()
- # Disable retries and run test_list_share_snapshots_required_params.
+ # Disable retries and run test_list_network_acls_required_params.
_service.disable_retries()
- self.test_list_share_snapshots_required_params()
+ self.test_list_network_acls_required_params()
@responses.activate
- def test_list_share_snapshots_value_error(self):
+ def test_list_network_acls_value_error(self):
"""
- test_list_share_snapshots_value_error()
+ test_list_network_acls_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/snapshots')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -29229,36 +29023,32 @@ def test_list_share_snapshots_value_error(self):
status=200,
)
- # Set up parameter values
- share_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_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_share_snapshots(**req_copy)
+ _service.list_network_acls(**req_copy)
- def test_list_share_snapshots_value_error_with_retries(self):
- # Enable retries and run test_list_share_snapshots_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_share_snapshots_value_error()
+ self.test_list_network_acls_value_error()
- # Disable retries and run test_list_share_snapshots_value_error.
+ # Disable retries and run test_list_network_acls_value_error.
_service.disable_retries()
- self.test_list_share_snapshots_value_error()
+ self.test_list_network_acls_value_error()
@responses.activate
- def test_list_share_snapshots_with_pager_get_next(self):
+ def test_list_network_acls_with_pager_get_next(self):
"""
- test_list_share_snapshots_with_pager_get_next()
+ test_list_network_acls_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/shares/testString/snapshots')
- mock_response1 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/network_acls')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -29276,13 +29066,10 @@ def test_list_share_snapshots_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = ShareSnapshotsPager(
+ pager = NetworkAclsPager(
client=_service,
- share_id='testString',
- backup_policy_plan_id='testString',
- name='my-name',
limit=10,
- sort='name',
+ resource_group_id='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -29291,14 +29078,14 @@ def test_list_share_snapshots_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_share_snapshots_with_pager_get_all(self):
+ def test_list_network_acls_with_pager_get_all(self):
"""
- test_list_share_snapshots_with_pager_get_all()
+ test_list_network_acls_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/shares/testString/snapshots')
- mock_response1 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/network_acls')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -29315,32 +29102,29 @@ def test_list_share_snapshots_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = ShareSnapshotsPager(
+ pager = NetworkAclsPager(
client=_service,
- share_id='testString',
- backup_policy_plan_id='testString',
- name='my-name',
limit=10,
- sort='name',
+ resource_group_id='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateShareSnapshot:
+class TestCreateNetworkAcl:
"""
- Test Class for create_share_snapshot
+ Test Class for create_network_acl
"""
@responses.activate
- def test_create_share_snapshot_all_params(self):
+ def test_create_network_acl_all_params(self):
"""
- create_share_snapshot()
+ create_network_acl()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -29349,16 +29133,37 @@ def test_create_share_snapshot_all_params(self):
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'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
+ network_acl_rule_prototype_network_acl_context_model['name'] = 'my-network-acl-rule'
+ network_acl_rule_prototype_network_acl_context_model['source'] = '192.168.3.2/32'
+ network_acl_rule_prototype_network_acl_context_model['protocol'] = 'all'
+
+ # 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
- share_id = 'testString'
- name = 'my-share-snapshot'
- user_tags = ['testString']
+ network_acl_prototype = network_acl_prototype_model
# Invoke method
- response = _service.create_share_snapshot(
- share_id,
- name=name,
- user_tags=user_tags,
+ response = _service.create_network_acl(
+ network_acl_prototype,
headers={},
)
@@ -29367,26 +29172,25 @@ def test_create_share_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['name'] == 'my-share-snapshot'
- assert req_body['user_tags'] == ['testString']
+ assert req_body == network_acl_prototype
- def test_create_share_snapshot_all_params_with_retries(self):
- # Enable retries and run test_create_share_snapshot_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_create_share_snapshot_all_params()
+ self.test_create_network_acl_all_params()
- # Disable retries and run test_create_share_snapshot_all_params.
+ # Disable retries and run test_create_network_acl_all_params.
_service.disable_retries()
- self.test_create_share_snapshot_all_params()
+ self.test_create_network_acl_all_params()
@responses.activate
- def test_create_share_snapshot_value_error(self):
+ def test_create_network_acl_value_error(self):
"""
- test_create_share_snapshot_value_error()
+ test_create_network_acl_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -29395,631 +29199,719 @@ def test_create_share_snapshot_value_error(self):
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'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
+ network_acl_rule_prototype_network_acl_context_model['name'] = 'my-network-acl-rule'
+ network_acl_rule_prototype_network_acl_context_model['source'] = '192.168.3.2/32'
+ network_acl_rule_prototype_network_acl_context_model['protocol'] = 'all'
+
+ # 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
- share_id = 'testString'
- name = 'my-share-snapshot'
- user_tags = ['testString']
+ network_acl_prototype = network_acl_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "network_acl_prototype": network_acl_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_share_snapshot(**req_copy)
+ _service.create_network_acl(**req_copy)
- def test_create_share_snapshot_value_error_with_retries(self):
- # Enable retries and run test_create_share_snapshot_value_error.
+ 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_share_snapshot_value_error()
+ self.test_create_network_acl_value_error()
- # Disable retries and run test_create_share_snapshot_value_error.
+ # Disable retries and run test_create_network_acl_value_error.
_service.disable_retries()
- self.test_create_share_snapshot_value_error()
+ self.test_create_network_acl_value_error()
-class TestDeleteShareSnapshot:
+class TestDeleteNetworkAcl:
"""
- Test Class for delete_share_snapshot
+ Test Class for delete_network_acl
"""
@responses.activate
- def test_delete_share_snapshot_all_params(self):
+ def test_delete_network_acl_all_params(self):
"""
- delete_share_snapshot()
+ delete_network_acl()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ 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 = {
+ "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)
+
+ 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_delete_network_acl_value_error()
+
+ # Disable retries and run test_delete_network_acl_value_error.
+ _service.disable_retries()
+ self.test_delete_network_acl_value_error()
+
+
+class TestGetNetworkAcl:
+ """
+ Test Class for get_network_acl
+ """
+
+ @responses.activate
+ def test_get_network_acl_all_params(self):
+ """
+ get_network_acl()
+ """
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ responses.add(
+ responses.GET,
+ url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- share_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_share_snapshot(
- share_id,
+ response = _service.get_network_acl(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_share_snapshot_all_params_with_retries(self):
- # Enable retries and run test_delete_share_snapshot_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_delete_share_snapshot_all_params()
+ self.test_get_network_acl_all_params()
- # Disable retries and run test_delete_share_snapshot_all_params.
+ # Disable retries and run test_get_network_acl_all_params.
_service.disable_retries()
- self.test_delete_share_snapshot_all_params()
+ self.test_get_network_acl_all_params()
@responses.activate
- def test_delete_share_snapshot_value_error(self):
+ def test_get_network_acl_value_error(self):
"""
- test_delete_share_snapshot_value_error()
+ test_get_network_acl_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- share_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_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_share_snapshot(**req_copy)
+ _service.get_network_acl(**req_copy)
- def test_delete_share_snapshot_value_error_with_retries(self):
- # Enable retries and run test_delete_share_snapshot_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_delete_share_snapshot_value_error()
+ self.test_get_network_acl_value_error()
- # Disable retries and run test_delete_share_snapshot_value_error.
+ # Disable retries and run test_get_network_acl_value_error.
_service.disable_retries()
- self.test_delete_share_snapshot_value_error()
+ self.test_get_network_acl_value_error()
-class TestGetShareSnapshot:
+class TestUpdateNetworkAcl:
"""
- Test Class for get_share_snapshot
+ Test Class for update_network_acl
"""
@responses.activate
- def test_get_share_snapshot_all_params(self):
+ def test_update_network_acl_all_params(self):
"""
- get_share_snapshot()
+ update_network_acl()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ 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-updated'
+
# Set up parameter values
- share_id = 'testString'
id = 'testString'
+ network_acl_patch = network_acl_patch_model
# Invoke method
- response = _service.get_share_snapshot(
- share_id,
+ 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_share_snapshot_all_params_with_retries(self):
- # Enable retries and run test_get_share_snapshot_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_share_snapshot_all_params()
+ self.test_update_network_acl_all_params()
- # Disable retries and run test_get_share_snapshot_all_params.
+ # Disable retries and run test_update_network_acl_all_params.
_service.disable_retries()
- self.test_get_share_snapshot_all_params()
+ self.test_update_network_acl_all_params()
@responses.activate
- def test_get_share_snapshot_value_error(self):
+ def test_update_network_acl_value_error(self):
"""
- test_get_share_snapshot_value_error()
+ test_update_network_acl_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ 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-updated'
+
# Set up parameter values
- share_id = '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 = {
- "share_id": share_id,
"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_share_snapshot(**req_copy)
+ _service.update_network_acl(**req_copy)
- def test_get_share_snapshot_value_error_with_retries(self):
- # Enable retries and run test_get_share_snapshot_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_share_snapshot_value_error()
+ self.test_update_network_acl_value_error()
- # Disable retries and run test_get_share_snapshot_value_error.
+ # Disable retries and run test_update_network_acl_value_error.
_service.disable_retries()
- self.test_get_share_snapshot_value_error()
+ self.test_update_network_acl_value_error()
-class TestUpdateShareSnapshot:
+class TestListNetworkAclRules:
"""
- Test Class for update_share_snapshot
+ Test Class for list_network_acl_rules
"""
@responses.activate
- def test_update_share_snapshot_all_params(self):
+ def test_list_network_acl_rules_all_params(self):
"""
- update_share_snapshot()
+ list_network_acl_rules()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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 = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ShareSnapshotPatch model
- share_snapshot_patch_model = {}
- share_snapshot_patch_model['user_tags'] = ['testString']
-
# Set up parameter values
- share_id = 'testString'
- id = 'testString'
- share_snapshot_patch = share_snapshot_patch_model
- if_match = 'W/96d225c4-56bd-43d9-98fc-d7148e5c5028'
+ network_acl_id = 'testString'
+ start = 'testString'
+ limit = 50
+ direction = 'inbound'
# Invoke method
- response = _service.update_share_snapshot(
- share_id,
- id,
- share_snapshot_patch,
- if_match=if_match,
+ response = _service.list_network_acl_rules(
+ network_acl_id,
+ start=start,
+ limit=limit,
+ direction=direction,
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 == share_snapshot_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 'direction={}'.format(direction) in query_string
- def test_update_share_snapshot_all_params_with_retries(self):
- # Enable retries and run test_update_share_snapshot_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_update_share_snapshot_all_params()
+ self.test_list_network_acl_rules_all_params()
- # Disable retries and run test_update_share_snapshot_all_params.
+ # Disable retries and run test_list_network_acl_rules_all_params.
_service.disable_retries()
- self.test_update_share_snapshot_all_params()
+ self.test_list_network_acl_rules_all_params()
@responses.activate
- def test_update_share_snapshot_required_params(self):
+ def test_list_network_acl_rules_required_params(self):
"""
- test_update_share_snapshot_required_params()
+ test_list_network_acl_rules_required_params()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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 = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ShareSnapshotPatch model
- share_snapshot_patch_model = {}
- share_snapshot_patch_model['user_tags'] = ['testString']
-
# Set up parameter values
- share_id = 'testString'
- id = 'testString'
- share_snapshot_patch = share_snapshot_patch_model
+ network_acl_id = 'testString'
# Invoke method
- response = _service.update_share_snapshot(
- share_id,
- id,
- share_snapshot_patch,
+ response = _service.list_network_acl_rules(
+ network_acl_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 == share_snapshot_patch
- def test_update_share_snapshot_required_params_with_retries(self):
- # Enable retries and run test_update_share_snapshot_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_update_share_snapshot_required_params()
+ self.test_list_network_acl_rules_required_params()
- # Disable retries and run test_update_share_snapshot_required_params.
+ # Disable retries and run test_list_network_acl_rules_required_params.
_service.disable_retries()
- self.test_update_share_snapshot_required_params()
+ self.test_list_network_acl_rules_required_params()
@responses.activate
- def test_update_share_snapshot_value_error(self):
+ def test_list_network_acl_rules_value_error(self):
"""
- test_update_share_snapshot_value_error()
+ test_list_network_acl_rules_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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 = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ShareSnapshotPatch model
- share_snapshot_patch_model = {}
- share_snapshot_patch_model['user_tags'] = ['testString']
-
# Set up parameter values
- share_id = 'testString'
- id = 'testString'
- share_snapshot_patch = share_snapshot_patch_model
+ network_acl_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
- "id": id,
- "share_snapshot_patch": share_snapshot_patch,
+ "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.update_share_snapshot(**req_copy)
+ _service.list_network_acl_rules(**req_copy)
- def test_update_share_snapshot_value_error_with_retries(self):
- # Enable retries and run test_update_share_snapshot_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_update_share_snapshot_value_error()
+ self.test_list_network_acl_rules_value_error()
- # Disable retries and run test_update_share_snapshot_value_error.
+ # Disable retries and run test_list_network_acl_rules_value_error.
_service.disable_retries()
- self.test_update_share_snapshot_value_error()
+ self.test_list_network_acl_rules_value_error()
+
+ @responses.activate
+ def test_list_network_acl_rules_with_pager_get_next(self):
+ """
+ test_list_network_acl_rules_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/network_acls/testString/rules')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = NetworkAclRulesPager(
+ client=_service,
+ network_acl_id='testString',
+ limit=10,
+ direction='inbound',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestDeleteShareSource:
+ @responses.activate
+ def test_list_network_acl_rules_with_pager_get_all(self):
+ """
+ test_list_network_acl_rules_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/network_acls/testString/rules')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = NetworkAclRulesPager(
+ client=_service,
+ network_acl_id='testString',
+ limit=10,
+ direction='inbound',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateNetworkAclRule:
"""
- Test Class for delete_share_source
+ Test Class for create_network_acl_rule
"""
@responses.activate
- def test_delete_share_source_all_params(self):
+ def test_create_network_acl_rule_all_params(self):
"""
- delete_share_source()
+ create_network_acl_rule()
"""
# Set up mock
- url = preprocess_url('/shares/testString/source')
+ 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=202,
+ 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'] = 'r006-8daca77a-4980-4d33-8f3e-7038797be8f9'
+
+ # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
+ network_acl_rule_prototype_model['name'] = 'my-network-acl-rule'
+ network_acl_rule_prototype_model['source'] = '192.168.3.2/32'
+ network_acl_rule_prototype_model['protocol'] = 'all'
+
# Set up parameter values
- share_id = 'testString'
+ network_acl_id = 'testString'
+ network_acl_rule_prototype = network_acl_rule_prototype_model
# Invoke method
- response = _service.delete_share_source(
- share_id,
+ 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 == 202
+ 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_delete_share_source_all_params_with_retries(self):
- # Enable retries and run test_delete_share_source_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_delete_share_source_all_params()
+ self.test_create_network_acl_rule_all_params()
- # Disable retries and run test_delete_share_source_all_params.
+ # Disable retries and run test_create_network_acl_rule_all_params.
_service.disable_retries()
- self.test_delete_share_source_all_params()
+ self.test_create_network_acl_rule_all_params()
@responses.activate
- def test_delete_share_source_value_error(self):
+ def test_create_network_acl_rule_value_error(self):
"""
- test_delete_share_source_value_error()
+ test_create_network_acl_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/source')
+ 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=202,
+ 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'] = 'r006-8daca77a-4980-4d33-8f3e-7038797be8f9'
+
+ # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
+ network_acl_rule_prototype_model['name'] = 'my-network-acl-rule'
+ network_acl_rule_prototype_model['source'] = '192.168.3.2/32'
+ network_acl_rule_prototype_model['protocol'] = 'all'
+
# Set up parameter values
- share_id = 'testString'
+ 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 = {
- "share_id": share_id,
+ "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.delete_share_source(**req_copy)
+ _service.create_network_acl_rule(**req_copy)
- def test_delete_share_source_value_error_with_retries(self):
- # Enable retries and run test_delete_share_source_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_delete_share_source_value_error()
+ self.test_create_network_acl_rule_value_error()
- # Disable retries and run test_delete_share_source_value_error.
+ # Disable retries and run test_create_network_acl_rule_value_error.
_service.disable_retries()
- self.test_delete_share_source_value_error()
+ self.test_create_network_acl_rule_value_error()
-class TestGetShareSource:
+class TestDeleteNetworkAclRule:
"""
- Test Class for get_share_source
+ Test Class for delete_network_acl_rule
"""
@responses.activate
- def test_get_share_source_all_params(self):
+ def test_delete_network_acl_rule_all_params(self):
"""
- get_share_source()
+ delete_network_acl_rule()
"""
# Set up mock
- url = preprocess_url('/shares/testString/source')
- mock_response = '{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}'
+ url = preprocess_url('/network_acls/testString/rules/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- share_id = 'testString'
+ network_acl_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.get_share_source(
- share_id,
+ response = _service.delete_network_acl_rule(
+ network_acl_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_share_source_all_params_with_retries(self):
- # Enable retries and run test_get_share_source_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_get_share_source_all_params()
+ self.test_delete_network_acl_rule_all_params()
- # Disable retries and run test_get_share_source_all_params.
+ # Disable retries and run test_delete_network_acl_rule_all_params.
_service.disable_retries()
- self.test_get_share_source_all_params()
+ self.test_delete_network_acl_rule_all_params()
@responses.activate
- def test_get_share_source_value_error(self):
+ def test_delete_network_acl_rule_value_error(self):
"""
- test_get_share_source_value_error()
+ test_delete_network_acl_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/shares/testString/source')
- mock_response = '{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}'
+ url = preprocess_url('/network_acls/testString/rules/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- share_id = 'testString'
+ network_acl_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "share_id": share_id,
+ "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_share_source(**req_copy)
+ _service.delete_network_acl_rule(**req_copy)
- def test_get_share_source_value_error_with_retries(self):
- # Enable retries and run test_get_share_source_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_get_share_source_value_error()
+ self.test_delete_network_acl_rule_value_error()
- # Disable retries and run test_get_share_source_value_error.
+ # Disable retries and run test_delete_network_acl_rule_value_error.
_service.disable_retries()
- self.test_get_share_source_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: Shares
-##############################################################################
-
-##############################################################################
-# Start of Service: BackupPolicies
-##############################################################################
-# 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,
- )
+ self.test_delete_network_acl_rule_value_error()
-class TestListBackupPolicies:
+class TestGetNetworkAclRule:
"""
- Test Class for list_backup_policies
+ Test Class for get_network_acl_rule
"""
@responses.activate
- def test_list_backup_policies_all_params(self):
- """
- list_backup_policies()
- """
- # Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- name = 'my-name'
- tag = 'testString'
-
- # Invoke method
- response = _service.list_backup_policies(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
- name=name,
- tag=tag,
- 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 'tag={}'.format(tag) in query_string
-
- 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_backup_policies_all_params()
-
- # Disable retries and run test_list_backup_policies_all_params.
- _service.disable_retries()
- self.test_list_backup_policies_all_params()
-
- @responses.activate
- def test_list_backup_policies_required_params(self):
+ def test_get_network_acl_rule_all_params(self):
"""
- test_list_backup_policies_required_params()
+ get_network_acl_rule()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
responses.add(
responses.GET,
url,
@@ -30028,30 +29920,38 @@ def test_list_backup_policies_required_params(self):
status=200,
)
+ # Set up parameter values
+ network_acl_id = 'testString'
+ id = 'testString'
+
# Invoke method
- response = _service.list_backup_policies()
+ response = _service.get_network_acl_rule(
+ network_acl_id,
+ id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_backup_policies_required_params_with_retries(self):
- # Enable retries and run test_list_backup_policies_required_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_list_backup_policies_required_params()
+ self.test_get_network_acl_rule_all_params()
- # Disable retries and run test_list_backup_policies_required_params.
+ # Disable retries and run test_get_network_acl_rule_all_params.
_service.disable_retries()
- self.test_list_backup_policies_required_params()
+ self.test_get_network_acl_rule_all_params()
@responses.activate
- def test_list_backup_policies_value_error(self):
+ def test_get_network_acl_rule_value_error(self):
"""
- test_list_backup_policies_value_error()
+ test_get_network_acl_rule_value_error()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
responses.add(
responses.GET,
url,
@@ -30060,308 +29960,230 @@ def test_list_backup_policies_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.list_backup_policies(**req_copy)
+ _service.get_network_acl_rule(**req_copy)
- def test_list_backup_policies_value_error_with_retries(self):
- # Enable retries and run test_list_backup_policies_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_list_backup_policies_value_error()
+ self.test_get_network_acl_rule_value_error()
- # Disable retries and run test_list_backup_policies_value_error.
+ # Disable retries and run test_get_network_acl_rule_value_error.
_service.disable_retries()
- self.test_list_backup_policies_value_error()
-
- @responses.activate
- def test_list_backup_policies_with_pager_get_next(self):
- """
- test_list_backup_policies_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/backup_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
- mock_response2 = '{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = BackupPoliciesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- tag='testString',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_backup_policies_with_pager_get_all(self):
- """
- test_list_backup_policies_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/backup_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
- mock_response2 = '{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r006-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = BackupPoliciesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- tag='testString',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_get_network_acl_rule_value_error()
-class TestCreateBackupPolicy:
+class TestUpdateNetworkAclRule:
"""
- Test Class for create_backup_policy
+ Test Class for update_network_acl_rule
"""
@responses.activate
- def test_create_backup_policy_all_params(self):
+ def test_update_network_acl_rule_all_params(self):
"""
- create_backup_policy()
+ update_network_acl_rule()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
- backup_policy_plan_clone_policy_prototype_model = {}
- backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
- backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
-
- # 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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
-
- # 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['clone_policy'] = backup_policy_plan_clone_policy_prototype_model
- backup_policy_plan_prototype_model['copy_user_tags'] = True
- backup_policy_plan_prototype_model['cron_spec'] = '30 */2 * * 1-5'
- backup_policy_plan_prototype_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_prototype_model
- backup_policy_plan_prototype_model['name'] = 'my-policy-plan'
- backup_policy_plan_prototype_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # Construct a dict representation of a BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model
- backup_policy_scope_prototype_model = {}
- backup_policy_scope_prototype_model['crn'] = 'crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce'
+ # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model
+ network_acl_rule_before_patch_model = {}
+ network_acl_rule_before_patch_model['id'] = 'r006-8daca77a-4980-4d33-8f3e-7038797be8f9'
- # Construct a dict representation of a BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model
- backup_policy_prototype_model = {}
- backup_policy_prototype_model['match_user_tags'] = ['my-daily-backup-policy']
- backup_policy_prototype_model['name'] = 'my-backup-policy'
- backup_policy_prototype_model['plans'] = [backup_policy_plan_prototype_model]
- backup_policy_prototype_model['resource_group'] = resource_group_identity_model
- backup_policy_prototype_model['scope'] = backup_policy_scope_prototype_model
- backup_policy_prototype_model['match_resource_type'] = 'volume'
+ # 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-network-acl-rule'
+ network_acl_rule_patch_model['source'] = '10.0.0.0/0'
+ 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
- backup_policy_prototype = backup_policy_prototype_model
+ network_acl_id = 'testString'
+ id = 'testString'
+ network_acl_rule_patch = network_acl_rule_patch_model
# Invoke method
- response = _service.create_backup_policy(
- backup_policy_prototype,
+ response = _service.update_network_acl_rule(
+ network_acl_id,
+ id,
+ network_acl_rule_patch,
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 == backup_policy_prototype
+ assert req_body == network_acl_rule_patch
- def test_create_backup_policy_all_params_with_retries(self):
- # Enable retries and run test_create_backup_policy_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_create_backup_policy_all_params()
+ self.test_update_network_acl_rule_all_params()
- # Disable retries and run test_create_backup_policy_all_params.
+ # Disable retries and run test_update_network_acl_rule_all_params.
_service.disable_retries()
- self.test_create_backup_policy_all_params()
+ self.test_update_network_acl_rule_all_params()
@responses.activate
- def test_create_backup_policy_value_error(self):
+ def test_update_network_acl_rule_value_error(self):
"""
- test_create_backup_policy_value_error()
+ test_update_network_acl_rule_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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
- backup_policy_plan_clone_policy_prototype_model = {}
- backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
- backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
-
- # 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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
-
- # 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['clone_policy'] = backup_policy_plan_clone_policy_prototype_model
- backup_policy_plan_prototype_model['copy_user_tags'] = True
- backup_policy_plan_prototype_model['cron_spec'] = '30 */2 * * 1-5'
- backup_policy_plan_prototype_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_prototype_model
- backup_policy_plan_prototype_model['name'] = 'my-policy-plan'
- backup_policy_plan_prototype_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
- # Construct a dict representation of a BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model
- backup_policy_scope_prototype_model = {}
- backup_policy_scope_prototype_model['crn'] = 'crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce'
+ # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model
+ network_acl_rule_before_patch_model = {}
+ network_acl_rule_before_patch_model['id'] = 'r006-8daca77a-4980-4d33-8f3e-7038797be8f9'
- # Construct a dict representation of a BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model
- backup_policy_prototype_model = {}
- backup_policy_prototype_model['match_user_tags'] = ['my-daily-backup-policy']
- backup_policy_prototype_model['name'] = 'my-backup-policy'
- backup_policy_prototype_model['plans'] = [backup_policy_plan_prototype_model]
- backup_policy_prototype_model['resource_group'] = resource_group_identity_model
- backup_policy_prototype_model['scope'] = backup_policy_scope_prototype_model
- backup_policy_prototype_model['match_resource_type'] = 'volume'
+ # 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-network-acl-rule'
+ network_acl_rule_patch_model['source'] = '10.0.0.0/0'
+ 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
- backup_policy_prototype = backup_policy_prototype_model
+ network_acl_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 = {
- "backup_policy_prototype": backup_policy_prototype,
+ "network_acl_id": network_acl_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.create_backup_policy(**req_copy)
+ _service.update_network_acl_rule(**req_copy)
- def test_create_backup_policy_value_error_with_retries(self):
- # Enable retries and run test_create_backup_policy_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_create_backup_policy_value_error()
+ self.test_update_network_acl_rule_value_error()
- # Disable retries and run test_create_backup_policy_value_error.
+ # Disable retries and run test_update_network_acl_rule_value_error.
_service.disable_retries()
- self.test_create_backup_policy_value_error()
+ self.test_update_network_acl_rule_value_error()
-class TestListBackupPolicyJobs:
+# endregion
+##############################################################################
+# End of Service: NetworkACLs
+##############################################################################
+
+##############################################################################
+# Start of Service: PlacementGroups
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_backup_policy_jobs
+ 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 TestListPlacementGroups:
+ """
+ Test Class for list_placement_groups
"""
@responses.activate
- def test_list_backup_policy_jobs_all_params(self):
+ def test_list_placement_groups_all_params(self):
"""
- list_backup_policy_jobs()
+ list_placement_groups()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/jobs')
- mock_response = '{"first": {"href": "href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/placement_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
@@ -30371,27 +30193,13 @@ def test_list_backup_policy_jobs_all_params(self):
)
# Set up parameter values
- backup_policy_id = 'testString'
- status = 'failed'
- backup_policy_plan_id = 'testString'
start = 'testString'
limit = 50
- sort = 'name'
- source_id = 'testString'
- target_snapshots_id = 'testString'
- target_snapshots_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
# Invoke method
- response = _service.list_backup_policy_jobs(
- backup_policy_id,
- status=status,
- backup_policy_plan_id=backup_policy_plan_id,
+ response = _service.list_placement_groups(
start=start,
limit=limit,
- sort=sort,
- source_id=source_id,
- target_snapshots_id=target_snapshots_id,
- target_snapshots_crn=target_snapshots_crn,
headers={},
)
@@ -30401,32 +30209,26 @@ def test_list_backup_policy_jobs_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 'status={}'.format(status) in query_string
- assert 'backup_policy_plan.id={}'.format(backup_policy_plan_id) in query_string
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- assert 'sort={}'.format(sort) in query_string
- assert 'source.id={}'.format(source_id) in query_string
- assert 'target_snapshots[].id={}'.format(target_snapshots_id) in query_string
- assert 'target_snapshots[].crn={}'.format(target_snapshots_crn) in query_string
- def test_list_backup_policy_jobs_all_params_with_retries(self):
- # Enable retries and run test_list_backup_policy_jobs_all_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_backup_policy_jobs_all_params()
+ self.test_list_placement_groups_all_params()
- # Disable retries and run test_list_backup_policy_jobs_all_params.
+ # Disable retries and run test_list_placement_groups_all_params.
_service.disable_retries()
- self.test_list_backup_policy_jobs_all_params()
+ self.test_list_placement_groups_all_params()
@responses.activate
- def test_list_backup_policy_jobs_required_params(self):
+ def test_list_placement_groups_required_params(self):
"""
- test_list_backup_policy_jobs_required_params()
+ test_list_placement_groups_required_params()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/jobs')
- mock_response = '{"first": {"href": "href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/placement_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
@@ -30435,36 +30237,30 @@ def test_list_backup_policy_jobs_required_params(self):
status=200,
)
- # Set up parameter values
- backup_policy_id = 'testString'
-
# Invoke method
- response = _service.list_backup_policy_jobs(
- backup_policy_id,
- headers={},
- )
+ response = _service.list_placement_groups()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_backup_policy_jobs_required_params_with_retries(self):
- # Enable retries and run test_list_backup_policy_jobs_required_params.
+ 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_backup_policy_jobs_required_params()
+ self.test_list_placement_groups_required_params()
- # Disable retries and run test_list_backup_policy_jobs_required_params.
+ # Disable retries and run test_list_placement_groups_required_params.
_service.disable_retries()
- self.test_list_backup_policy_jobs_required_params()
+ self.test_list_placement_groups_required_params()
@responses.activate
- def test_list_backup_policy_jobs_value_error(self):
+ def test_list_placement_groups_value_error(self):
"""
- test_list_backup_policy_jobs_value_error()
+ test_list_placement_groups_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/jobs')
- mock_response = '{"first": {"href": "href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/placement_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
@@ -30473,36 +30269,32 @@ def test_list_backup_policy_jobs_value_error(self):
status=200,
)
- # Set up parameter values
- backup_policy_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.list_backup_policy_jobs(**req_copy)
+ _service.list_placement_groups(**req_copy)
- def test_list_backup_policy_jobs_value_error_with_retries(self):
- # Enable retries and run test_list_backup_policy_jobs_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_backup_policy_jobs_value_error()
+ self.test_list_placement_groups_value_error()
- # Disable retries and run test_list_backup_policy_jobs_value_error.
+ # Disable retries and run test_list_placement_groups_value_error.
_service.disable_retries()
- self.test_list_backup_policy_jobs_value_error()
+ self.test_list_placement_groups_value_error()
@responses.activate
- def test_list_backup_policy_jobs_with_pager_get_next(self):
+ def test_list_placement_groups_with_pager_get_next(self):
"""
- test_list_backup_policy_jobs_with_pager_get_next()
+ test_list_placement_groups_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/backup_policies/testString/jobs')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
- mock_response2 = '{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
+ url = preprocess_url('/placement_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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,
@@ -30520,16 +30312,9 @@ def test_list_backup_policy_jobs_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = BackupPolicyJobsPager(
- client=_service,
- backup_policy_id='testString',
- status='failed',
- backup_policy_plan_id='testString',
- limit=10,
- sort='name',
- source_id='testString',
- target_snapshots_id='testString',
- target_snapshots_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
+ pager = PlacementGroupsPager(
+ client=_service,
+ limit=10,
)
while pager.has_next():
next_page = pager.get_next()
@@ -30538,14 +30323,14 @@ def test_list_backup_policy_jobs_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_backup_policy_jobs_with_pager_get_all(self):
+ def test_list_placement_groups_with_pager_get_all(self):
"""
- test_list_backup_policy_jobs_with_pager_get_all()
+ test_list_placement_groups_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/backup_policies/testString/jobs')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
- mock_response2 = '{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","id":"r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}'
+ url = preprocess_url('/placement_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-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,
@@ -30562,164 +30347,203 @@ def test_list_backup_policy_jobs_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = BackupPolicyJobsPager(
+ pager = PlacementGroupsPager(
client=_service,
- backup_policy_id='testString',
- status='failed',
- backup_policy_plan_id='testString',
limit=10,
- sort='name',
- source_id='testString',
- target_snapshots_id='testString',
- target_snapshots_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestGetBackupPolicyJob:
+class TestCreatePlacementGroup:
"""
- Test Class for get_backup_policy_job
+ Test Class for create_placement_group
"""
@responses.activate
- def test_get_backup_policy_job_all_params(self):
+ def test_create_placement_group_all_params(self):
"""
- get_backup_policy_job()
+ create_placement_group()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/jobs/testString')
- mock_response = '{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/placement_groups')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
+ 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'
+
# Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
+ strategy = 'host_spread'
+ name = 'my-placement-group'
+ resource_group = resource_group_identity_model
# Invoke method
- response = _service.get_backup_policy_job(
- backup_policy_id,
- id,
+ response = _service.create_placement_group(
+ strategy,
+ name=name,
+ resource_group=resource_group,
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['strategy'] == 'host_spread'
+ assert req_body['name'] == 'my-placement-group'
+ assert req_body['resource_group'] == resource_group_identity_model
- def test_get_backup_policy_job_all_params_with_retries(self):
- # Enable retries and run test_get_backup_policy_job_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_get_backup_policy_job_all_params()
+ self.test_create_placement_group_all_params()
- # Disable retries and run test_get_backup_policy_job_all_params.
+ # Disable retries and run test_create_placement_group_all_params.
_service.disable_retries()
- self.test_get_backup_policy_job_all_params()
+ self.test_create_placement_group_all_params()
@responses.activate
- def test_get_backup_policy_job_value_error(self):
+ def test_create_placement_group_value_error(self):
"""
- test_get_backup_policy_job_value_error()
+ test_create_placement_group_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/jobs/testString')
- mock_response = '{"auto_delete": true, "auto_delete_after": 90, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/jobs/r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "id": "r006-fc4b7fbc-38af-45d9-9fb6-bf0533acbf90", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ url = preprocess_url('/placement_groups')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
+ 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'
+
# Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
+ 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 = {
- "backup_policy_id": backup_policy_id,
- "id": id,
+ "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.get_backup_policy_job(**req_copy)
+ _service.create_placement_group(**req_copy)
- def test_get_backup_policy_job_value_error_with_retries(self):
- # Enable retries and run test_get_backup_policy_job_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_get_backup_policy_job_value_error()
+ self.test_create_placement_group_value_error()
- # Disable retries and run test_get_backup_policy_job_value_error.
+ # Disable retries and run test_create_placement_group_value_error.
_service.disable_retries()
- self.test_get_backup_policy_job_value_error()
+ self.test_create_placement_group_value_error()
-class TestListBackupPolicyPlans:
+class TestDeletePlacementGroup:
"""
- Test Class for list_backup_policy_plans
+ Test Class for delete_placement_group
"""
@responses.activate
- def test_list_backup_policy_plans_all_params(self):
+ def test_delete_placement_group_all_params(self):
"""
- list_backup_policy_plans()
+ delete_placement_group()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}'
+ url = preprocess_url('/placement_groups/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- backup_policy_id = 'testString'
- name = 'my-name'
+ id = 'testString'
# Invoke method
- response = _service.list_backup_policy_plans(
- backup_policy_id,
- name=name,
+ response = _service.delete_placement_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 'name={}'.format(name) in query_string
+ assert response.status_code == 202
- def test_list_backup_policy_plans_all_params_with_retries(self):
- # Enable retries and run test_list_backup_policy_plans_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_list_backup_policy_plans_all_params()
+ self.test_delete_placement_group_all_params()
- # Disable retries and run test_list_backup_policy_plans_all_params.
+ # Disable retries and run test_delete_placement_group_all_params.
_service.disable_retries()
- self.test_list_backup_policy_plans_all_params()
+ self.test_delete_placement_group_all_params()
@responses.activate
- def test_list_backup_policy_plans_required_params(self):
+ def test_delete_placement_group_value_error(self):
"""
- test_list_backup_policy_plans_required_params()
+ test_delete_placement_group_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}'
+ 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)
+
+ 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_placement_group_value_error()
+
+ # Disable retries and run test_delete_placement_group_value_error.
+ _service.disable_retries()
+ self.test_delete_placement_group_value_error()
+
+
+class TestGetPlacementGroup:
+ """
+ Test Class for get_placement_group
+ """
+
+ @responses.activate
+ def test_get_placement_group_all_params(self):
+ """
+ get_placement_group()
+ """
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
@@ -30729,11 +30553,11 @@ def test_list_backup_policy_plans_required_params(self):
)
# Set up parameter values
- backup_policy_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_backup_policy_plans(
- backup_policy_id,
+ response = _service.get_placement_group(
+ id,
headers={},
)
@@ -30741,23 +30565,23 @@ def test_list_backup_policy_plans_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_backup_policy_plans_required_params_with_retries(self):
- # Enable retries and run test_list_backup_policy_plans_required_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_list_backup_policy_plans_required_params()
+ self.test_get_placement_group_all_params()
- # Disable retries and run test_list_backup_policy_plans_required_params.
+ # Disable retries and run test_get_placement_group_all_params.
_service.disable_retries()
- self.test_list_backup_policy_plans_required_params()
+ self.test_get_placement_group_all_params()
@responses.activate
- def test_list_backup_policy_plans_value_error(self):
+ def test_get_placement_group_value_error(self):
"""
- test_list_backup_policy_plans_value_error()
+ test_get_placement_group_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
@@ -30767,339 +30591,241 @@ def test_list_backup_policy_plans_value_error(self):
)
# 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_backup_policy_plans(**req_copy)
+ _service.get_placement_group(**req_copy)
- def test_list_backup_policy_plans_value_error_with_retries(self):
- # Enable retries and run test_list_backup_policy_plans_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_list_backup_policy_plans_value_error()
+ self.test_get_placement_group_value_error()
- # Disable retries and run test_list_backup_policy_plans_value_error.
+ # Disable retries and run test_get_placement_group_value_error.
_service.disable_retries()
- self.test_list_backup_policy_plans_value_error()
+ self.test_get_placement_group_value_error()
-class TestCreateBackupPolicyPlan:
+class TestUpdatePlacementGroup:
"""
- Test Class for create_backup_policy_plan
+ Test Class for update_placement_group
"""
@responses.activate
- def test_create_backup_policy_plan_all_params(self):
+ def test_update_placement_group_all_params(self):
"""
- create_backup_policy_plan()
+ update_placement_group()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
- backup_policy_plan_clone_policy_prototype_model = {}
- backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
- backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
-
- # 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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+ # Construct a dict representation of a PlacementGroupPatch model
+ placement_group_patch_model = {}
+ placement_group_patch_model['name'] = 'my-placement-group-updated'
# Set up parameter values
- backup_policy_id = 'testString'
- cron_spec = '30 */2 * * 1-5'
- active = True
- attach_user_tags = ['my-daily-backup-plan']
- clone_policy = backup_policy_plan_clone_policy_prototype_model
- copy_user_tags = True
- deletion_trigger = backup_policy_plan_deletion_trigger_prototype_model
- name = 'my-policy-plan'
- remote_region_policies = [backup_policy_plan_remote_region_policy_prototype_model]
+ id = 'testString'
+ placement_group_patch = placement_group_patch_model
# Invoke method
- response = _service.create_backup_policy_plan(
- backup_policy_id,
- cron_spec,
- active=active,
- attach_user_tags=attach_user_tags,
- clone_policy=clone_policy,
- copy_user_tags=copy_user_tags,
- deletion_trigger=deletion_trigger,
- name=name,
- remote_region_policies=remote_region_policies,
+ response = _service.update_placement_group(
+ id,
+ placement_group_patch,
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['cron_spec'] == '30 */2 * * 1-5'
- assert req_body['active'] == True
- assert req_body['attach_user_tags'] == ['my-daily-backup-plan']
- assert req_body['clone_policy'] == backup_policy_plan_clone_policy_prototype_model
- 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'
- assert req_body['remote_region_policies'] == [backup_policy_plan_remote_region_policy_prototype_model]
+ assert req_body == placement_group_patch
- def test_create_backup_policy_plan_all_params_with_retries(self):
- # Enable retries and run test_create_backup_policy_plan_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_create_backup_policy_plan_all_params()
+ self.test_update_placement_group_all_params()
- # Disable retries and run test_create_backup_policy_plan_all_params.
+ # Disable retries and run test_update_placement_group_all_params.
_service.disable_retries()
- self.test_create_backup_policy_plan_all_params()
+ self.test_update_placement_group_all_params()
@responses.activate
- def test_create_backup_policy_plan_value_error(self):
+ def test_update_placement_group_value_error(self):
"""
- test_create_backup_policy_plan_value_error()
+ test_update_placement_group_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPrototype model
- backup_policy_plan_clone_policy_prototype_model = {}
- backup_policy_plan_clone_policy_prototype_model['max_snapshots'] = 5
- backup_policy_plan_clone_policy_prototype_model['zones'] = [zone_identity_model]
-
- # 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 EncryptionKeyIdentityByCRN model
- encryption_key_identity_model = {}
- encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+ # Construct a dict representation of a PlacementGroupPatch model
+ placement_group_patch_model = {}
+ placement_group_patch_model['name'] = 'my-placement-group-updated'
# Set up parameter values
- backup_policy_id = 'testString'
- cron_spec = '30 */2 * * 1-5'
- active = True
- attach_user_tags = ['my-daily-backup-plan']
- clone_policy = backup_policy_plan_clone_policy_prototype_model
- copy_user_tags = True
- deletion_trigger = backup_policy_plan_deletion_trigger_prototype_model
- name = 'my-policy-plan'
- remote_region_policies = [backup_policy_plan_remote_region_policy_prototype_model]
+ id = 'testString'
+ placement_group_patch = placement_group_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "backup_policy_id": backup_policy_id,
- "cron_spec": cron_spec,
+ "id": id,
+ "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.create_backup_policy_plan(**req_copy)
+ _service.update_placement_group(**req_copy)
- def test_create_backup_policy_plan_value_error_with_retries(self):
- # Enable retries and run test_create_backup_policy_plan_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_create_backup_policy_plan_value_error()
+ self.test_update_placement_group_value_error()
- # Disable retries and run test_create_backup_policy_plan_value_error.
+ # Disable retries and run test_update_placement_group_value_error.
_service.disable_retries()
- self.test_create_backup_policy_plan_value_error()
+ self.test_update_placement_group_value_error()
-class TestDeleteBackupPolicyPlan:
+# endregion
+##############################################################################
+# End of Service: PlacementGroups
+##############################################################################
+
+##############################################################################
+# Start of Service: PrivatePathServiceGateways
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for delete_backup_policy_plan
+ Test Class for new_instance
"""
- @responses.activate
- def test_delete_backup_policy_plan_all_params(self):
+ def test_new_instance(self):
"""
- delete_backup_policy_plan()
+ new_instance()
"""
- # Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
- responses.add(
- responses.DELETE,
- url,
- body=mock_response,
- content_type='application/json',
- status=202,
- )
-
- # Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
- # Invoke method
- response = _service.delete_backup_policy_plan(
- backup_policy_id,
- id,
- if_match=if_match,
- headers={},
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE',
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- 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_delete_backup_policy_plan_all_params()
-
- # Disable retries and run test_delete_backup_policy_plan_all_params.
- _service.disable_retries()
- self.test_delete_backup_policy_plan_all_params()
+ assert service is not None
+ assert isinstance(service, VpcV1)
- @responses.activate
- def test_delete_backup_policy_plan_required_params(self):
+ def test_new_instance_without_authenticator(self):
"""
- test_delete_backup_policy_plan_required_params()
+ new_instance_without_authenticator()
"""
- # Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
- responses.add(
- responses.DELETE,
- url,
- body=mock_response,
- content_type='application/json',
- status=202,
- )
-
- # Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
+ with pytest.raises(ValueError, match='authenticator must be provided'):
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE_NOT_FOUND',
+ )
- # Invoke method
- response = _service.delete_backup_policy_plan(
- backup_policy_id,
- id,
- headers={},
- )
+ 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()
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
+ 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,
+ )
- 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_delete_backup_policy_plan_required_params()
- # Disable retries and run test_delete_backup_policy_plan_required_params.
- _service.disable_retries()
- self.test_delete_backup_policy_plan_required_params()
+class TestListPrivatePathServiceGateways:
+ """
+ Test Class for list_private_path_service_gateways
+ """
@responses.activate
- def test_delete_backup_policy_plan_value_error(self):
+ def test_list_private_path_service_gateways_all_params(self):
"""
- test_delete_backup_policy_plan_value_error()
+ list_private_path_service_gateways()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}], "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
+ start = 'testString'
+ limit = 50
+ resource_group_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.delete_backup_policy_plan(**req_copy)
+ # Invoke method
+ response = _service.list_private_path_service_gateways(
+ start=start,
+ limit=limit,
+ resource_group_id=resource_group_id,
+ headers={},
+ )
- def test_delete_backup_policy_plan_value_error_with_retries(self):
- # Enable retries and run test_delete_backup_policy_plan_value_error.
+ # 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_private_path_service_gateways_all_params_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateways_all_params.
_service.enable_retries()
- self.test_delete_backup_policy_plan_value_error()
+ self.test_list_private_path_service_gateways_all_params()
- # Disable retries and run test_delete_backup_policy_plan_value_error.
+ # Disable retries and run test_list_private_path_service_gateways_all_params.
_service.disable_retries()
- self.test_delete_backup_policy_plan_value_error()
-
-
-class TestGetBackupPolicyPlan:
- """
- Test Class for get_backup_policy_plan
- """
+ self.test_list_private_path_service_gateways_all_params()
@responses.activate
- def test_get_backup_policy_plan_all_params(self):
+ def test_list_private_path_service_gateways_required_params(self):
"""
- get_backup_policy_plan()
+ test_list_private_path_service_gateways_required_params()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -31108,38 +30834,30 @@ def test_get_backup_policy_plan_all_params(self):
status=200,
)
- # Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
-
# Invoke method
- response = _service.get_backup_policy_plan(
- backup_policy_id,
- id,
- headers={},
- )
+ response = _service.list_private_path_service_gateways()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_backup_policy_plan_all_params_with_retries(self):
- # Enable retries and run test_get_backup_policy_plan_all_params.
+ def test_list_private_path_service_gateways_required_params_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateways_required_params.
_service.enable_retries()
- self.test_get_backup_policy_plan_all_params()
+ self.test_list_private_path_service_gateways_required_params()
- # Disable retries and run test_get_backup_policy_plan_all_params.
+ # Disable retries and run test_list_private_path_service_gateways_required_params.
_service.disable_retries()
- self.test_get_backup_policy_plan_all_params()
+ self.test_list_private_path_service_gateways_required_params()
@responses.activate
- def test_get_backup_policy_plan_value_error(self):
+ def test_list_private_path_service_gateways_value_error(self):
"""
- test_get_backup_policy_plan_value_error()
+ test_list_private_path_service_gateways_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -31148,383 +30866,267 @@ def test_get_backup_policy_plan_value_error(self):
status=200,
)
- # 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.get_backup_policy_plan(**req_copy)
+ _service.list_private_path_service_gateways(**req_copy)
- def test_get_backup_policy_plan_value_error_with_retries(self):
- # Enable retries and run test_get_backup_policy_plan_value_error.
+ def test_list_private_path_service_gateways_value_error_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateways_value_error.
_service.enable_retries()
- self.test_get_backup_policy_plan_value_error()
+ self.test_list_private_path_service_gateways_value_error()
- # Disable retries and run test_get_backup_policy_plan_value_error.
+ # Disable retries and run test_list_private_path_service_gateways_value_error.
_service.disable_retries()
- self.test_get_backup_policy_plan_value_error()
-
-
-class TestUpdateBackupPolicyPlan:
- """
- Test Class for update_backup_policy_plan
- """
+ self.test_list_private_path_service_gateways_value_error()
@responses.activate
- def test_update_backup_policy_plan_all_params(self):
+ def test_list_private_path_service_gateways_with_pager_get_next(self):
"""
- update_backup_policy_plan()
+ test_list_private_path_service_gateways_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ # Set up a two-page mock response
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
+ mock_response2 = '{"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPatch model
- backup_policy_plan_clone_policy_patch_model = {}
- backup_policy_plan_clone_policy_patch_model['max_snapshots'] = 1
- backup_policy_plan_clone_policy_patch_model['zones'] = [zone_identity_model]
-
- # 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'] = 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
-
- # 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['clone_policy'] = backup_policy_plan_clone_policy_patch_model
- backup_policy_plan_patch_model['copy_user_tags'] = False
- backup_policy_plan_patch_model['cron_spec'] = '30 */2 * * 1-5'
- backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model
- backup_policy_plan_patch_model['name'] = 'my-policy-plan'
- backup_policy_plan_patch_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
-
- # Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
- backup_policy_plan_patch = backup_policy_plan_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = PrivatePathServiceGatewaysPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
- # Invoke method
- response = _service.update_backup_policy_plan(
- backup_policy_id,
- id,
- backup_policy_plan_patch,
- if_match=if_match,
- headers={},
+ @responses.activate
+ def test_list_private_path_service_gateways_with_pager_get_all(self):
+ """
+ test_list_private_path_service_gateways_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
+ mock_response2 = '{"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # 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
+ # Exercise the pager class for this operation
+ pager = PrivatePathServiceGatewaysPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
- 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_update_backup_policy_plan_all_params()
- # Disable retries and run test_update_backup_policy_plan_all_params.
- _service.disable_retries()
- self.test_update_backup_policy_plan_all_params()
+class TestCreatePrivatePathServiceGateway:
+ """
+ Test Class for create_private_path_service_gateway
+ """
@responses.activate
- def test_update_backup_policy_plan_required_params(self):
+ def test_create_private_path_service_gateway_all_params(self):
"""
- test_update_backup_policy_plan_required_params()
+ create_private_path_service_gateway()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
responses.add(
- responses.PATCH,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPatch model
- backup_policy_plan_clone_policy_patch_model = {}
- backup_policy_plan_clone_policy_patch_model['max_snapshots'] = 1
- backup_policy_plan_clone_policy_patch_model['zones'] = [zone_identity_model]
-
- # 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'] = 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
- # 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['clone_policy'] = backup_policy_plan_clone_policy_patch_model
- backup_policy_plan_patch_model['copy_user_tags'] = False
- backup_policy_plan_patch_model['cron_spec'] = '30 */2 * * 1-5'
- backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model
- backup_policy_plan_patch_model['name'] = 'my-policy-plan'
- backup_policy_plan_patch_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
- backup_policy_plan_patch = backup_policy_plan_patch_model
+ load_balancer = load_balancer_identity_model
+ service_endpoints = ['*.example.com']
+ default_access_policy = 'deny'
+ name = 'my-private-path-service-gateway'
+ resource_group = resource_group_identity_model
+ zonal_affinity = False
# Invoke method
- response = _service.update_backup_policy_plan(
- backup_policy_id,
- id,
- backup_policy_plan_patch,
+ response = _service.create_private_path_service_gateway(
+ load_balancer,
+ service_endpoints,
+ default_access_policy=default_access_policy,
+ name=name,
+ resource_group=resource_group,
+ zonal_affinity=zonal_affinity,
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 == backup_policy_plan_patch
+ assert req_body['load_balancer'] == load_balancer_identity_model
+ assert req_body['service_endpoints'] == ['*.example.com']
+ assert req_body['default_access_policy'] == 'deny'
+ assert req_body['name'] == 'my-private-path-service-gateway'
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['zonal_affinity'] == False
- def test_update_backup_policy_plan_required_params_with_retries(self):
- # Enable retries and run test_update_backup_policy_plan_required_params.
+ def test_create_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_create_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_update_backup_policy_plan_required_params()
+ self.test_create_private_path_service_gateway_all_params()
- # Disable retries and run test_update_backup_policy_plan_required_params.
+ # Disable retries and run test_create_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_update_backup_policy_plan_required_params()
+ self.test_create_private_path_service_gateway_all_params()
@responses.activate
- def test_update_backup_policy_plan_value_error(self):
+ def test_create_private_path_service_gateway_value_error(self):
"""
- test_update_backup_policy_plan_value_error()
+ test_create_private_path_service_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/backup_policies/testString/plans/testString')
- mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}'
+ url = preprocess_url('/private_path_service_gateways')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
responses.add(
- responses.PATCH,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
-
- # Construct a dict representation of a BackupPolicyPlanClonePolicyPatch model
- backup_policy_plan_clone_policy_patch_model = {}
- backup_policy_plan_clone_policy_patch_model['max_snapshots'] = 1
- backup_policy_plan_clone_policy_patch_model['zones'] = [zone_identity_model]
-
- # 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'] = 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
-
- # Construct a dict representation of a RegionIdentityByName model
- region_identity_model = {}
- region_identity_model['name'] = 'us-south'
-
- # Construct a dict representation of a BackupPolicyPlanRemoteRegionPolicyPrototype model
- backup_policy_plan_remote_region_policy_prototype_model = {}
- backup_policy_plan_remote_region_policy_prototype_model['delete_over_count'] = 5
- backup_policy_plan_remote_region_policy_prototype_model['encryption_key'] = encryption_key_identity_model
- backup_policy_plan_remote_region_policy_prototype_model['region'] = region_identity_model
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
- # 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['clone_policy'] = backup_policy_plan_clone_policy_patch_model
- backup_policy_plan_patch_model['copy_user_tags'] = False
- backup_policy_plan_patch_model['cron_spec'] = '30 */2 * * 1-5'
- backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model
- backup_policy_plan_patch_model['name'] = 'my-policy-plan'
- backup_policy_plan_patch_model['remote_region_policies'] = [backup_policy_plan_remote_region_policy_prototype_model]
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- backup_policy_id = 'testString'
- id = 'testString'
- backup_policy_plan_patch = backup_policy_plan_patch_model
+ load_balancer = load_balancer_identity_model
+ service_endpoints = ['*.example.com']
+ default_access_policy = 'deny'
+ name = 'my-private-path-service-gateway'
+ resource_group = resource_group_identity_model
+ zonal_affinity = False
# 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,
+ "load_balancer": load_balancer,
+ "service_endpoints": service_endpoints,
}
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_backup_policy_plan(**req_copy)
+ _service.create_private_path_service_gateway(**req_copy)
- def test_update_backup_policy_plan_value_error_with_retries(self):
- # Enable retries and run test_update_backup_policy_plan_value_error.
+ def test_create_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_create_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_update_backup_policy_plan_value_error()
+ self.test_create_private_path_service_gateway_value_error()
- # Disable retries and run test_update_backup_policy_plan_value_error.
+ # Disable retries and run test_create_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_update_backup_policy_plan_value_error()
+ self.test_create_private_path_service_gateway_value_error()
-class TestDeleteBackupPolicy:
+class TestDeletePrivatePathServiceGateway:
"""
- Test Class for delete_backup_policy
+ Test Class for delete_private_path_service_gateway
"""
@responses.activate
- def test_delete_backup_policy_all_params(self):
- """
- delete_backup_policy()
- """
- # Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
- responses.add(
- responses.DELETE,
- url,
- body=mock_response,
- content_type='application/json',
- status=202,
- )
-
- # Set up parameter values
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
-
- # Invoke method
- response = _service.delete_backup_policy(
- id,
- if_match=if_match,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- 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_delete_backup_policy_all_params()
-
- # Disable retries and run test_delete_backup_policy_all_params.
- _service.disable_retries()
- self.test_delete_backup_policy_all_params()
-
- @responses.activate
- def test_delete_backup_policy_required_params(self):
+ def test_delete_private_path_service_gateway_all_params(self):
"""
- test_delete_backup_policy_required_params()
+ delete_private_path_service_gateway()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ url = preprocess_url('/private_path_service_gateways/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
id = 'testString'
# Invoke method
- response = _service.delete_backup_policy(
+ response = _service.delete_private_path_service_gateway(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_backup_policy_required_params_with_retries(self):
- # Enable retries and run test_delete_backup_policy_required_params.
+ def test_delete_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_delete_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_delete_backup_policy_required_params()
+ self.test_delete_private_path_service_gateway_all_params()
- # Disable retries and run test_delete_backup_policy_required_params.
+ # Disable retries and run test_delete_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_delete_backup_policy_required_params()
+ self.test_delete_private_path_service_gateway_all_params()
@responses.activate
- def test_delete_backup_policy_value_error(self):
+ def test_delete_private_path_service_gateway_value_error(self):
"""
- test_delete_backup_policy_value_error()
+ test_delete_private_path_service_gateway_value_error()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ url = preprocess_url('/private_path_service_gateways/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
@@ -31537,31 +31139,31 @@ def test_delete_backup_policy_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_backup_policy(**req_copy)
-
- def test_delete_backup_policy_value_error_with_retries(self):
- # Enable retries and run test_delete_backup_policy_value_error.
+ _service.delete_private_path_service_gateway(**req_copy)
+
+ def test_delete_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_delete_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_delete_backup_policy_value_error()
+ self.test_delete_private_path_service_gateway_value_error()
- # Disable retries and run test_delete_backup_policy_value_error.
+ # Disable retries and run test_delete_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_delete_backup_policy_value_error()
+ self.test_delete_private_path_service_gateway_value_error()
-class TestGetBackupPolicy:
+class TestGetPrivatePathServiceGateway:
"""
- Test Class for get_backup_policy
+ Test Class for get_private_path_service_gateway
"""
@responses.activate
- def test_get_backup_policy_all_params(self):
+ def test_get_private_path_service_gateway_all_params(self):
"""
- get_backup_policy()
+ get_private_path_service_gateway()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ url = preprocess_url('/private_path_service_gateways/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
responses.add(
responses.GET,
url,
@@ -31574,7 +31176,7 @@ def test_get_backup_policy_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_backup_policy(
+ response = _service.get_private_path_service_gateway(
id,
headers={},
)
@@ -31583,23 +31185,23 @@ def test_get_backup_policy_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_backup_policy_all_params_with_retries(self):
- # Enable retries and run test_get_backup_policy_all_params.
+ def test_get_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_get_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_get_backup_policy_all_params()
+ self.test_get_private_path_service_gateway_all_params()
- # Disable retries and run test_get_backup_policy_all_params.
+ # Disable retries and run test_get_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_get_backup_policy_all_params()
+ self.test_get_private_path_service_gateway_all_params()
@responses.activate
- def test_get_backup_policy_value_error(self):
+ def test_get_private_path_service_gateway_value_error(self):
"""
- test_get_backup_policy_value_error()
+ test_get_private_path_service_gateway_value_error()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ url = preprocess_url('/private_path_service_gateways/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
responses.add(
responses.GET,
url,
@@ -31618,31 +31220,31 @@ def test_get_backup_policy_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_backup_policy(**req_copy)
+ _service.get_private_path_service_gateway(**req_copy)
- def test_get_backup_policy_value_error_with_retries(self):
- # Enable retries and run test_get_backup_policy_value_error.
+ def test_get_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_get_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_get_backup_policy_value_error()
+ self.test_get_private_path_service_gateway_value_error()
- # Disable retries and run test_get_backup_policy_value_error.
+ # Disable retries and run test_get_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_get_backup_policy_value_error()
+ self.test_get_private_path_service_gateway_value_error()
-class TestUpdateBackupPolicy:
+class TestUpdatePrivatePathServiceGateway:
"""
- Test Class for update_backup_policy
+ Test Class for update_private_path_service_gateway
"""
@responses.activate
- def test_update_backup_policy_all_params(self):
+ def test_update_private_path_service_gateway_all_params(self):
"""
- update_backup_policy()
+ update_private_path_service_gateway()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ url = preprocess_url('/private_path_service_gateways/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
responses.add(
responses.PATCH,
url,
@@ -31651,71 +31253,25 @@ def test_update_backup_policy_all_params(self):
status=200,
)
- # Construct a dict representation of a BackupPolicyPatch model
- backup_policy_patch_model = {}
- backup_policy_patch_model['included_content'] = ['data_volumes']
- backup_policy_patch_model['match_user_tags'] = ['my-tag-1', 'my-tag-2', 'my-tag-3']
- backup_policy_patch_model['name'] = 'my-backup-policy'
-
- # Set up parameter values
- id = 'testString'
- backup_policy_patch = backup_policy_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
-
- # Invoke method
- 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_update_backup_policy_all_params_with_retries(self):
- # Enable retries and run test_update_backup_policy_all_params.
- _service.enable_retries()
- self.test_update_backup_policy_all_params()
-
- # Disable retries and run test_update_backup_policy_all_params.
- _service.disable_retries()
- self.test_update_backup_policy_all_params()
-
- @responses.activate
- def test_update_backup_policy_required_params(self):
- """
- test_update_backup_policy_required_params()
- """
- # Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
- # Construct a dict representation of a BackupPolicyPatch model
- backup_policy_patch_model = {}
- backup_policy_patch_model['included_content'] = ['data_volumes']
- backup_policy_patch_model['match_user_tags'] = ['my-tag-1', 'my-tag-2', 'my-tag-3']
- backup_policy_patch_model['name'] = 'my-backup-policy'
+ # Construct a dict representation of a PrivatePathServiceGatewayPatch model
+ private_path_service_gateway_patch_model = {}
+ private_path_service_gateway_patch_model['default_access_policy'] = 'deny'
+ private_path_service_gateway_patch_model['load_balancer'] = load_balancer_identity_model
+ private_path_service_gateway_patch_model['name'] = 'my-private-path-service-gateway'
+ private_path_service_gateway_patch_model['zonal_affinity'] = True
# Set up parameter values
id = 'testString'
- backup_policy_patch = backup_policy_patch_model
+ private_path_service_gateway_patch = private_path_service_gateway_patch_model
# Invoke method
- response = _service.update_backup_policy(
+ response = _service.update_private_path_service_gateway(
id,
- backup_policy_patch,
+ private_path_service_gateway_patch,
headers={},
)
@@ -31724,25 +31280,25 @@ def test_update_backup_policy_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 == backup_policy_patch
+ assert req_body == private_path_service_gateway_patch
- def test_update_backup_policy_required_params_with_retries(self):
- # Enable retries and run test_update_backup_policy_required_params.
+ def test_update_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_update_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_update_backup_policy_required_params()
+ self.test_update_private_path_service_gateway_all_params()
- # Disable retries and run test_update_backup_policy_required_params.
+ # Disable retries and run test_update_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_update_backup_policy_required_params()
+ self.test_update_private_path_service_gateway_all_params()
@responses.activate
- def test_update_backup_policy_value_error(self):
+ def test_update_private_path_service_gateway_value_error(self):
"""
- test_update_backup_policy_value_error()
+ test_update_private_path_service_gateway_value_error()
"""
# Set up mock
- 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/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r006-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}'
+ url = preprocess_url('/private_path_service_gateways/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
responses.add(
responses.PATCH,
url,
@@ -31751,106 +31307,104 @@ def test_update_backup_policy_value_error(self):
status=200,
)
- # Construct a dict representation of a BackupPolicyPatch model
- backup_policy_patch_model = {}
- backup_policy_patch_model['included_content'] = ['data_volumes']
- backup_policy_patch_model['match_user_tags'] = ['my-tag-1', 'my-tag-2', 'my-tag-3']
- backup_policy_patch_model['name'] = 'my-backup-policy'
+ # Construct a dict representation of a LoadBalancerIdentityById model
+ load_balancer_identity_model = {}
+ load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+
+ # Construct a dict representation of a PrivatePathServiceGatewayPatch model
+ private_path_service_gateway_patch_model = {}
+ private_path_service_gateway_patch_model['default_access_policy'] = 'deny'
+ private_path_service_gateway_patch_model['load_balancer'] = load_balancer_identity_model
+ private_path_service_gateway_patch_model['name'] = 'my-private-path-service-gateway'
+ private_path_service_gateway_patch_model['zonal_affinity'] = True
# Set up parameter values
id = 'testString'
- backup_policy_patch = backup_policy_patch_model
+ private_path_service_gateway_patch = private_path_service_gateway_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "backup_policy_patch": backup_policy_patch,
+ "private_path_service_gateway_patch": private_path_service_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_backup_policy(**req_copy)
+ _service.update_private_path_service_gateway(**req_copy)
- def test_update_backup_policy_value_error_with_retries(self):
- # Enable retries and run test_update_backup_policy_value_error.
+ def test_update_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_update_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_update_backup_policy_value_error()
+ self.test_update_private_path_service_gateway_value_error()
- # Disable retries and run test_update_backup_policy_value_error.
+ # Disable retries and run test_update_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_update_backup_policy_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: BackupPolicies
-##############################################################################
-
-##############################################################################
-# Start of Service: Geography
-##############################################################################
-# region
+ self.test_update_private_path_service_gateway_value_error()
-class TestNewInstance:
+class TestListPrivatePathServiceGatewayAccountPolicies:
"""
- Test Class for new_instance
+ Test Class for list_private_path_service_gateway_account_policies
"""
- def test_new_instance(self):
+ @responses.activate
+ def test_list_private_path_service_gateway_account_policies_all_params(self):
"""
- new_instance()
+ list_private_path_service_gateway_account_policies()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
-
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up mock
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response = '{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- 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',
- )
+ # Set up parameter values
+ private_path_service_gateway_id = 'testString'
+ start = 'testString'
+ limit = 50
+ account_id = 'bb1b52262f7441a586f49068482f1e60'
- 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()
+ # Invoke method
+ response = _service.list_private_path_service_gateway_account_policies(
+ private_path_service_gateway_id,
+ start=start,
+ limit=limit,
+ account_id=account_id,
+ headers={},
+ )
- 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,
- )
+ # 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 'account.id={}'.format(account_id) in query_string
+ def test_list_private_path_service_gateway_account_policies_all_params_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateway_account_policies_all_params.
+ _service.enable_retries()
+ self.test_list_private_path_service_gateway_account_policies_all_params()
-class TestListRegions:
- """
- Test Class for list_regions
- """
+ # Disable retries and run test_list_private_path_service_gateway_account_policies_all_params.
+ _service.disable_retries()
+ self.test_list_private_path_service_gateway_account_policies_all_params()
@responses.activate
- def test_list_regions_all_params(self):
+ def test_list_private_path_service_gateway_account_policies_required_params(self):
"""
- list_regions()
+ test_list_private_path_service_gateway_account_policies_required_params()
"""
# Set up mock
- url = preprocess_url('/regions')
- mock_response = '{"regions": [{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}'
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response = '{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -31859,30 +31413,36 @@ def test_list_regions_all_params(self):
status=200,
)
+ # Set up parameter values
+ private_path_service_gateway_id = 'testString'
+
# Invoke method
- response = _service.list_regions()
+ response = _service.list_private_path_service_gateway_account_policies(
+ private_path_service_gateway_id,
+ headers={},
+ )
# 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_private_path_service_gateway_account_policies_required_params_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateway_account_policies_required_params.
_service.enable_retries()
- self.test_list_regions_all_params()
+ self.test_list_private_path_service_gateway_account_policies_required_params()
- # Disable retries and run test_list_regions_all_params.
+ # Disable retries and run test_list_private_path_service_gateway_account_policies_required_params.
_service.disable_retries()
- self.test_list_regions_all_params()
+ self.test_list_private_path_service_gateway_account_policies_required_params()
@responses.activate
- def test_list_regions_value_error(self):
+ def test_list_private_path_service_gateway_account_policies_value_error(self):
"""
- test_list_regions_value_error()
+ test_list_private_path_service_gateway_account_policies_value_error()
"""
# Set up mock
- url = preprocess_url('/regions')
- mock_response = '{"regions": [{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}'
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response = '{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -31891,341 +31451,294 @@ def test_list_regions_value_error(self):
status=200,
)
+ # Set up parameter values
+ private_path_service_gateway_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "private_path_service_gateway_id": private_path_service_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_regions(**req_copy)
+ _service.list_private_path_service_gateway_account_policies(**req_copy)
- def test_list_regions_value_error_with_retries(self):
- # Enable retries and run test_list_regions_value_error.
+ def test_list_private_path_service_gateway_account_policies_value_error_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateway_account_policies_value_error.
_service.enable_retries()
- self.test_list_regions_value_error()
+ self.test_list_private_path_service_gateway_account_policies_value_error()
- # Disable retries and run test_list_regions_value_error.
+ # Disable retries and run test_list_private_path_service_gateway_account_policies_value_error.
_service.disable_retries()
- self.test_list_regions_value_error()
-
-
-class TestGetRegion:
- """
- Test Class for get_region
- """
+ self.test_list_private_path_service_gateway_account_policies_value_error()
@responses.activate
- def test_get_region_all_params(self):
+ def test_list_private_path_service_gateway_account_policies_with_pager_get_next(self):
"""
- get_region()
+ test_list_private_path_service_gateway_account_policies_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/regions/us-south')
- mock_response = '{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}'
+ # Set up a two-page mock response
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
content_type='application/json',
status=200,
)
-
- # Set up parameter values
- name = 'us-south'
-
- # Invoke method
- response = _service.get_region(
- name,
- headers={},
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_region_all_params_with_retries(self):
- # Enable retries and run test_get_region_all_params.
- _service.enable_retries()
- self.test_get_region_all_params()
-
- # Disable retries and run test_get_region_all_params.
- _service.disable_retries()
- self.test_get_region_all_params()
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = PrivatePathServiceGatewayAccountPoliciesPager(
+ client=_service,
+ private_path_service_gateway_id='testString',
+ limit=10,
+ account_id='bb1b52262f7441a586f49068482f1e60',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_get_region_value_error(self):
+ def test_list_private_path_service_gateway_account_policies_with_pager_get_all(self):
"""
- test_get_region_value_error()
+ test_list_private_path_service_gateway_account_policies_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/regions/us-south')
- mock_response = '{"endpoint": "https://us-south.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}'
+ # Set up a two-page mock response
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
content_type='application/json',
status=200,
)
- # Set up parameter values
- name = 'us-south'
-
- # 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()
+ # Exercise the pager class for this operation
+ pager = PrivatePathServiceGatewayAccountPoliciesPager(
+ client=_service,
+ private_path_service_gateway_id='testString',
+ limit=10,
+ account_id='bb1b52262f7441a586f49068482f1e60',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestListRegionZones:
+class TestCreatePrivatePathServiceGatewayAccountPolicy:
"""
- Test Class for list_region_zones
+ Test Class for create_private_path_service_gateway_account_policy
"""
@responses.activate
- def test_list_region_zones_all_params(self):
+ def test_create_private_path_service_gateway_account_policy_all_params(self):
"""
- list_region_zones()
+ create_private_path_service_gateway_account_policy()
"""
# Set up mock
- url = preprocess_url('/regions/us-south/zones')
- mock_response = '{"zones": [{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}]}'
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a AccountIdentityById model
+ account_identity_model = {}
+ account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
+
# Set up parameter values
- region_name = 'us-south'
+ private_path_service_gateway_id = 'testString'
+ access_policy = 'deny'
+ account = account_identity_model
# Invoke method
- response = _service.list_region_zones(
- region_name,
+ response = _service.create_private_path_service_gateway_account_policy(
+ private_path_service_gateway_id,
+ access_policy,
+ account,
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['access_policy'] == 'deny'
+ assert req_body['account'] == account_identity_model
- def test_list_region_zones_all_params_with_retries(self):
- # Enable retries and run test_list_region_zones_all_params.
+ def test_create_private_path_service_gateway_account_policy_all_params_with_retries(self):
+ # Enable retries and run test_create_private_path_service_gateway_account_policy_all_params.
_service.enable_retries()
- self.test_list_region_zones_all_params()
+ self.test_create_private_path_service_gateway_account_policy_all_params()
- # Disable retries and run test_list_region_zones_all_params.
+ # Disable retries and run test_create_private_path_service_gateway_account_policy_all_params.
_service.disable_retries()
- self.test_list_region_zones_all_params()
+ self.test_create_private_path_service_gateway_account_policy_all_params()
@responses.activate
- def test_list_region_zones_value_error(self):
+ def test_create_private_path_service_gateway_account_policy_value_error(self):
"""
- test_list_region_zones_value_error()
+ test_create_private_path_service_gateway_account_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/regions/us-south/zones')
- mock_response = '{"zones": [{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}]}'
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies')
+ mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a AccountIdentityById model
+ account_identity_model = {}
+ account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
+
# Set up parameter values
- region_name = 'us-south'
+ private_path_service_gateway_id = 'testString'
+ access_policy = 'deny'
+ account = account_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "region_name": region_name,
+ "private_path_service_gateway_id": private_path_service_gateway_id,
+ "access_policy": access_policy,
+ "account": account,
}
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.create_private_path_service_gateway_account_policy(**req_copy)
- def test_list_region_zones_value_error_with_retries(self):
- # Enable retries and run test_list_region_zones_value_error.
+ def test_create_private_path_service_gateway_account_policy_value_error_with_retries(self):
+ # Enable retries and run test_create_private_path_service_gateway_account_policy_value_error.
_service.enable_retries()
- self.test_list_region_zones_value_error()
+ self.test_create_private_path_service_gateway_account_policy_value_error()
- # Disable retries and run test_list_region_zones_value_error.
+ # Disable retries and run test_create_private_path_service_gateway_account_policy_value_error.
_service.disable_retries()
- self.test_list_region_zones_value_error()
+ self.test_create_private_path_service_gateway_account_policy_value_error()
-class TestGetRegionZone:
+class TestDeletePrivatePathServiceGatewayAccountPolicy:
"""
- Test Class for get_region_zone
+ Test Class for delete_private_path_service_gateway_account_policy
"""
@responses.activate
- def test_get_region_zone_all_params(self):
+ def test_delete_private_path_service_gateway_account_policy_all_params(self):
"""
- get_region_zone()
+ delete_private_path_service_gateway_account_policy()
"""
# Set up mock
- url = preprocess_url('/regions/us-south/zones/us-south-1')
- mock_response = '{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}'
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- region_name = 'us-south'
- name = 'us-south-1'
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.get_region_zone(
- region_name,
- name,
+ response = _service.delete_private_path_service_gateway_account_policy(
+ private_path_service_gateway_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_region_zone_all_params_with_retries(self):
- # Enable retries and run test_get_region_zone_all_params.
+ def test_delete_private_path_service_gateway_account_policy_all_params_with_retries(self):
+ # Enable retries and run test_delete_private_path_service_gateway_account_policy_all_params.
_service.enable_retries()
- self.test_get_region_zone_all_params()
+ self.test_delete_private_path_service_gateway_account_policy_all_params()
- # Disable retries and run test_get_region_zone_all_params.
+ # Disable retries and run test_delete_private_path_service_gateway_account_policy_all_params.
_service.disable_retries()
- self.test_get_region_zone_all_params()
+ self.test_delete_private_path_service_gateway_account_policy_all_params()
@responses.activate
- def test_get_region_zone_value_error(self):
+ def test_delete_private_path_service_gateway_account_policy_value_error(self):
"""
- test_get_region_zone_value_error()
+ test_delete_private_path_service_gateway_account_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/regions/us-south/zones/us-south-1')
- mock_response = '{"data_center": "DAL12", "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", "universal_name": "us-south-dal10-a"}'
+ url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- region_name = 'us-south'
- name = 'us-south-1'
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "region_name": region_name,
- "name": name,
+ "private_path_service_gateway_id": private_path_service_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_region_zone(**req_copy)
+ _service.delete_private_path_service_gateway_account_policy(**req_copy)
- def test_get_region_zone_value_error_with_retries(self):
- # Enable retries and run test_get_region_zone_value_error.
+ def test_delete_private_path_service_gateway_account_policy_value_error_with_retries(self):
+ # Enable retries and run test_delete_private_path_service_gateway_account_policy_value_error.
_service.enable_retries()
- self.test_get_region_zone_value_error()
+ self.test_delete_private_path_service_gateway_account_policy_value_error()
- # Disable retries and run test_get_region_zone_value_error.
+ # Disable retries and run test_delete_private_path_service_gateway_account_policy_value_error.
_service.disable_retries()
- self.test_get_region_zone_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: Geography
-##############################################################################
-
-##############################################################################
-# Start of Service: VirtualNetworkInterfaces
-##############################################################################
-# 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,
- )
+ self.test_delete_private_path_service_gateway_account_policy_value_error()
-class TestListVirtualNetworkInterfaces:
+class TestGetPrivatePathServiceGatewayAccountPolicy:
"""
- Test Class for list_virtual_network_interfaces
+ Test Class for get_private_path_service_gateway_account_policy
"""
@responses.activate
- def test_list_virtual_network_interfaces_all_params(self):
+ def test_get_private_path_service_gateway_account_policy_all_params(self):
"""
- list_virtual_network_interfaces()
+ get_private_path_service_gateway_account_policy()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/account_policies/testString')
+ mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
responses.add(
responses.GET,
url,
@@ -32235,45 +31748,37 @@ def test_list_virtual_network_interfaces_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_virtual_network_interfaces(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
+ response = _service.get_private_path_service_gateway_account_policy(
+ private_path_service_gateway_id,
+ 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_virtual_network_interfaces_all_params_with_retries(self):
- # Enable retries and run test_list_virtual_network_interfaces_all_params.
+ def test_get_private_path_service_gateway_account_policy_all_params_with_retries(self):
+ # Enable retries and run test_get_private_path_service_gateway_account_policy_all_params.
_service.enable_retries()
- self.test_list_virtual_network_interfaces_all_params()
+ self.test_get_private_path_service_gateway_account_policy_all_params()
- # Disable retries and run test_list_virtual_network_interfaces_all_params.
+ # Disable retries and run test_get_private_path_service_gateway_account_policy_all_params.
_service.disable_retries()
- self.test_list_virtual_network_interfaces_all_params()
+ self.test_get_private_path_service_gateway_account_policy_all_params()
@responses.activate
- def test_list_virtual_network_interfaces_required_params(self):
+ def test_get_private_path_service_gateway_account_policy_value_error(self):
"""
- test_list_virtual_network_interfaces_required_params()
+ test_get_private_path_service_gateway_account_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/account_policies/testString')
+ mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
responses.add(
responses.GET,
url,
@@ -32282,380 +31787,352 @@ def test_list_virtual_network_interfaces_required_params(self):
status=200,
)
- # Invoke method
- response = _service.list_virtual_network_interfaces()
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_virtual_network_interfaces_required_params_with_retries(self):
- # Enable retries and run test_list_virtual_network_interfaces_required_params.
- _service.enable_retries()
- self.test_list_virtual_network_interfaces_required_params()
-
- # Disable retries and run test_list_virtual_network_interfaces_required_params.
- _service.disable_retries()
- self.test_list_virtual_network_interfaces_required_params()
-
- @responses.activate
- def test_list_virtual_network_interfaces_value_error(self):
- """
- test_list_virtual_network_interfaces_value_error()
- """
- # Set up mock
- url = preprocess_url('/virtual_network_interfaces')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "private_path_service_gateway_id": private_path_service_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_virtual_network_interfaces(**req_copy)
+ _service.get_private_path_service_gateway_account_policy(**req_copy)
- def test_list_virtual_network_interfaces_value_error_with_retries(self):
- # Enable retries and run test_list_virtual_network_interfaces_value_error.
+ def test_get_private_path_service_gateway_account_policy_value_error_with_retries(self):
+ # Enable retries and run test_get_private_path_service_gateway_account_policy_value_error.
_service.enable_retries()
- self.test_list_virtual_network_interfaces_value_error()
+ self.test_get_private_path_service_gateway_account_policy_value_error()
- # Disable retries and run test_list_virtual_network_interfaces_value_error.
+ # Disable retries and run test_get_private_path_service_gateway_account_policy_value_error.
_service.disable_retries()
- self.test_list_virtual_network_interfaces_value_error()
-
- @responses.activate
- def test_list_virtual_network_interfaces_with_pager_get_next(self):
- """
- test_list_virtual_network_interfaces_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/virtual_network_interfaces')
- mock_response1 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = VirtualNetworkInterfacesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_virtual_network_interfaces_with_pager_get_all(self):
- """
- test_list_virtual_network_interfaces_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/virtual_network_interfaces')
- mock_response1 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
- mock_response2 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = VirtualNetworkInterfacesPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_get_private_path_service_gateway_account_policy_value_error()
-class TestCreateVirtualNetworkInterface:
+class TestUpdatePrivatePathServiceGatewayAccountPolicy:
"""
- Test Class for create_virtual_network_interface
+ Test Class for update_private_path_service_gateway_account_policy
"""
@responses.activate
- def test_create_virtual_network_interface_all_params(self):
+ def test_update_private_path_service_gateway_account_policy_all_params(self):
"""
- create_virtual_network_interface()
+ update_private_path_service_gateway_account_policy()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/account_policies/testString')
+ mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextById model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextById model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '69e55145-cc7d-4d8e-9e1f-cc3fb60b1793'
+ # Construct a dict representation of a PrivatePathServiceGatewayAccountPolicyPatch model
+ private_path_service_gateway_account_policy_patch_model = {}
+ private_path_service_gateway_account_policy_patch_model['access_policy'] = 'review'
# Set up parameter values
- allow_ip_spoofing = False
- auto_delete = False
- enable_infrastructure_nat = True
- ips = [virtual_network_interface_ip_prototype_model]
- name = 'my-virtual-network-interface'
- primary_ip = virtual_network_interface_primary_ip_prototype_model
- protocol_state_filtering_mode = 'auto'
- resource_group = resource_group_identity_model
- security_groups = [security_group_identity_model]
- subnet = subnet_identity_model
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
+ private_path_service_gateway_account_policy_patch = private_path_service_gateway_account_policy_patch_model
# Invoke method
- response = _service.create_virtual_network_interface(
- allow_ip_spoofing=allow_ip_spoofing,
- auto_delete=auto_delete,
- enable_infrastructure_nat=enable_infrastructure_nat,
- ips=ips,
- name=name,
- primary_ip=primary_ip,
- protocol_state_filtering_mode=protocol_state_filtering_mode,
- resource_group=resource_group,
- security_groups=security_groups,
- subnet=subnet,
+ response = _service.update_private_path_service_gateway_account_policy(
+ private_path_service_gateway_id,
+ id,
+ private_path_service_gateway_account_policy_patch,
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['allow_ip_spoofing'] == False
- assert req_body['auto_delete'] == False
- assert req_body['enable_infrastructure_nat'] == True
- assert req_body['ips'] == [virtual_network_interface_ip_prototype_model]
- assert req_body['name'] == 'my-virtual-network-interface'
- assert req_body['primary_ip'] == virtual_network_interface_primary_ip_prototype_model
- assert req_body['protocol_state_filtering_mode'] == 'auto'
- assert req_body['resource_group'] == resource_group_identity_model
- assert req_body['security_groups'] == [security_group_identity_model]
- assert req_body['subnet'] == subnet_identity_model
+ assert req_body == private_path_service_gateway_account_policy_patch
- def test_create_virtual_network_interface_all_params_with_retries(self):
- # Enable retries and run test_create_virtual_network_interface_all_params.
+ def test_update_private_path_service_gateway_account_policy_all_params_with_retries(self):
+ # Enable retries and run test_update_private_path_service_gateway_account_policy_all_params.
_service.enable_retries()
- self.test_create_virtual_network_interface_all_params()
+ self.test_update_private_path_service_gateway_account_policy_all_params()
- # Disable retries and run test_create_virtual_network_interface_all_params.
+ # Disable retries and run test_update_private_path_service_gateway_account_policy_all_params.
_service.disable_retries()
- self.test_create_virtual_network_interface_all_params()
+ self.test_update_private_path_service_gateway_account_policy_all_params()
@responses.activate
- def test_create_virtual_network_interface_value_error(self):
+ def test_update_private_path_service_gateway_account_policy_value_error(self):
"""
- test_create_virtual_network_interface_value_error()
+ test_update_private_path_service_gateway_account_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/account_policies/testString')
+ mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextById model
- virtual_network_interface_ip_prototype_model = {}
- virtual_network_interface_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
-
- # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextById model
- virtual_network_interface_primary_ip_prototype_model = {}
- virtual_network_interface_primary_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '69e55145-cc7d-4d8e-9e1f-cc3fb60b1793'
+ # Construct a dict representation of a PrivatePathServiceGatewayAccountPolicyPatch model
+ private_path_service_gateway_account_policy_patch_model = {}
+ private_path_service_gateway_account_policy_patch_model['access_policy'] = 'review'
# Set up parameter values
- allow_ip_spoofing = False
- auto_delete = False
- enable_infrastructure_nat = True
- ips = [virtual_network_interface_ip_prototype_model]
- name = 'my-virtual-network-interface'
- primary_ip = virtual_network_interface_primary_ip_prototype_model
- protocol_state_filtering_mode = 'auto'
- resource_group = resource_group_identity_model
- security_groups = [security_group_identity_model]
- subnet = subnet_identity_model
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
+ private_path_service_gateway_account_policy_patch = private_path_service_gateway_account_policy_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "private_path_service_gateway_id": private_path_service_gateway_id,
+ "id": id,
+ "private_path_service_gateway_account_policy_patch": private_path_service_gateway_account_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.create_virtual_network_interface(**req_copy)
+ _service.update_private_path_service_gateway_account_policy(**req_copy)
- def test_create_virtual_network_interface_value_error_with_retries(self):
- # Enable retries and run test_create_virtual_network_interface_value_error.
+ def test_update_private_path_service_gateway_account_policy_value_error_with_retries(self):
+ # Enable retries and run test_update_private_path_service_gateway_account_policy_value_error.
_service.enable_retries()
- self.test_create_virtual_network_interface_value_error()
+ self.test_update_private_path_service_gateway_account_policy_value_error()
- # Disable retries and run test_create_virtual_network_interface_value_error.
+ # Disable retries and run test_update_private_path_service_gateway_account_policy_value_error.
_service.disable_retries()
- self.test_create_virtual_network_interface_value_error()
+ self.test_update_private_path_service_gateway_account_policy_value_error()
-class TestDeleteVirtualNetworkInterfaces:
+class TestListPrivatePathServiceGatewayEndpointGatewayBindings:
"""
- Test Class for delete_virtual_network_interfaces
+ Test Class for list_private_path_service_gateway_endpoint_gateway_bindings
"""
@responses.activate
- def test_delete_virtual_network_interfaces_all_params(self):
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params(self):
+ """
+ list_private_path_service_gateway_endpoint_gateway_bindings()
+ """
+ # Set up mock
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
+ mock_response = '{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ private_path_service_gateway_id = 'testString'
+ start = 'testString'
+ limit = 50
+ status = 'abandoned'
+ account_id = 'bb1b52262f7441a586f49068482f1e60'
+
+ # Invoke method
+ response = _service.list_private_path_service_gateway_endpoint_gateway_bindings(
+ private_path_service_gateway_id,
+ start=start,
+ limit=limit,
+ status=status,
+ account_id=account_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 'status={}'.format(status) in query_string
+ assert 'account.id={}'.format(account_id) in query_string
+
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params.
+ _service.enable_retries()
+ self.test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params()
+
+ # Disable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params.
+ _service.disable_retries()
+ self.test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params()
+
+ @responses.activate
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params(self):
"""
- delete_virtual_network_interfaces()
+ test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/endpoint_gateway_bindings')
+ mock_response = '{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
# Invoke method
- response = _service.delete_virtual_network_interfaces(
- id,
+ response = _service.list_private_path_service_gateway_endpoint_gateway_bindings(
+ private_path_service_gateway_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_virtual_network_interfaces_all_params_with_retries(self):
- # Enable retries and run test_delete_virtual_network_interfaces_all_params.
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params.
_service.enable_retries()
- self.test_delete_virtual_network_interfaces_all_params()
+ self.test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params()
- # Disable retries and run test_delete_virtual_network_interfaces_all_params.
+ # Disable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params.
_service.disable_retries()
- self.test_delete_virtual_network_interfaces_all_params()
+ self.test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params()
@responses.activate
- def test_delete_virtual_network_interfaces_value_error(self):
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error(self):
"""
- test_delete_virtual_network_interfaces_value_error()
+ test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/endpoint_gateway_bindings')
+ mock_response = '{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "private_path_service_gateway_id": private_path_service_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.delete_virtual_network_interfaces(**req_copy)
+ _service.list_private_path_service_gateway_endpoint_gateway_bindings(**req_copy)
- def test_delete_virtual_network_interfaces_value_error_with_retries(self):
- # Enable retries and run test_delete_virtual_network_interfaces_value_error.
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error_with_retries(self):
+ # Enable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error.
_service.enable_retries()
- self.test_delete_virtual_network_interfaces_value_error()
+ self.test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error()
- # Disable retries and run test_delete_virtual_network_interfaces_value_error.
+ # Disable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error.
_service.disable_retries()
- self.test_delete_virtual_network_interfaces_value_error()
+ self.test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error()
+
+ @responses.activate
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_next(self):
+ """
+ test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = PrivatePathServiceGatewayEndpointGatewayBindingsPager(
+ client=_service,
+ private_path_service_gateway_id='testString',
+ limit=10,
+ status='abandoned',
+ account_id='bb1b52262f7441a586f49068482f1e60',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestGetVirtualNetworkInterface:
+ @responses.activate
+ def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_all(self):
+ """
+ test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = PrivatePathServiceGatewayEndpointGatewayBindingsPager(
+ client=_service,
+ private_path_service_gateway_id='testString',
+ limit=10,
+ status='abandoned',
+ account_id='bb1b52262f7441a586f49068482f1e60',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestGetPrivatePathServiceGatewayEndpointGatewayBinding:
"""
- Test Class for get_virtual_network_interface
+ Test Class for get_private_path_service_gateway_endpoint_gateway_binding
"""
@responses.activate
- def test_get_virtual_network_interface_all_params(self):
+ def test_get_private_path_service_gateway_endpoint_gateway_binding_all_params(self):
"""
- get_virtual_network_interface()
+ get_private_path_service_gateway_endpoint_gateway_binding()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString')
+ mock_response = '{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}'
responses.add(
responses.GET,
url,
@@ -32665,10 +32142,12 @@ def test_get_virtual_network_interface_all_params(self):
)
# Set up parameter values
+ private_path_service_gateway_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_virtual_network_interface(
+ response = _service.get_private_path_service_gateway_endpoint_gateway_binding(
+ private_path_service_gateway_id,
id,
headers={},
)
@@ -32677,23 +32156,23 @@ def test_get_virtual_network_interface_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_virtual_network_interface_all_params_with_retries(self):
- # Enable retries and run test_get_virtual_network_interface_all_params.
+ def test_get_private_path_service_gateway_endpoint_gateway_binding_all_params_with_retries(self):
+ # Enable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_all_params.
_service.enable_retries()
- self.test_get_virtual_network_interface_all_params()
+ self.test_get_private_path_service_gateway_endpoint_gateway_binding_all_params()
- # Disable retries and run test_get_virtual_network_interface_all_params.
+ # Disable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_all_params.
_service.disable_retries()
- self.test_get_virtual_network_interface_all_params()
+ self.test_get_private_path_service_gateway_endpoint_gateway_binding_all_params()
@responses.activate
- def test_get_virtual_network_interface_value_error(self):
+ def test_get_private_path_service_gateway_endpoint_gateway_binding_value_error(self):
"""
- test_get_virtual_network_interface_value_error()
+ test_get_private_path_service_gateway_endpoint_gateway_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString')
+ mock_response = '{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}'
responses.add(
responses.GET,
url,
@@ -32703,361 +32182,295 @@ def test_get_virtual_network_interface_value_error(self):
)
# Set up parameter values
+ private_path_service_gateway_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "private_path_service_gateway_id": private_path_service_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_virtual_network_interface(**req_copy)
+ _service.get_private_path_service_gateway_endpoint_gateway_binding(**req_copy)
- def test_get_virtual_network_interface_value_error_with_retries(self):
- # Enable retries and run test_get_virtual_network_interface_value_error.
+ def test_get_private_path_service_gateway_endpoint_gateway_binding_value_error_with_retries(self):
+ # Enable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_value_error.
_service.enable_retries()
- self.test_get_virtual_network_interface_value_error()
+ self.test_get_private_path_service_gateway_endpoint_gateway_binding_value_error()
- # Disable retries and run test_get_virtual_network_interface_value_error.
+ # Disable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_value_error.
_service.disable_retries()
- self.test_get_virtual_network_interface_value_error()
+ self.test_get_private_path_service_gateway_endpoint_gateway_binding_value_error()
-class TestUpdateVirtualNetworkInterface:
+class TestDenyPrivatePathServiceGatewayEndpointGatewayBinding:
"""
- Test Class for update_virtual_network_interface
+ Test Class for deny_private_path_service_gateway_endpoint_gateway_binding
"""
@responses.activate
- def test_update_virtual_network_interface_all_params(self):
+ def test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params(self):
"""
- update_virtual_network_interface()
+ deny_private_path_service_gateway_endpoint_gateway_binding()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/deny')
responses.add(
- responses.PATCH,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a VirtualNetworkInterfacePatch model
- virtual_network_interface_patch_model = {}
- virtual_network_interface_patch_model['allow_ip_spoofing'] = True
- virtual_network_interface_patch_model['auto_delete'] = False
- virtual_network_interface_patch_model['enable_infrastructure_nat'] = True
- virtual_network_interface_patch_model['name'] = 'my-virtual-network-interface'
- virtual_network_interface_patch_model['protocol_state_filtering_mode'] = 'auto'
-
# Set up parameter values
+ private_path_service_gateway_id = 'testString'
id = 'testString'
- virtual_network_interface_patch = virtual_network_interface_patch_model
+ set_account_policy = True
# Invoke method
- response = _service.update_virtual_network_interface(
+ response = _service.deny_private_path_service_gateway_endpoint_gateway_binding(
+ private_path_service_gateway_id,
id,
- virtual_network_interface_patch,
+ set_account_policy=set_account_policy,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
# Validate body params
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body == virtual_network_interface_patch
+ assert req_body['set_account_policy'] == True
- def test_update_virtual_network_interface_all_params_with_retries(self):
- # Enable retries and run test_update_virtual_network_interface_all_params.
+ def test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params_with_retries(self):
+ # Enable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params.
_service.enable_retries()
- self.test_update_virtual_network_interface_all_params()
+ self.test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params()
- # Disable retries and run test_update_virtual_network_interface_all_params.
+ # Disable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params.
_service.disable_retries()
- self.test_update_virtual_network_interface_all_params()
+ self.test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params()
@responses.activate
- def test_update_virtual_network_interface_value_error(self):
+ def test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params(self):
"""
- test_update_virtual_network_interface_value_error()
+ test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/deny')
responses.add(
- responses.PATCH,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a VirtualNetworkInterfacePatch model
- virtual_network_interface_patch_model = {}
- virtual_network_interface_patch_model['allow_ip_spoofing'] = True
- virtual_network_interface_patch_model['auto_delete'] = False
- virtual_network_interface_patch_model['enable_infrastructure_nat'] = True
- virtual_network_interface_patch_model['name'] = 'my-virtual-network-interface'
- virtual_network_interface_patch_model['protocol_state_filtering_mode'] = 'auto'
+ # Set up parameter values
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.deny_private_path_service_gateway_endpoint_gateway_binding(
+ private_path_service_gateway_id,
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 204
+
+ def test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params_with_retries(self):
+ # Enable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params.
+ _service.enable_retries()
+ self.test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params()
+
+ # Disable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params.
+ _service.disable_retries()
+ self.test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params()
+
+ @responses.activate
+ def test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error(self):
+ """
+ test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/deny')
+ responses.add(
+ responses.POST,
+ url,
+ status=204,
+ )
# Set up parameter values
+ private_path_service_gateway_id = 'testString'
id = 'testString'
- virtual_network_interface_patch = virtual_network_interface_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "private_path_service_gateway_id": private_path_service_gateway_id,
"id": id,
- "virtual_network_interface_patch": virtual_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_virtual_network_interface(**req_copy)
+ _service.deny_private_path_service_gateway_endpoint_gateway_binding(**req_copy)
- def test_update_virtual_network_interface_value_error_with_retries(self):
- # Enable retries and run test_update_virtual_network_interface_value_error.
+ def test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error_with_retries(self):
+ # Enable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error.
_service.enable_retries()
- self.test_update_virtual_network_interface_value_error()
+ self.test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error()
- # Disable retries and run test_update_virtual_network_interface_value_error.
+ # Disable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error.
_service.disable_retries()
- self.test_update_virtual_network_interface_value_error()
+ self.test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error()
-class TestListNetworkInterfaceFloatingIps:
+class TestPermitPrivatePathServiceGatewayEndpointGatewayBinding:
"""
- Test Class for list_network_interface_floating_ips
+ Test Class for permit_private_path_service_gateway_endpoint_gateway_binding
"""
@responses.activate
- def test_list_network_interface_floating_ips_all_params(self):
+ def test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params(self):
"""
- list_network_interface_floating_ips()
+ permit_private_path_service_gateway_endpoint_gateway_binding()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
- mock_response = '{"first": {"href": "href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/permit')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
- start = 'testString'
- limit = 50
- sort = 'name'
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
+ set_account_policy = True
# Invoke method
- response = _service.list_network_interface_floating_ips(
- virtual_network_interface_id,
- start=start,
- limit=limit,
- sort=sort,
+ response = _service.permit_private_path_service_gateway_endpoint_gateway_binding(
+ private_path_service_gateway_id,
+ id,
+ set_account_policy=set_account_policy,
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
+ assert response.status_code == 204
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body['set_account_policy'] == True
- def test_list_network_interface_floating_ips_all_params_with_retries(self):
- # Enable retries and run test_list_network_interface_floating_ips_all_params.
+ def test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params_with_retries(self):
+ # Enable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params.
_service.enable_retries()
- self.test_list_network_interface_floating_ips_all_params()
+ self.test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params()
- # Disable retries and run test_list_network_interface_floating_ips_all_params.
+ # Disable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params.
_service.disable_retries()
- self.test_list_network_interface_floating_ips_all_params()
+ self.test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params()
@responses.activate
- def test_list_network_interface_floating_ips_required_params(self):
+ def test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params(self):
"""
- test_list_network_interface_floating_ips_required_params()
+ test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
- mock_response = '{"first": {"href": "href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/permit')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_network_interface_floating_ips(
- virtual_network_interface_id,
+ response = _service.permit_private_path_service_gateway_endpoint_gateway_binding(
+ private_path_service_gateway_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_list_network_interface_floating_ips_required_params_with_retries(self):
- # Enable retries and run test_list_network_interface_floating_ips_required_params.
+ def test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params_with_retries(self):
+ # Enable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params.
_service.enable_retries()
- self.test_list_network_interface_floating_ips_required_params()
+ self.test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params()
- # Disable retries and run test_list_network_interface_floating_ips_required_params.
+ # Disable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params.
_service.disable_retries()
- self.test_list_network_interface_floating_ips_required_params()
+ self.test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params()
@responses.activate
- def test_list_network_interface_floating_ips_value_error(self):
+ def test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error(self):
"""
- test_list_network_interface_floating_ips_value_error()
+ test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
- mock_response = '{"first": {"href": "href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/permit')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
+ private_path_service_gateway_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_network_interface_id,
+ "private_path_service_gateway_id": private_path_service_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_network_interface_floating_ips(**req_copy)
+ _service.permit_private_path_service_gateway_endpoint_gateway_binding(**req_copy)
- def test_list_network_interface_floating_ips_value_error_with_retries(self):
- # Enable retries and run test_list_network_interface_floating_ips_value_error.
+ def test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error_with_retries(self):
+ # Enable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error.
_service.enable_retries()
- self.test_list_network_interface_floating_ips_value_error()
+ self.test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error()
- # Disable retries and run test_list_network_interface_floating_ips_value_error.
+ # Disable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error.
_service.disable_retries()
- self.test_list_network_interface_floating_ips_value_error()
-
- @responses.activate
- def test_list_network_interface_floating_ips_with_pager_get_next(self):
- """
- test_list_network_interface_floating_ips_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = NetworkInterfaceFloatingIpsPager(
- client=_service,
- virtual_network_interface_id='testString',
- limit=10,
- sort='name',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_network_interface_floating_ips_with_pager_get_all(self):
- """
- test_list_network_interface_floating_ips_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = NetworkInterfaceFloatingIpsPager(
- client=_service,
- virtual_network_interface_id='testString',
- limit=10,
- sort='name',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error()
-class TestRemoveNetworkInterfaceFloatingIp:
+class TestPublishPrivatePathServiceGateway:
"""
- Test Class for remove_network_interface_floating_ip
+ Test Class for publish_private_path_service_gateway
"""
@responses.activate
- def test_remove_network_interface_floating_ip_all_params(self):
+ def test_publish_private_path_service_gateway_all_params(self):
"""
- remove_network_interface_floating_ip()
+ publish_private_path_service_gateway()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
+ url = preprocess_url('/private_path_service_gateways/testString/publish')
responses.add(
- responses.DELETE,
+ responses.POST,
url,
status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
# Invoke method
- response = _service.remove_network_interface_floating_ip(
- virtual_network_interface_id,
- id,
+ response = _service.publish_private_path_service_gateway(
+ private_path_service_gateway_id,
headers={},
)
@@ -33065,235 +32478,285 @@ def test_remove_network_interface_floating_ip_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_remove_network_interface_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_remove_network_interface_floating_ip_all_params.
+ def test_publish_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_publish_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_remove_network_interface_floating_ip_all_params()
+ self.test_publish_private_path_service_gateway_all_params()
- # Disable retries and run test_remove_network_interface_floating_ip_all_params.
+ # Disable retries and run test_publish_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_remove_network_interface_floating_ip_all_params()
+ self.test_publish_private_path_service_gateway_all_params()
@responses.activate
- def test_remove_network_interface_floating_ip_value_error(self):
+ def test_publish_private_path_service_gateway_value_error(self):
"""
- test_remove_network_interface_floating_ip_value_error()
+ test_publish_private_path_service_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
+ url = preprocess_url('/private_path_service_gateways/testString/publish')
responses.add(
- responses.DELETE,
+ responses.POST,
url,
status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_network_interface_id,
- "id": id,
+ "private_path_service_gateway_id": private_path_service_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.remove_network_interface_floating_ip(**req_copy)
+ _service.publish_private_path_service_gateway(**req_copy)
- def test_remove_network_interface_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_remove_network_interface_floating_ip_value_error.
+ def test_publish_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_publish_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_remove_network_interface_floating_ip_value_error()
+ self.test_publish_private_path_service_gateway_value_error()
- # Disable retries and run test_remove_network_interface_floating_ip_value_error.
+ # Disable retries and run test_publish_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_remove_network_interface_floating_ip_value_error()
+ self.test_publish_private_path_service_gateway_value_error()
-class TestGetNetworkInterfaceFloatingIp:
+class TestRevokeAccountForPrivatePathServiceGateway:
"""
- Test Class for get_network_interface_floating_ip
+ Test Class for revoke_account_for_private_path_service_gateway
"""
@responses.activate
- def test_get_network_interface_floating_ip_all_params(self):
+ def test_revoke_account_for_private_path_service_gateway_all_params(self):
"""
- get_network_interface_floating_ip()
+ revoke_account_for_private_path_service_gateway()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
- mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
+ url = preprocess_url('/private_path_service_gateways/testString/revoke_account')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
+ # Construct a dict representation of a AccountIdentityById model
+ account_identity_model = {}
+ account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
+
# Set up parameter values
- virtual_network_interface_id = 'testString'
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
+ account = account_identity_model
# Invoke method
- response = _service.get_network_interface_floating_ip(
- virtual_network_interface_id,
- id,
+ response = _service.revoke_account_for_private_path_service_gateway(
+ private_path_service_gateway_id,
+ account,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body['account'] == account_identity_model
- def test_get_network_interface_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_get_network_interface_floating_ip_all_params.
+ def test_revoke_account_for_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_revoke_account_for_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_get_network_interface_floating_ip_all_params()
+ self.test_revoke_account_for_private_path_service_gateway_all_params()
- # Disable retries and run test_get_network_interface_floating_ip_all_params.
+ # Disable retries and run test_revoke_account_for_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_get_network_interface_floating_ip_all_params()
+ self.test_revoke_account_for_private_path_service_gateway_all_params()
@responses.activate
- def test_get_network_interface_floating_ip_value_error(self):
+ def test_revoke_account_for_private_path_service_gateway_value_error(self):
"""
- test_get_network_interface_floating_ip_value_error()
+ test_revoke_account_for_private_path_service_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
- mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
+ url = preprocess_url('/private_path_service_gateways/testString/revoke_account')
responses.add(
- responses.GET,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
+ # Construct a dict representation of a AccountIdentityById model
+ account_identity_model = {}
+ account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
+
# Set up parameter values
- virtual_network_interface_id = 'testString'
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
+ account = account_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_network_interface_id,
- "id": id,
+ "private_path_service_gateway_id": private_path_service_gateway_id,
+ "account": account,
}
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_interface_floating_ip(**req_copy)
+ _service.revoke_account_for_private_path_service_gateway(**req_copy)
- def test_get_network_interface_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_get_network_interface_floating_ip_value_error.
+ def test_revoke_account_for_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_revoke_account_for_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_get_network_interface_floating_ip_value_error()
+ self.test_revoke_account_for_private_path_service_gateway_value_error()
- # Disable retries and run test_get_network_interface_floating_ip_value_error.
+ # Disable retries and run test_revoke_account_for_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_get_network_interface_floating_ip_value_error()
+ self.test_revoke_account_for_private_path_service_gateway_value_error()
-class TestAddNetworkInterfaceFloatingIp:
+class TestUnpublishPrivatePathServiceGateway:
"""
- Test Class for add_network_interface_floating_ip
+ Test Class for unpublish_private_path_service_gateway
"""
@responses.activate
- def test_add_network_interface_floating_ip_all_params(self):
+ def test_unpublish_private_path_service_gateway_all_params(self):
"""
- add_network_interface_floating_ip()
+ unpublish_private_path_service_gateway()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
- mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
+ url = preprocess_url('/private_path_service_gateways/testString/unpublish')
responses.add(
- responses.PUT,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
# Invoke method
- response = _service.add_network_interface_floating_ip(
- virtual_network_interface_id,
- id,
+ response = _service.unpublish_private_path_service_gateway(
+ private_path_service_gateway_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_add_network_interface_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_add_network_interface_floating_ip_all_params.
+ def test_unpublish_private_path_service_gateway_all_params_with_retries(self):
+ # Enable retries and run test_unpublish_private_path_service_gateway_all_params.
_service.enable_retries()
- self.test_add_network_interface_floating_ip_all_params()
+ self.test_unpublish_private_path_service_gateway_all_params()
- # Disable retries and run test_add_network_interface_floating_ip_all_params.
+ # Disable retries and run test_unpublish_private_path_service_gateway_all_params.
_service.disable_retries()
- self.test_add_network_interface_floating_ip_all_params()
+ self.test_unpublish_private_path_service_gateway_all_params()
@responses.activate
- def test_add_network_interface_floating_ip_value_error(self):
+ def test_unpublish_private_path_service_gateway_value_error(self):
"""
- test_add_network_interface_floating_ip_value_error()
+ test_unpublish_private_path_service_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
- mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
+ url = preprocess_url('/private_path_service_gateways/testString/unpublish')
responses.add(
- responses.PUT,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
- id = 'testString'
+ private_path_service_gateway_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_network_interface_id,
- "id": id,
+ "private_path_service_gateway_id": private_path_service_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.add_network_interface_floating_ip(**req_copy)
+ _service.unpublish_private_path_service_gateway(**req_copy)
- def test_add_network_interface_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_add_network_interface_floating_ip_value_error.
+ def test_unpublish_private_path_service_gateway_value_error_with_retries(self):
+ # Enable retries and run test_unpublish_private_path_service_gateway_value_error.
_service.enable_retries()
- self.test_add_network_interface_floating_ip_value_error()
+ self.test_unpublish_private_path_service_gateway_value_error()
- # Disable retries and run test_add_network_interface_floating_ip_value_error.
+ # Disable retries and run test_unpublish_private_path_service_gateway_value_error.
_service.disable_retries()
- self.test_add_network_interface_floating_ip_value_error()
+ self.test_unpublish_private_path_service_gateway_value_error()
-class TestListVirtualNetworkInterfaceIps:
+# endregion
+##############################################################################
+# End of Service: PrivatePathServiceGateways
+##############################################################################
+
+##############################################################################
+# Start of Service: PublicAddressRanges
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_virtual_network_interface_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 TestListPublicAddressRanges:
+ """
+ Test Class for list_public_address_ranges
"""
@responses.activate
- def test_list_virtual_network_interface_ips_all_params(self):
+ def test_list_public_address_ranges_all_params(self):
"""
- list_virtual_network_interface_ips()
+ list_public_address_ranges()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_address_ranges')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_address_ranges": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -33303,17 +32766,15 @@ def test_list_virtual_network_interface_ips_all_params(self):
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
start = 'testString'
limit = 50
- sort = 'name'
+ resource_group_id = 'testString'
# Invoke method
- response = _service.list_virtual_network_interface_ips(
- virtual_network_interface_id,
+ response = _service.list_public_address_ranges(
start=start,
limit=limit,
- sort=sort,
+ resource_group_id=resource_group_id,
headers={},
)
@@ -33325,25 +32786,25 @@ def test_list_virtual_network_interface_ips_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 'sort={}'.format(sort) in query_string
+ assert 'resource_group.id={}'.format(resource_group_id) in query_string
- def test_list_virtual_network_interface_ips_all_params_with_retries(self):
- # Enable retries and run test_list_virtual_network_interface_ips_all_params.
+ def test_list_public_address_ranges_all_params_with_retries(self):
+ # Enable retries and run test_list_public_address_ranges_all_params.
_service.enable_retries()
- self.test_list_virtual_network_interface_ips_all_params()
+ self.test_list_public_address_ranges_all_params()
- # Disable retries and run test_list_virtual_network_interface_ips_all_params.
+ # Disable retries and run test_list_public_address_ranges_all_params.
_service.disable_retries()
- self.test_list_virtual_network_interface_ips_all_params()
+ self.test_list_public_address_ranges_all_params()
@responses.activate
- def test_list_virtual_network_interface_ips_required_params(self):
+ def test_list_public_address_ranges_required_params(self):
"""
- test_list_virtual_network_interface_ips_required_params()
+ test_list_public_address_ranges_required_params()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_address_ranges')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_address_ranges": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -33352,36 +32813,30 @@ def test_list_virtual_network_interface_ips_required_params(self):
status=200,
)
- # Set up parameter values
- virtual_network_interface_id = 'testString'
-
# Invoke method
- response = _service.list_virtual_network_interface_ips(
- virtual_network_interface_id,
- headers={},
- )
+ response = _service.list_public_address_ranges()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_virtual_network_interface_ips_required_params_with_retries(self):
- # Enable retries and run test_list_virtual_network_interface_ips_required_params.
+ def test_list_public_address_ranges_required_params_with_retries(self):
+ # Enable retries and run test_list_public_address_ranges_required_params.
_service.enable_retries()
- self.test_list_virtual_network_interface_ips_required_params()
+ self.test_list_public_address_ranges_required_params()
- # Disable retries and run test_list_virtual_network_interface_ips_required_params.
+ # Disable retries and run test_list_public_address_ranges_required_params.
_service.disable_retries()
- self.test_list_virtual_network_interface_ips_required_params()
+ self.test_list_public_address_ranges_required_params()
@responses.activate
- def test_list_virtual_network_interface_ips_value_error(self):
+ def test_list_public_address_ranges_value_error(self):
"""
- test_list_virtual_network_interface_ips_value_error()
+ test_list_public_address_ranges_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_address_ranges')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_address_ranges": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -33390,36 +32845,32 @@ def test_list_virtual_network_interface_ips_value_error(self):
status=200,
)
- # Set up parameter values
- virtual_network_interface_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_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_virtual_network_interface_ips(**req_copy)
+ _service.list_public_address_ranges(**req_copy)
- def test_list_virtual_network_interface_ips_value_error_with_retries(self):
- # Enable retries and run test_list_virtual_network_interface_ips_value_error.
+ def test_list_public_address_ranges_value_error_with_retries(self):
+ # Enable retries and run test_list_public_address_ranges_value_error.
_service.enable_retries()
- self.test_list_virtual_network_interface_ips_value_error()
+ self.test_list_public_address_ranges_value_error()
- # Disable retries and run test_list_virtual_network_interface_ips_value_error.
+ # Disable retries and run test_list_public_address_ranges_value_error.
_service.disable_retries()
- self.test_list_virtual_network_interface_ips_value_error()
+ self.test_list_public_address_ranges_value_error()
@responses.activate
- def test_list_virtual_network_interface_ips_with_pager_get_next(self):
+ def test_list_public_address_ranges_with_pager_get_next(self):
"""
- test_list_virtual_network_interface_ips_with_pager_get_next()
+ test_list_public_address_ranges_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/virtual_network_interfaces/testString/ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
+ url = preprocess_url('/public_address_ranges')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -33437,11 +32888,10 @@ def test_list_virtual_network_interface_ips_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VirtualNetworkInterfaceIpsPager(
+ pager = PublicAddressRangesPager(
client=_service,
- virtual_network_interface_id='testString',
limit=10,
- sort='name',
+ resource_group_id='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -33450,14 +32900,14 @@ def test_list_virtual_network_interface_ips_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_virtual_network_interface_ips_with_pager_get_all(self):
+ def test_list_public_address_ranges_with_pager_get_all(self):
"""
- test_list_virtual_network_interface_ips_with_pager_get_all()
+ test_list_public_address_ranges_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/virtual_network_interfaces/testString/ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
+ url = preprocess_url('/public_address_ranges')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -33474,109 +32924,240 @@ def test_list_virtual_network_interface_ips_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VirtualNetworkInterfaceIpsPager(
+ pager = PublicAddressRangesPager(
client=_service,
- virtual_network_interface_id='testString',
limit=10,
- sort='name',
+ resource_group_id='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestRemoveVirtualNetworkInterfaceIp:
+class TestCreatePublicAddressRange:
"""
- Test Class for remove_virtual_network_interface_ip
+ Test Class for create_public_address_range
"""
@responses.activate
- def test_remove_virtual_network_interface_ip_all_params(self):
+ def test_create_public_address_range_all_params(self):
"""
- remove_virtual_network_interface_ip()
+ create_public_address_range()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
+ url = preprocess_url('/public_address_ranges')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 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'] = 'r006-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 PublicAddressRangeTargetPrototype model
+ public_address_range_target_prototype_model = {}
+ public_address_range_target_prototype_model['vpc'] = vpc_identity_model
+ public_address_range_target_prototype_model['zone'] = zone_identity_model
+
+ # Set up parameter values
+ ipv4_address_count = 8
+ name = 'my-public-address-range'
+ resource_group = resource_group_identity_model
+ target = public_address_range_target_prototype_model
+
+ # Invoke method
+ response = _service.create_public_address_range(
+ ipv4_address_count,
+ name=name,
+ resource_group=resource_group,
+ target=target,
+ 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['ipv4_address_count'] == 8
+ assert req_body['name'] == 'my-public-address-range'
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['target'] == public_address_range_target_prototype_model
+
+ def test_create_public_address_range_all_params_with_retries(self):
+ # Enable retries and run test_create_public_address_range_all_params.
+ _service.enable_retries()
+ self.test_create_public_address_range_all_params()
+
+ # Disable retries and run test_create_public_address_range_all_params.
+ _service.disable_retries()
+ self.test_create_public_address_range_all_params()
+
+ @responses.activate
+ def test_create_public_address_range_value_error(self):
+ """
+ test_create_public_address_range_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/public_address_ranges')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 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'] = 'r006-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 PublicAddressRangeTargetPrototype model
+ public_address_range_target_prototype_model = {}
+ public_address_range_target_prototype_model['vpc'] = vpc_identity_model
+ public_address_range_target_prototype_model['zone'] = zone_identity_model
+
+ # Set up parameter values
+ ipv4_address_count = 8
+ name = 'my-public-address-range'
+ resource_group = resource_group_identity_model
+ target = public_address_range_target_prototype_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "ipv4_address_count": ipv4_address_count,
+ }
+ 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_address_range(**req_copy)
+
+ def test_create_public_address_range_value_error_with_retries(self):
+ # Enable retries and run test_create_public_address_range_value_error.
+ _service.enable_retries()
+ self.test_create_public_address_range_value_error()
+
+ # Disable retries and run test_create_public_address_range_value_error.
+ _service.disable_retries()
+ self.test_create_public_address_range_value_error()
+
+
+class TestDeletePublicAddressRange:
+ """
+ Test Class for delete_public_address_range
+ """
+
+ @responses.activate
+ def test_delete_public_address_range_all_params(self):
+ """
+ delete_public_address_range()
+ """
+ # Set up mock
+ url = preprocess_url('/public_address_ranges/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.remove_virtual_network_interface_ip(
- virtual_network_interface_id,
+ response = _service.delete_public_address_range(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 202
- def test_remove_virtual_network_interface_ip_all_params_with_retries(self):
- # Enable retries and run test_remove_virtual_network_interface_ip_all_params.
+ def test_delete_public_address_range_all_params_with_retries(self):
+ # Enable retries and run test_delete_public_address_range_all_params.
_service.enable_retries()
- self.test_remove_virtual_network_interface_ip_all_params()
+ self.test_delete_public_address_range_all_params()
- # Disable retries and run test_remove_virtual_network_interface_ip_all_params.
+ # Disable retries and run test_delete_public_address_range_all_params.
_service.disable_retries()
- self.test_remove_virtual_network_interface_ip_all_params()
+ self.test_delete_public_address_range_all_params()
@responses.activate
- def test_remove_virtual_network_interface_ip_value_error(self):
+ def test_delete_public_address_range_value_error(self):
"""
- test_remove_virtual_network_interface_ip_value_error()
+ test_delete_public_address_range_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
+ url = preprocess_url('/public_address_ranges/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_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_virtual_network_interface_ip(**req_copy)
+ _service.delete_public_address_range(**req_copy)
- def test_remove_virtual_network_interface_ip_value_error_with_retries(self):
- # Enable retries and run test_remove_virtual_network_interface_ip_value_error.
+ def test_delete_public_address_range_value_error_with_retries(self):
+ # Enable retries and run test_delete_public_address_range_value_error.
_service.enable_retries()
- self.test_remove_virtual_network_interface_ip_value_error()
+ self.test_delete_public_address_range_value_error()
- # Disable retries and run test_remove_virtual_network_interface_ip_value_error.
+ # Disable retries and run test_delete_public_address_range_value_error.
_service.disable_retries()
- self.test_remove_virtual_network_interface_ip_value_error()
+ self.test_delete_public_address_range_value_error()
-class TestGetVirtualNetworkInterfaceIp:
+class TestGetPublicAddressRange:
"""
- Test Class for get_virtual_network_interface_ip
+ Test Class for get_public_address_range
"""
@responses.activate
- def test_get_virtual_network_interface_ip_all_params(self):
+ def test_get_public_address_range_all_params(self):
"""
- get_virtual_network_interface_ip()
+ get_public_address_range()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
- mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
+ url = preprocess_url('/public_address_ranges/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -33586,12 +33167,10 @@ def test_get_virtual_network_interface_ip_all_params(self):
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_virtual_network_interface_ip(
- virtual_network_interface_id,
+ response = _service.get_public_address_range(
id,
headers={},
)
@@ -33600,23 +33179,23 @@ def test_get_virtual_network_interface_ip_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_virtual_network_interface_ip_all_params_with_retries(self):
- # Enable retries and run test_get_virtual_network_interface_ip_all_params.
+ def test_get_public_address_range_all_params_with_retries(self):
+ # Enable retries and run test_get_public_address_range_all_params.
_service.enable_retries()
- self.test_get_virtual_network_interface_ip_all_params()
+ self.test_get_public_address_range_all_params()
- # Disable retries and run test_get_virtual_network_interface_ip_all_params.
+ # Disable retries and run test_get_public_address_range_all_params.
_service.disable_retries()
- self.test_get_virtual_network_interface_ip_all_params()
+ self.test_get_public_address_range_all_params()
@responses.activate
- def test_get_virtual_network_interface_ip_value_error(self):
+ def test_get_public_address_range_value_error(self):
"""
- test_get_virtual_network_interface_ip_value_error()
+ test_get_public_address_range_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
- mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
+ url = preprocess_url('/public_address_ranges/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -33626,121 +33205,158 @@ def test_get_virtual_network_interface_ip_value_error(self):
)
# Set up parameter values
- virtual_network_interface_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_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_virtual_network_interface_ip(**req_copy)
+ _service.get_public_address_range(**req_copy)
- def test_get_virtual_network_interface_ip_value_error_with_retries(self):
- # Enable retries and run test_get_virtual_network_interface_ip_value_error.
+ def test_get_public_address_range_value_error_with_retries(self):
+ # Enable retries and run test_get_public_address_range_value_error.
_service.enable_retries()
- self.test_get_virtual_network_interface_ip_value_error()
+ self.test_get_public_address_range_value_error()
- # Disable retries and run test_get_virtual_network_interface_ip_value_error.
+ # Disable retries and run test_get_public_address_range_value_error.
_service.disable_retries()
- self.test_get_virtual_network_interface_ip_value_error()
+ self.test_get_public_address_range_value_error()
-class TestAddVirtualNetworkInterfaceIp:
+class TestUpdatePublicAddressRange:
"""
- Test Class for add_virtual_network_interface_ip
+ Test Class for update_public_address_range
"""
@responses.activate
- def test_add_virtual_network_interface_ip_all_params(self):
+ def test_update_public_address_range_all_params(self):
"""
- add_virtual_network_interface_ip()
+ update_public_address_range()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
- mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
+ url = preprocess_url('/public_address_ranges/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.PUT,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 PublicAddressRangeTargetPatch model
+ public_address_range_target_patch_model = {}
+ public_address_range_target_patch_model['vpc'] = vpc_identity_model
+ public_address_range_target_patch_model['zone'] = zone_identity_model
+
+ # Construct a dict representation of a PublicAddressRangePatch model
+ public_address_range_patch_model = {}
+ public_address_range_patch_model['name'] = 'my-public-address-range-updated'
+ public_address_range_patch_model['target'] = public_address_range_target_patch_model
+
# Set up parameter values
- virtual_network_interface_id = 'testString'
id = 'testString'
+ public_address_range_patch = public_address_range_patch_model
# Invoke method
- response = _service.add_virtual_network_interface_ip(
- virtual_network_interface_id,
+ response = _service.update_public_address_range(
id,
+ public_address_range_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 == public_address_range_patch
- def test_add_virtual_network_interface_ip_all_params_with_retries(self):
- # Enable retries and run test_add_virtual_network_interface_ip_all_params.
+ def test_update_public_address_range_all_params_with_retries(self):
+ # Enable retries and run test_update_public_address_range_all_params.
_service.enable_retries()
- self.test_add_virtual_network_interface_ip_all_params()
+ self.test_update_public_address_range_all_params()
- # Disable retries and run test_add_virtual_network_interface_ip_all_params.
+ # Disable retries and run test_update_public_address_range_all_params.
_service.disable_retries()
- self.test_add_virtual_network_interface_ip_all_params()
+ self.test_update_public_address_range_all_params()
@responses.activate
- def test_add_virtual_network_interface_ip_value_error(self):
+ def test_update_public_address_range_value_error(self):
"""
- test_add_virtual_network_interface_ip_value_error()
+ test_update_public_address_range_value_error()
"""
# Set up mock
- url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
- mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
+ url = preprocess_url('/public_address_ranges/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.PUT,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 PublicAddressRangeTargetPatch model
+ public_address_range_target_patch_model = {}
+ public_address_range_target_patch_model['vpc'] = vpc_identity_model
+ public_address_range_target_patch_model['zone'] = zone_identity_model
+
+ # Construct a dict representation of a PublicAddressRangePatch model
+ public_address_range_patch_model = {}
+ public_address_range_patch_model['name'] = 'my-public-address-range-updated'
+ public_address_range_patch_model['target'] = public_address_range_target_patch_model
+
# Set up parameter values
- virtual_network_interface_id = 'testString'
id = 'testString'
+ public_address_range_patch = public_address_range_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "virtual_network_interface_id": virtual_network_interface_id,
"id": id,
+ "public_address_range_patch": public_address_range_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_virtual_network_interface_ip(**req_copy)
+ _service.update_public_address_range(**req_copy)
- def test_add_virtual_network_interface_ip_value_error_with_retries(self):
- # Enable retries and run test_add_virtual_network_interface_ip_value_error.
+ def test_update_public_address_range_value_error_with_retries(self):
+ # Enable retries and run test_update_public_address_range_value_error.
_service.enable_retries()
- self.test_add_virtual_network_interface_ip_value_error()
+ self.test_update_public_address_range_value_error()
- # Disable retries and run test_add_virtual_network_interface_ip_value_error.
+ # Disable retries and run test_update_public_address_range_value_error.
_service.disable_retries()
- self.test_add_virtual_network_interface_ip_value_error()
+ self.test_update_public_address_range_value_error()
# endregion
##############################################################################
-# End of Service: VirtualNetworkInterfaces
+# End of Service: PublicAddressRanges
##############################################################################
##############################################################################
-# Start of Service: ClusterNetworks
+# Start of Service: PublicGateways
##############################################################################
# region
@@ -33791,285 +33407,19 @@ def test_new_instance_required_param_none(self):
)
-class TestListClusterNetworkProfiles:
- """
- Test Class for list_cluster_network_profiles
- """
-
- @responses.activate
- def test_list_cluster_network_profiles_all_params(self):
- """
- list_cluster_network_profiles()
- """
- # Set up mock
- url = preprocess_url('/cluster_network/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- start = 'testString'
- limit = 50
-
- # Invoke method
- response = _service.list_cluster_network_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_cluster_network_profiles_all_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_profiles_all_params.
- _service.enable_retries()
- self.test_list_cluster_network_profiles_all_params()
-
- # Disable retries and run test_list_cluster_network_profiles_all_params.
- _service.disable_retries()
- self.test_list_cluster_network_profiles_all_params()
-
- @responses.activate
- def test_list_cluster_network_profiles_required_params(self):
- """
- test_list_cluster_network_profiles_required_params()
- """
- # Set up mock
- url = preprocess_url('/cluster_network/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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,
- content_type='application/json',
- status=200,
- )
-
- # Invoke method
- response = _service.list_cluster_network_profiles()
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_cluster_network_profiles_required_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_profiles_required_params.
- _service.enable_retries()
- self.test_list_cluster_network_profiles_required_params()
-
- # Disable retries and run test_list_cluster_network_profiles_required_params.
- _service.disable_retries()
- self.test_list_cluster_network_profiles_required_params()
-
- @responses.activate
- def test_list_cluster_network_profiles_value_error(self):
- """
- test_list_cluster_network_profiles_value_error()
- """
- # Set up mock
- url = preprocess_url('/cluster_network/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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,
- 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_cluster_network_profiles(**req_copy)
-
- def test_list_cluster_network_profiles_value_error_with_retries(self):
- # Enable retries and run test_list_cluster_network_profiles_value_error.
- _service.enable_retries()
- self.test_list_cluster_network_profiles_value_error()
-
- # Disable retries and run test_list_cluster_network_profiles_value_error.
- _service.disable_retries()
- self.test_list_cluster_network_profiles_value_error()
-
- @responses.activate
- def test_list_cluster_network_profiles_with_pager_get_next(self):
- """
- test_list_cluster_network_profiles_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/cluster_network/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"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_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = ClusterNetworkProfilesPager(
- client=_service,
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_cluster_network_profiles_with_pager_get_all(self):
- """
- test_list_cluster_network_profiles_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/cluster_network/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"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_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = ClusterNetworkProfilesPager(
- client=_service,
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
-
-
-class TestGetClusterNetworkProfile:
- """
- Test Class for get_cluster_network_profile
- """
-
- @responses.activate
- def test_get_cluster_network_profile_all_params(self):
- """
- get_cluster_network_profile()
- """
- # Set up mock
- url = preprocess_url('/cluster_network/profiles/h100')
- mock_response = '{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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
- name = 'h100'
-
- # Invoke method
- response = _service.get_cluster_network_profile(
- name,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_cluster_network_profile_all_params_with_retries(self):
- # Enable retries and run test_get_cluster_network_profile_all_params.
- _service.enable_retries()
- self.test_get_cluster_network_profile_all_params()
-
- # Disable retries and run test_get_cluster_network_profile_all_params.
- _service.disable_retries()
- self.test_get_cluster_network_profile_all_params()
-
- @responses.activate
- def test_get_cluster_network_profile_value_error(self):
- """
- test_get_cluster_network_profile_value_error()
- """
- # Set up mock
- url = preprocess_url('/cluster_network/profiles/h100')
- mock_response = '{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"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
- name = 'h100'
-
- # 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_cluster_network_profile(**req_copy)
-
- def test_get_cluster_network_profile_value_error_with_retries(self):
- # Enable retries and run test_get_cluster_network_profile_value_error.
- _service.enable_retries()
- self.test_get_cluster_network_profile_value_error()
-
- # Disable retries and run test_get_cluster_network_profile_value_error.
- _service.disable_retries()
- self.test_get_cluster_network_profile_value_error()
-
-
-class TestListClusterNetworks:
+class TestListPublicGateways:
"""
- Test Class for list_cluster_networks
+ Test Class for list_public_gateways
"""
@responses.activate
- def test_list_cluster_networks_all_params(self):
+ def test_list_public_gateways_all_params(self):
"""
- list_cluster_networks()
+ list_public_gateways()
"""
# Set up mock
- url = preprocess_url('/cluster_networks')
- mock_response = '{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -34082,22 +33432,12 @@ def test_list_cluster_networks_all_params(self):
start = 'testString'
limit = 50
resource_group_id = 'testString'
- name = 'my-name'
- sort = 'name'
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
# Invoke method
- response = _service.list_cluster_networks(
+ response = _service.list_public_gateways(
start=start,
limit=limit,
resource_group_id=resource_group_id,
- name=name,
- sort=sort,
- vpc_id=vpc_id,
- vpc_crn=vpc_crn,
- vpc_name=vpc_name,
headers={},
)
@@ -34110,29 +33450,24 @@ def test_list_cluster_networks_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 'name={}'.format(name) 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_cluster_networks_all_params_with_retries(self):
- # Enable retries and run test_list_cluster_networks_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_cluster_networks_all_params()
+ self.test_list_public_gateways_all_params()
- # Disable retries and run test_list_cluster_networks_all_params.
+ # Disable retries and run test_list_public_gateways_all_params.
_service.disable_retries()
- self.test_list_cluster_networks_all_params()
+ self.test_list_public_gateways_all_params()
@responses.activate
- def test_list_cluster_networks_required_params(self):
+ def test_list_public_gateways_required_params(self):
"""
- test_list_cluster_networks_required_params()
+ test_list_public_gateways_required_params()
"""
# Set up mock
- url = preprocess_url('/cluster_networks')
- mock_response = '{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -34142,29 +33477,29 @@ def test_list_cluster_networks_required_params(self):
)
# Invoke method
- response = _service.list_cluster_networks()
+ response = _service.list_public_gateways()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_cluster_networks_required_params_with_retries(self):
- # Enable retries and run test_list_cluster_networks_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_cluster_networks_required_params()
+ self.test_list_public_gateways_required_params()
- # Disable retries and run test_list_cluster_networks_required_params.
+ # Disable retries and run test_list_public_gateways_required_params.
_service.disable_retries()
- self.test_list_cluster_networks_required_params()
+ self.test_list_public_gateways_required_params()
@responses.activate
- def test_list_cluster_networks_value_error(self):
+ def test_list_public_gateways_value_error(self):
"""
- test_list_cluster_networks_value_error()
+ test_list_public_gateways_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks')
- mock_response = '{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -34179,26 +33514,26 @@ def test_list_cluster_networks_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_cluster_networks(**req_copy)
+ _service.list_public_gateways(**req_copy)
- def test_list_cluster_networks_value_error_with_retries(self):
- # Enable retries and run test_list_cluster_networks_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_cluster_networks_value_error()
+ self.test_list_public_gateways_value_error()
- # Disable retries and run test_list_cluster_networks_value_error.
+ # Disable retries and run test_list_public_gateways_value_error.
_service.disable_retries()
- self.test_list_cluster_networks_value_error()
+ self.test_list_public_gateways_value_error()
@responses.activate
- def test_list_cluster_networks_with_pager_get_next(self):
+ def test_list_public_gateways_with_pager_get_next(self):
"""
- test_list_cluster_networks_with_pager_get_next()
+ test_list_public_gateways_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/cluster_networks')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- mock_response2 = '{"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ url = preprocess_url('/public_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -34216,15 +33551,10 @@ def test_list_cluster_networks_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = ClusterNetworksPager(
+ pager = PublicGatewaysPager(
client=_service,
limit=10,
resource_group_id='testString',
- name='my-name',
- sort='name',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
)
while pager.has_next():
next_page = pager.get_next()
@@ -34233,14 +33563,14 @@ def test_list_cluster_networks_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_cluster_networks_with_pager_get_all(self):
+ def test_list_public_gateways_with_pager_get_all(self):
"""
- test_list_cluster_networks_with_pager_get_all()
+ test_list_public_gateways_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/cluster_networks')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- mock_response2 = '{"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ url = preprocess_url('/public_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -34257,34 +33587,29 @@ def test_list_cluster_networks_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = ClusterNetworksPager(
+ pager = PublicGatewaysPager(
client=_service,
limit=10,
resource_group_id='testString',
- name='my-name',
- sort='name',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateClusterNetwork:
+class TestCreatePublicGateway:
"""
- Test Class for create_cluster_network
+ Test Class for create_public_gateway
"""
@responses.activate
- def test_create_cluster_network_all_params(self):
+ def test_create_public_gateway_all_params(self):
"""
- create_cluster_network()
+ create_public_gateway()
"""
# Set up mock
- url = preprocess_url('/cluster_networks')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/public_gateways')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -34293,10 +33618,6 @@ def test_create_cluster_network_all_params(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkProfileIdentityByName model
- cluster_network_profile_identity_model = {}
- cluster_network_profile_identity_model['name'] = 'h100'
-
# Construct a dict representation of a VPCIdentityById model
vpc_identity_model = {}
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
@@ -34305,30 +33626,28 @@ def test_create_cluster_network_all_params(self):
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'] = 'r006-f45e0d90-12a8-4460-8210-290ff2ab75cd'
+
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a ClusterNetworkSubnetPrefixPrototype model
- cluster_network_subnet_prefix_prototype_model = {}
- cluster_network_subnet_prefix_prototype_model['cidr'] = '10.0.0.0/24'
-
# Set up parameter values
- profile = cluster_network_profile_identity_model
vpc = vpc_identity_model
zone = zone_identity_model
- name = 'my-cluster-network'
+ floating_ip = public_gateway_floating_ip_prototype_model
+ name = 'my-public-gateway'
resource_group = resource_group_identity_model
- subnet_prefixes = [cluster_network_subnet_prefix_prototype_model]
# Invoke method
- response = _service.create_cluster_network(
- profile,
+ response = _service.create_public_gateway(
vpc,
zone,
+ floating_ip=floating_ip,
name=name,
resource_group=resource_group,
- subnet_prefixes=subnet_prefixes,
headers={},
)
@@ -34337,30 +33656,29 @@ def test_create_cluster_network_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['profile'] == cluster_network_profile_identity_model
assert req_body['vpc'] == vpc_identity_model
assert req_body['zone'] == zone_identity_model
- assert req_body['name'] == 'my-cluster-network'
+ 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['subnet_prefixes'] == [cluster_network_subnet_prefix_prototype_model]
- def test_create_cluster_network_all_params_with_retries(self):
- # Enable retries and run test_create_cluster_network_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_cluster_network_all_params()
+ self.test_create_public_gateway_all_params()
- # Disable retries and run test_create_cluster_network_all_params.
+ # Disable retries and run test_create_public_gateway_all_params.
_service.disable_retries()
- self.test_create_cluster_network_all_params()
+ self.test_create_public_gateway_all_params()
@responses.activate
- def test_create_cluster_network_value_error(self):
+ def test_create_public_gateway_value_error(self):
"""
- test_create_cluster_network_value_error()
+ test_create_public_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/public_gateways')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -34369,10 +33687,6 @@ def test_create_cluster_network_value_error(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkProfileIdentityByName model
- cluster_network_profile_identity_model = {}
- cluster_network_profile_identity_model['name'] = 'h100'
-
# Construct a dict representation of a VPCIdentityById model
vpc_identity_model = {}
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
@@ -34381,56 +33695,363 @@ def test_create_cluster_network_value_error(self):
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'] = 'r006-f45e0d90-12a8-4460-8210-290ff2ab75cd'
+
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a ClusterNetworkSubnetPrefixPrototype model
- cluster_network_subnet_prefix_prototype_model = {}
- cluster_network_subnet_prefix_prototype_model['cidr'] = '10.0.0.0/24'
-
# Set up parameter values
- profile = cluster_network_profile_identity_model
vpc = vpc_identity_model
zone = zone_identity_model
- name = 'my-cluster-network'
+ floating_ip = public_gateway_floating_ip_prototype_model
+ name = 'my-public-gateway'
resource_group = resource_group_identity_model
- subnet_prefixes = [cluster_network_subnet_prefix_prototype_model]
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "profile": profile,
"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_cluster_network(**req_copy)
+ _service.create_public_gateway(**req_copy)
- def test_create_cluster_network_value_error_with_retries(self):
- # Enable retries and run test_create_cluster_network_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_cluster_network_value_error()
+ self.test_create_public_gateway_value_error()
- # Disable retries and run test_create_cluster_network_value_error.
+ # Disable retries and run test_create_public_gateway_value_error.
_service.disable_retries()
- self.test_create_cluster_network_value_error()
+ self.test_create_public_gateway_value_error()
-class TestListClusterNetworkInterfaces:
+class TestDeletePublicGateway:
"""
- Test Class for list_cluster_network_interfaces
+ Test Class for delete_public_gateway
"""
@responses.activate
- def test_list_cluster_network_interfaces_all_params(self):
+ def test_delete_public_gateway_all_params(self):
"""
- list_cluster_network_interfaces()
+ delete_public_gateway()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response = '{"first": {"href": "href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/public_gateways/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_public_gateway(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ 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.
+ _service.enable_retries()
+ self.test_delete_public_gateway_all_params()
+
+ # Disable retries and run test_delete_public_gateway_all_params.
+ _service.disable_retries()
+ self.test_delete_public_gateway_all_params()
+
+ @responses.activate
+ def test_delete_public_gateway_value_error(self):
+ """
+ test_delete_public_gateway_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/public_gateways/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_public_gateway(**req_copy)
+
+ 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_public_gateway_value_error()
+
+ # Disable retries and run test_delete_public_gateway_value_error.
+ _service.disable_retries()
+ self.test_delete_public_gateway_value_error()
+
+
+class TestGetPublicGateway:
+ """
+ Test Class for get_public_gateway
+ """
+
+ @responses.activate
+ def test_get_public_gateway_all_params(self):
+ """
+ get_public_gateway()
+ """
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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_public_gateway(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ 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.
+ _service.enable_retries()
+ self.test_get_public_gateway_all_params()
+
+ # Disable retries and run test_get_public_gateway_all_params.
+ _service.disable_retries()
+ self.test_get_public_gateway_all_params()
+
+ @responses.activate
+ def test_get_public_gateway_value_error(self):
+ """
+ test_get_public_gateway_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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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_public_gateway(**req_copy)
+
+ 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_public_gateway_value_error()
+
+ # Disable retries and run test_get_public_gateway_value_error.
+ _service.disable_retries()
+ self.test_get_public_gateway_value_error()
+
+
+class TestUpdatePublicGateway:
+ """
+ Test Class for update_public_gateway
+ """
+
+ @responses.activate
+ def test_update_public_gateway_all_params(self):
+ """
+ update_public_gateway()
+ """
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 PublicGatewayPatch model
+ public_gateway_patch_model = {}
+ public_gateway_patch_model['name'] = 'my-public-gateway-updated'
+
+ # Set up parameter values
+ id = 'testString'
+ public_gateway_patch = public_gateway_patch_model
+
+ # Invoke method
+ response = _service.update_public_gateway(
+ id,
+ public_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 == public_gateway_patch
+
+ 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_public_gateway_all_params()
+
+ # Disable retries and run test_update_public_gateway_all_params.
+ _service.disable_retries()
+ self.test_update_public_gateway_all_params()
+
+ @responses.activate
+ def test_update_public_gateway_value_error(self):
+ """
+ test_update_public_gateway_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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 PublicGatewayPatch model
+ public_gateway_patch_model = {}
+ public_gateway_patch_model['name'] = 'my-public-gateway-updated'
+
+ # Set up parameter values
+ id = 'testString'
+ public_gateway_patch = public_gateway_patch_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "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_public_gateway(**req_copy)
+
+ 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_public_gateway_value_error()
+
+ # Disable retries and run test_update_public_gateway_value_error.
+ _service.disable_retries()
+ self.test_update_public_gateway_value_error()
+
+
+# endregion
+##############################################################################
+# End of Service: PublicGateways
+##############################################################################
+
+##############################################################################
+# Start of Service: Reservations
+##############################################################################
+# 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 TestListReservations:
+ """
+ Test Class for list_reservations
+ """
+
+ @responses.activate
+ def test_list_reservations_all_params(self):
+ """
+ list_reservations()
+ """
+ # Set up mock
+ url = preprocess_url('/reservations')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reservations": [{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34440,19 +34061,23 @@ def test_list_cluster_network_interfaces_all_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
start = 'testString'
limit = 50
name = 'my-name'
- sort = 'name'
+ profile_resource_type = 'testString'
+ affinity_policy = 'automatic'
+ resource_group_id = 'testString'
+ zone_name = 'us-south-1'
# Invoke method
- response = _service.list_cluster_network_interfaces(
- cluster_network_id,
+ response = _service.list_reservations(
start=start,
limit=limit,
name=name,
- sort=sort,
+ profile_resource_type=profile_resource_type,
+ affinity_policy=affinity_policy,
+ resource_group_id=resource_group_id,
+ zone_name=zone_name,
headers={},
)
@@ -34465,25 +34090,28 @@ def test_list_cluster_network_interfaces_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
assert 'name={}'.format(name) in query_string
- assert 'sort={}'.format(sort) in query_string
+ assert 'profile.resource_type={}'.format(profile_resource_type) in query_string
+ assert 'affinity_policy={}'.format(affinity_policy) in query_string
+ assert 'resource_group.id={}'.format(resource_group_id) in query_string
+ assert 'zone.name={}'.format(zone_name) in query_string
- def test_list_cluster_network_interfaces_all_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_interfaces_all_params.
+ def test_list_reservations_all_params_with_retries(self):
+ # Enable retries and run test_list_reservations_all_params.
_service.enable_retries()
- self.test_list_cluster_network_interfaces_all_params()
+ self.test_list_reservations_all_params()
- # Disable retries and run test_list_cluster_network_interfaces_all_params.
+ # Disable retries and run test_list_reservations_all_params.
_service.disable_retries()
- self.test_list_cluster_network_interfaces_all_params()
+ self.test_list_reservations_all_params()
@responses.activate
- def test_list_cluster_network_interfaces_required_params(self):
+ def test_list_reservations_required_params(self):
"""
- test_list_cluster_network_interfaces_required_params()
+ test_list_reservations_required_params()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response = '{"first": {"href": "href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/reservations')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reservations": [{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34492,36 +34120,30 @@ def test_list_cluster_network_interfaces_required_params(self):
status=200,
)
- # Set up parameter values
- cluster_network_id = 'testString'
-
# Invoke method
- response = _service.list_cluster_network_interfaces(
- cluster_network_id,
- headers={},
- )
+ response = _service.list_reservations()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_cluster_network_interfaces_required_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_interfaces_required_params.
+ def test_list_reservations_required_params_with_retries(self):
+ # Enable retries and run test_list_reservations_required_params.
_service.enable_retries()
- self.test_list_cluster_network_interfaces_required_params()
+ self.test_list_reservations_required_params()
- # Disable retries and run test_list_cluster_network_interfaces_required_params.
+ # Disable retries and run test_list_reservations_required_params.
_service.disable_retries()
- self.test_list_cluster_network_interfaces_required_params()
+ self.test_list_reservations_required_params()
@responses.activate
- def test_list_cluster_network_interfaces_value_error(self):
+ def test_list_reservations_value_error(self):
"""
- test_list_cluster_network_interfaces_value_error()
+ test_list_reservations_value_error()
"""
- # Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response = '{"first": {"href": "href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ # Set up mock
+ url = preprocess_url('/reservations')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reservations": [{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34530,36 +34152,32 @@ def test_list_cluster_network_interfaces_value_error(self):
status=200,
)
- # Set up parameter values
- cluster_network_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_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_cluster_network_interfaces(**req_copy)
+ _service.list_reservations(**req_copy)
- def test_list_cluster_network_interfaces_value_error_with_retries(self):
- # Enable retries and run test_list_cluster_network_interfaces_value_error.
+ def test_list_reservations_value_error_with_retries(self):
+ # Enable retries and run test_list_reservations_value_error.
_service.enable_retries()
- self.test_list_cluster_network_interfaces_value_error()
+ self.test_list_reservations_value_error()
- # Disable retries and run test_list_cluster_network_interfaces_value_error.
+ # Disable retries and run test_list_reservations_value_error.
_service.disable_retries()
- self.test_list_cluster_network_interfaces_value_error()
+ self.test_list_reservations_value_error()
@responses.activate
- def test_list_cluster_network_interfaces_with_pager_get_next(self):
+ def test_list_reservations_with_pager_get_next(self):
"""
- test_list_cluster_network_interfaces_with_pager_get_next()
+ test_list_reservations_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- mock_response2 = '{"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ url = preprocess_url('/reservations')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -34577,12 +34195,14 @@ def test_list_cluster_network_interfaces_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = ClusterNetworkInterfacesPager(
+ pager = ReservationsPager(
client=_service,
- cluster_network_id='testString',
limit=10,
name='my-name',
- sort='name',
+ profile_resource_type='testString',
+ affinity_policy='automatic',
+ resource_group_id='testString',
+ zone_name='us-south-1',
)
while pager.has_next():
next_page = pager.get_next()
@@ -34591,14 +34211,14 @@ def test_list_cluster_network_interfaces_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_cluster_network_interfaces_with_pager_get_all(self):
+ def test_list_reservations_with_pager_get_all(self):
"""
- test_list_cluster_network_interfaces_with_pager_get_all()
+ test_list_reservations_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
- mock_response2 = '{"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
+ url = preprocess_url('/reservations')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"reservations":[{"affinity_policy":"automatic","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -34615,31 +34235,33 @@ def test_list_cluster_network_interfaces_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = ClusterNetworkInterfacesPager(
+ pager = ReservationsPager(
client=_service,
- cluster_network_id='testString',
limit=10,
name='my-name',
- sort='name',
+ profile_resource_type='testString',
+ affinity_policy='automatic',
+ resource_group_id='testString',
+ zone_name='us-south-1',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateClusterNetworkInterface:
+class TestCreateReservation:
"""
- Test Class for create_cluster_network_interface
+ Test Class for create_reservation
"""
@responses.activate
- def test_create_cluster_network_interface_all_params(self):
+ def test_create_reservation_all_params(self):
"""
- create_cluster_network_interface()
+ create_reservation()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34648,28 +34270,46 @@ def test_create_cluster_network_interface_all_params(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+ # Construct a dict representation of a ReservationCapacityPrototype model
+ reservation_capacity_prototype_model = {}
+ reservation_capacity_prototype_model['total'] = 10
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+ # Construct a dict representation of a ReservationCommittedUsePrototype model
+ reservation_committed_use_prototype_model = {}
+ reservation_committed_use_prototype_model['expiration_policy'] = 'release'
+ reservation_committed_use_prototype_model['term'] = 'testString'
+
+ # Construct a dict representation of a ReservationProfilePrototype model
+ reservation_profile_prototype_model = {}
+ reservation_profile_prototype_model['name'] = 'bx2-4x16'
+ reservation_profile_prototype_model['resource_type'] = 'bare_metal_server_profile'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- cluster_network_id = 'testString'
- name = 'my-cluster-network-interface'
- primary_ip = cluster_network_interface_primary_ip_prototype_model
- subnet = cluster_network_subnet_identity_model
+ capacity = reservation_capacity_prototype_model
+ committed_use = reservation_committed_use_prototype_model
+ profile = reservation_profile_prototype_model
+ zone = zone_identity_model
+ affinity_policy = 'automatic'
+ name = 'my-reservation'
+ resource_group = resource_group_identity_model
# Invoke method
- response = _service.create_cluster_network_interface(
- cluster_network_id,
+ response = _service.create_reservation(
+ capacity,
+ committed_use,
+ profile,
+ zone,
+ affinity_policy=affinity_policy,
name=name,
- primary_ip=primary_ip,
- subnet=subnet,
+ resource_group=resource_group,
headers={},
)
@@ -34678,27 +34318,31 @@ def test_create_cluster_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['name'] == 'my-cluster-network-interface'
- assert req_body['primary_ip'] == cluster_network_interface_primary_ip_prototype_model
- assert req_body['subnet'] == cluster_network_subnet_identity_model
+ assert req_body['capacity'] == reservation_capacity_prototype_model
+ assert req_body['committed_use'] == reservation_committed_use_prototype_model
+ assert req_body['profile'] == reservation_profile_prototype_model
+ assert req_body['zone'] == zone_identity_model
+ assert req_body['affinity_policy'] == 'automatic'
+ assert req_body['name'] == 'my-reservation'
+ assert req_body['resource_group'] == resource_group_identity_model
- def test_create_cluster_network_interface_all_params_with_retries(self):
- # Enable retries and run test_create_cluster_network_interface_all_params.
+ def test_create_reservation_all_params_with_retries(self):
+ # Enable retries and run test_create_reservation_all_params.
_service.enable_retries()
- self.test_create_cluster_network_interface_all_params()
+ self.test_create_reservation_all_params()
- # Disable retries and run test_create_cluster_network_interface_all_params.
+ # Disable retries and run test_create_reservation_all_params.
_service.disable_retries()
- self.test_create_cluster_network_interface_all_params()
+ self.test_create_reservation_all_params()
@responses.activate
- def test_create_cluster_network_interface_value_error(self):
+ def test_create_reservation_value_error(self):
"""
- test_create_cluster_network_interface_value_error()
+ test_create_reservation_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34707,96 +34351,72 @@ def test_create_cluster_network_interface_value_error(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model
- cluster_network_interface_primary_ip_prototype_model = {}
- cluster_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- cluster_network_interface_primary_ip_prototype_model['auto_delete'] = False
- cluster_network_interface_primary_ip_prototype_model['name'] = 'my-cluster-network-subnet-reserved-ip'
+ # Construct a dict representation of a ReservationCapacityPrototype model
+ reservation_capacity_prototype_model = {}
+ reservation_capacity_prototype_model['total'] = 10
- # Construct a dict representation of a ClusterNetworkSubnetIdentityById model
- cluster_network_subnet_identity_model = {}
- cluster_network_subnet_identity_model['id'] = '0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930'
+ # Construct a dict representation of a ReservationCommittedUsePrototype model
+ reservation_committed_use_prototype_model = {}
+ reservation_committed_use_prototype_model['expiration_policy'] = 'release'
+ reservation_committed_use_prototype_model['term'] = 'testString'
+
+ # Construct a dict representation of a ReservationProfilePrototype model
+ reservation_profile_prototype_model = {}
+ reservation_profile_prototype_model['name'] = 'bx2-4x16'
+ reservation_profile_prototype_model['resource_type'] = 'bare_metal_server_profile'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- cluster_network_id = 'testString'
- name = 'my-cluster-network-interface'
- primary_ip = cluster_network_interface_primary_ip_prototype_model
- subnet = cluster_network_subnet_identity_model
+ capacity = reservation_capacity_prototype_model
+ committed_use = reservation_committed_use_prototype_model
+ profile = reservation_profile_prototype_model
+ zone = zone_identity_model
+ affinity_policy = 'automatic'
+ name = 'my-reservation'
+ resource_group = resource_group_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_id,
+ "capacity": capacity,
+ "committed_use": committed_use,
+ "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_cluster_network_interface(**req_copy)
+ _service.create_reservation(**req_copy)
- def test_create_cluster_network_interface_value_error_with_retries(self):
- # Enable retries and run test_create_cluster_network_interface_value_error.
+ def test_create_reservation_value_error_with_retries(self):
+ # Enable retries and run test_create_reservation_value_error.
_service.enable_retries()
- self.test_create_cluster_network_interface_value_error()
+ self.test_create_reservation_value_error()
- # Disable retries and run test_create_cluster_network_interface_value_error.
+ # Disable retries and run test_create_reservation_value_error.
_service.disable_retries()
- self.test_create_cluster_network_interface_value_error()
+ self.test_create_reservation_value_error()
-class TestDeleteClusterNetworkInterface:
+class TestDeleteReservation:
"""
- Test Class for delete_cluster_network_interface
+ Test Class for delete_reservation
"""
@responses.activate
- def test_delete_cluster_network_interface_all_params(self):
- """
- delete_cluster_network_interface()
- """
- # Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
- url,
- body=mock_response,
- content_type='application/json',
- status=202,
- )
-
- # Set up parameter values
- cluster_network_id = 'testString'
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
-
- # Invoke method
- response = _service.delete_cluster_network_interface(
- cluster_network_id,
- id,
- if_match=if_match,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- def test_delete_cluster_network_interface_all_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_interface_all_params.
- _service.enable_retries()
- self.test_delete_cluster_network_interface_all_params()
-
- # Disable retries and run test_delete_cluster_network_interface_all_params.
- _service.disable_retries()
- self.test_delete_cluster_network_interface_all_params()
-
- @responses.activate
- def test_delete_cluster_network_interface_required_params(self):
+ def test_delete_reservation_all_params(self):
"""
- test_delete_cluster_network_interface_required_params()
+ delete_reservation()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
responses.DELETE,
url,
@@ -34806,12 +34426,10 @@ def test_delete_cluster_network_interface_required_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_cluster_network_interface(
- cluster_network_id,
+ response = _service.delete_reservation(
id,
headers={},
)
@@ -34820,23 +34438,23 @@ def test_delete_cluster_network_interface_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 202
- def test_delete_cluster_network_interface_required_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_interface_required_params.
+ def test_delete_reservation_all_params_with_retries(self):
+ # Enable retries and run test_delete_reservation_all_params.
_service.enable_retries()
- self.test_delete_cluster_network_interface_required_params()
+ self.test_delete_reservation_all_params()
- # Disable retries and run test_delete_cluster_network_interface_required_params.
+ # Disable retries and run test_delete_reservation_all_params.
_service.disable_retries()
- self.test_delete_cluster_network_interface_required_params()
+ self.test_delete_reservation_all_params()
@responses.activate
- def test_delete_cluster_network_interface_value_error(self):
+ def test_delete_reservation_value_error(self):
"""
- test_delete_cluster_network_interface_value_error()
+ test_delete_reservation_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
responses.DELETE,
url,
@@ -34846,42 +34464,40 @@ def test_delete_cluster_network_interface_value_error(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_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_cluster_network_interface(**req_copy)
+ _service.delete_reservation(**req_copy)
- def test_delete_cluster_network_interface_value_error_with_retries(self):
- # Enable retries and run test_delete_cluster_network_interface_value_error.
+ def test_delete_reservation_value_error_with_retries(self):
+ # Enable retries and run test_delete_reservation_value_error.
_service.enable_retries()
- self.test_delete_cluster_network_interface_value_error()
+ self.test_delete_reservation_value_error()
- # Disable retries and run test_delete_cluster_network_interface_value_error.
+ # Disable retries and run test_delete_reservation_value_error.
_service.disable_retries()
- self.test_delete_cluster_network_interface_value_error()
+ self.test_delete_reservation_value_error()
-class TestGetClusterNetworkInterface:
+class TestGetReservation:
"""
- Test Class for get_cluster_network_interface
+ Test Class for get_reservation
"""
@responses.activate
- def test_get_cluster_network_interface_all_params(self):
+ def test_get_reservation_all_params(self):
"""
- get_cluster_network_interface()
+ get_reservation()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34891,12 +34507,10 @@ def test_get_cluster_network_interface_all_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_cluster_network_interface(
- cluster_network_id,
+ response = _service.get_reservation(
id,
headers={},
)
@@ -34905,23 +34519,23 @@ def test_get_cluster_network_interface_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_cluster_network_interface_all_params_with_retries(self):
- # Enable retries and run test_get_cluster_network_interface_all_params.
+ def test_get_reservation_all_params_with_retries(self):
+ # Enable retries and run test_get_reservation_all_params.
_service.enable_retries()
- self.test_get_cluster_network_interface_all_params()
+ self.test_get_reservation_all_params()
- # Disable retries and run test_get_cluster_network_interface_all_params.
+ # Disable retries and run test_get_reservation_all_params.
_service.disable_retries()
- self.test_get_cluster_network_interface_all_params()
+ self.test_get_reservation_all_params()
@responses.activate
- def test_get_cluster_network_interface_value_error(self):
+ def test_get_reservation_value_error(self):
"""
- test_get_cluster_network_interface_value_error()
+ test_get_reservation_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34931,42 +34545,40 @@ def test_get_cluster_network_interface_value_error(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_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_cluster_network_interface(**req_copy)
+ _service.get_reservation(**req_copy)
- def test_get_cluster_network_interface_value_error_with_retries(self):
- # Enable retries and run test_get_cluster_network_interface_value_error.
+ def test_get_reservation_value_error_with_retries(self):
+ # Enable retries and run test_get_reservation_value_error.
_service.enable_retries()
- self.test_get_cluster_network_interface_value_error()
+ self.test_get_reservation_value_error()
- # Disable retries and run test_get_cluster_network_interface_value_error.
+ # Disable retries and run test_get_reservation_value_error.
_service.disable_retries()
- self.test_get_cluster_network_interface_value_error()
+ self.test_get_reservation_value_error()
-class TestUpdateClusterNetworkInterface:
+class TestUpdateReservation:
"""
- Test Class for update_cluster_network_interface
+ Test Class for update_reservation
"""
@responses.activate
- def test_update_cluster_network_interface_all_params(self):
+ def test_update_reservation_all_params(self):
"""
- update_cluster_network_interface()
+ update_reservation()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -34975,23 +34587,36 @@ def test_update_cluster_network_interface_all_params(self):
status=200,
)
- # Construct a dict representation of a ClusterNetworkInterfacePatch model
- cluster_network_interface_patch_model = {}
- cluster_network_interface_patch_model['auto_delete'] = False
- cluster_network_interface_patch_model['name'] = 'my-cluster-network-interface'
+ # Construct a dict representation of a ReservationCapacityPatch model
+ reservation_capacity_patch_model = {}
+ reservation_capacity_patch_model['total'] = 10
+
+ # Construct a dict representation of a ReservationCommittedUsePatch model
+ reservation_committed_use_patch_model = {}
+ reservation_committed_use_patch_model['expiration_policy'] = 'release'
+ reservation_committed_use_patch_model['term'] = 'testString'
+
+ # Construct a dict representation of a ReservationProfilePatch model
+ reservation_profile_patch_model = {}
+ reservation_profile_patch_model['name'] = 'bx2-4x16'
+ reservation_profile_patch_model['resource_type'] = 'bare_metal_server_profile'
+
+ # Construct a dict representation of a ReservationPatch model
+ reservation_patch_model = {}
+ reservation_patch_model['affinity_policy'] = 'automatic'
+ reservation_patch_model['capacity'] = reservation_capacity_patch_model
+ reservation_patch_model['committed_use'] = reservation_committed_use_patch_model
+ reservation_patch_model['name'] = 'my-reservation'
+ reservation_patch_model['profile'] = reservation_profile_patch_model
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
- cluster_network_interface_patch = cluster_network_interface_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ reservation_patch = reservation_patch_model
# Invoke method
- response = _service.update_cluster_network_interface(
- cluster_network_id,
+ response = _service.update_reservation(
id,
- cluster_network_interface_patch,
- if_match=if_match,
+ reservation_patch,
headers={},
)
@@ -35000,25 +34625,25 @@ def test_update_cluster_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 == cluster_network_interface_patch
+ assert req_body == reservation_patch
- def test_update_cluster_network_interface_all_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_interface_all_params.
+ def test_update_reservation_all_params_with_retries(self):
+ # Enable retries and run test_update_reservation_all_params.
_service.enable_retries()
- self.test_update_cluster_network_interface_all_params()
+ self.test_update_reservation_all_params()
- # Disable retries and run test_update_cluster_network_interface_all_params.
+ # Disable retries and run test_update_reservation_all_params.
_service.disable_retries()
- self.test_update_cluster_network_interface_all_params()
+ self.test_update_reservation_all_params()
@responses.activate
- def test_update_cluster_network_interface_required_params(self):
+ def test_update_reservation_value_error(self):
"""
- test_update_cluster_network_interface_required_params()
+ test_update_reservation_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString')
+ mock_response = '{"affinity_policy": "automatic", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "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,
@@ -35027,100 +34652,197 @@ def test_update_cluster_network_interface_required_params(self):
status=200,
)
- # Construct a dict representation of a ClusterNetworkInterfacePatch model
- cluster_network_interface_patch_model = {}
- cluster_network_interface_patch_model['auto_delete'] = False
- cluster_network_interface_patch_model['name'] = 'my-cluster-network-interface'
+ # Construct a dict representation of a ReservationCapacityPatch model
+ reservation_capacity_patch_model = {}
+ reservation_capacity_patch_model['total'] = 10
+
+ # Construct a dict representation of a ReservationCommittedUsePatch model
+ reservation_committed_use_patch_model = {}
+ reservation_committed_use_patch_model['expiration_policy'] = 'release'
+ reservation_committed_use_patch_model['term'] = 'testString'
+
+ # Construct a dict representation of a ReservationProfilePatch model
+ reservation_profile_patch_model = {}
+ reservation_profile_patch_model['name'] = 'bx2-4x16'
+ reservation_profile_patch_model['resource_type'] = 'bare_metal_server_profile'
+
+ # Construct a dict representation of a ReservationPatch model
+ reservation_patch_model = {}
+ reservation_patch_model['affinity_policy'] = 'automatic'
+ reservation_patch_model['capacity'] = reservation_capacity_patch_model
+ reservation_patch_model['committed_use'] = reservation_committed_use_patch_model
+ reservation_patch_model['name'] = 'my-reservation'
+ reservation_patch_model['profile'] = reservation_profile_patch_model
+
+ # Set up parameter values
+ id = 'testString'
+ reservation_patch = reservation_patch_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "reservation_patch": reservation_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_reservation(**req_copy)
+
+ def test_update_reservation_value_error_with_retries(self):
+ # Enable retries and run test_update_reservation_value_error.
+ _service.enable_retries()
+ self.test_update_reservation_value_error()
+
+ # Disable retries and run test_update_reservation_value_error.
+ _service.disable_retries()
+ self.test_update_reservation_value_error()
+
+
+class TestActivateReservation:
+ """
+ Test Class for activate_reservation
+ """
+
+ @responses.activate
+ def test_activate_reservation_all_params(self):
+ """
+ activate_reservation()
+ """
+ # Set up mock
+ url = preprocess_url('/reservations/testString/activate')
+ responses.add(
+ responses.POST,
+ url,
+ status=202,
+ )
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
- cluster_network_interface_patch = cluster_network_interface_patch_model
# Invoke method
- response = _service.update_cluster_network_interface(
- cluster_network_id,
+ response = _service.activate_reservation(
id,
- cluster_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 == cluster_network_interface_patch
+ assert response.status_code == 202
- def test_update_cluster_network_interface_required_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_interface_required_params.
+ def test_activate_reservation_all_params_with_retries(self):
+ # Enable retries and run test_activate_reservation_all_params.
_service.enable_retries()
- self.test_update_cluster_network_interface_required_params()
+ self.test_activate_reservation_all_params()
- # Disable retries and run test_update_cluster_network_interface_required_params.
+ # Disable retries and run test_activate_reservation_all_params.
_service.disable_retries()
- self.test_update_cluster_network_interface_required_params()
+ self.test_activate_reservation_all_params()
@responses.activate
- def test_update_cluster_network_interface_value_error(self):
+ def test_activate_reservation_value_error(self):
"""
- test_update_cluster_network_interface_value_error()
+ test_activate_reservation_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/interfaces/testString')
- mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/reservations/testString/activate')
responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Construct a dict representation of a ClusterNetworkInterfacePatch model
- cluster_network_interface_patch_model = {}
- cluster_network_interface_patch_model['auto_delete'] = False
- cluster_network_interface_patch_model['name'] = 'my-cluster-network-interface'
+ responses.POST,
+ url,
+ status=202,
+ )
# Set up parameter values
- cluster_network_id = 'testString'
id = 'testString'
- cluster_network_interface_patch = cluster_network_interface_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_id,
"id": id,
- "cluster_network_interface_patch": cluster_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_cluster_network_interface(**req_copy)
+ _service.activate_reservation(**req_copy)
- def test_update_cluster_network_interface_value_error_with_retries(self):
- # Enable retries and run test_update_cluster_network_interface_value_error.
+ def test_activate_reservation_value_error_with_retries(self):
+ # Enable retries and run test_activate_reservation_value_error.
_service.enable_retries()
- self.test_update_cluster_network_interface_value_error()
+ self.test_activate_reservation_value_error()
- # Disable retries and run test_update_cluster_network_interface_value_error.
+ # Disable retries and run test_activate_reservation_value_error.
_service.disable_retries()
- self.test_update_cluster_network_interface_value_error()
+ self.test_activate_reservation_value_error()
-class TestListClusterNetworkSubnets:
+# endregion
+##############################################################################
+# End of Service: Reservations
+##############################################################################
+
+##############################################################################
+# Start of Service: SecurityGroups
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_cluster_network_subnets
+ 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 TestListSecurityGroups:
+ """
+ Test Class for list_security_groups
"""
@responses.activate
- def test_list_cluster_network_subnets_all_params(self):
+ def test_list_security_groups_all_params(self):
"""
- list_cluster_network_subnets()
+ list_security_groups()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}'
+ url = preprocess_url('/security_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -35130,19 +34852,21 @@ def test_list_cluster_network_subnets_all_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
start = 'testString'
limit = 50
- name = 'my-name'
- sort = 'name'
+ resource_group_id = 'testString'
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
# Invoke method
- response = _service.list_cluster_network_subnets(
- cluster_network_id,
+ response = _service.list_security_groups(
start=start,
limit=limit,
- name=name,
- sort=sort,
+ resource_group_id=resource_group_id,
+ vpc_id=vpc_id,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
headers={},
)
@@ -35154,26 +34878,28 @@ def test_list_cluster_network_subnets_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 'sort={}'.format(sort) 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_cluster_network_subnets_all_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_subnets_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_cluster_network_subnets_all_params()
+ self.test_list_security_groups_all_params()
- # Disable retries and run test_list_cluster_network_subnets_all_params.
+ # Disable retries and run test_list_security_groups_all_params.
_service.disable_retries()
- self.test_list_cluster_network_subnets_all_params()
+ self.test_list_security_groups_all_params()
@responses.activate
- def test_list_cluster_network_subnets_required_params(self):
+ def test_list_security_groups_required_params(self):
"""
- test_list_cluster_network_subnets_required_params()
+ test_list_security_groups_required_params()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}'
+ url = preprocess_url('/security_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -35182,36 +34908,30 @@ def test_list_cluster_network_subnets_required_params(self):
status=200,
)
- # Set up parameter values
- cluster_network_id = 'testString'
-
# Invoke method
- response = _service.list_cluster_network_subnets(
- cluster_network_id,
- headers={},
- )
+ response = _service.list_security_groups()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_cluster_network_subnets_required_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_subnets_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_cluster_network_subnets_required_params()
+ self.test_list_security_groups_required_params()
- # Disable retries and run test_list_cluster_network_subnets_required_params.
+ # Disable retries and run test_list_security_groups_required_params.
_service.disable_retries()
- self.test_list_cluster_network_subnets_required_params()
+ self.test_list_security_groups_required_params()
@responses.activate
- def test_list_cluster_network_subnets_value_error(self):
+ def test_list_security_groups_value_error(self):
"""
- test_list_cluster_network_subnets_value_error()
+ test_list_security_groups_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}'
+ url = preprocess_url('/security_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -35220,36 +34940,32 @@ def test_list_cluster_network_subnets_value_error(self):
status=200,
)
- # Set up parameter values
- cluster_network_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_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_cluster_network_subnets(**req_copy)
+ _service.list_security_groups(**req_copy)
- def test_list_cluster_network_subnets_value_error_with_retries(self):
- # Enable retries and run test_list_cluster_network_subnets_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_cluster_network_subnets_value_error()
+ self.test_list_security_groups_value_error()
- # Disable retries and run test_list_cluster_network_subnets_value_error.
+ # Disable retries and run test_list_security_groups_value_error.
_service.disable_retries()
- self.test_list_cluster_network_subnets_value_error()
+ self.test_list_security_groups_value_error()
@responses.activate
- def test_list_cluster_network_subnets_with_pager_get_next(self):
+ def test_list_security_groups_with_pager_get_next(self):
"""
- test_list_cluster_network_subnets_with_pager_get_next()
+ test_list_security_groups_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
- mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
+ url = preprocess_url('/security_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -35267,12 +34983,13 @@ def test_list_cluster_network_subnets_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = ClusterNetworkSubnetsPager(
+ pager = SecurityGroupsPager(
client=_service,
- cluster_network_id='testString',
limit=10,
- name='my-name',
- sort='name',
+ resource_group_id='testString',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
)
while pager.has_next():
next_page = pager.get_next()
@@ -35281,14 +34998,14 @@ def test_list_cluster_network_subnets_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_cluster_network_subnets_with_pager_get_all(self):
+ def test_list_security_groups_with_pager_get_all(self):
"""
- test_list_cluster_network_subnets_with_pager_get_all()
+ test_list_security_groups_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
- mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}'
+ url = preprocess_url('/security_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -35305,31 +35022,32 @@ def test_list_cluster_network_subnets_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = ClusterNetworkSubnetsPager(
+ pager = SecurityGroupsPager(
client=_service,
- cluster_network_id='testString',
limit=10,
- name='my-name',
- sort='name',
+ resource_group_id='testString',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateClusterNetworkSubnet:
+class TestCreateSecurityGroup:
"""
- Test Class for create_cluster_network_subnet
+ Test Class for create_security_group
"""
@responses.activate
- def test_create_cluster_network_subnet_all_params(self):
+ def test_create_security_group_all_params(self):
"""
- create_cluster_network_subnet()
+ create_security_group()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ url = preprocess_url('/security_groups')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -35338,20 +35056,42 @@ def test_create_cluster_network_subnet_all_params(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model
- cluster_network_subnet_prototype_model = {}
- cluster_network_subnet_prototype_model['ip_version'] = 'ipv4'
- cluster_network_subnet_prototype_model['name'] = 'my-cluster-network-subnet'
- cluster_network_subnet_prototype_model['total_ipv4_address_count'] = 256
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 SecurityGroupRuleLocalPrototypeIP model
+ security_group_rule_local_prototype_model = {}
+ security_group_rule_local_prototype_model['address'] = '192.168.3.4'
+
+ # 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 SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
+ security_group_rule_prototype_model = {}
+ security_group_rule_prototype_model['direction'] = 'inbound'
+ security_group_rule_prototype_model['ip_version'] = 'ipv4'
+ security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
+ security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
+ security_group_rule_prototype_model['protocol'] = 'all'
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_prototype = cluster_network_subnet_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_cluster_network_subnet(
- cluster_network_id,
- cluster_network_subnet_prototype,
+ response = _service.create_security_group(
+ vpc,
+ name=name,
+ resource_group=resource_group,
+ rules=rules,
headers={},
)
@@ -35360,25 +35100,28 @@ def test_create_cluster_network_subnet_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 == cluster_network_subnet_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_cluster_network_subnet_all_params_with_retries(self):
- # Enable retries and run test_create_cluster_network_subnet_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_cluster_network_subnet_all_params()
+ self.test_create_security_group_all_params()
- # Disable retries and run test_create_cluster_network_subnet_all_params.
+ # Disable retries and run test_create_security_group_all_params.
_service.disable_retries()
- self.test_create_cluster_network_subnet_all_params()
+ self.test_create_security_group_all_params()
@responses.activate
- def test_create_cluster_network_subnet_value_error(self):
+ def test_create_security_group_value_error(self):
"""
- test_create_cluster_network_subnet_value_error()
+ test_create_security_group_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ url = preprocess_url('/security_groups')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -35387,49 +35130,143 @@ def test_create_cluster_network_subnet_value_error(self):
status=201,
)
- # Construct a dict representation of a ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model
- cluster_network_subnet_prototype_model = {}
- cluster_network_subnet_prototype_model['ip_version'] = 'ipv4'
- cluster_network_subnet_prototype_model['name'] = 'my-cluster-network-subnet'
- cluster_network_subnet_prototype_model['total_ipv4_address_count'] = 256
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 SecurityGroupRuleLocalPrototypeIP model
+ security_group_rule_local_prototype_model = {}
+ security_group_rule_local_prototype_model['address'] = '192.168.3.4'
+
+ # 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 SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
+ security_group_rule_prototype_model = {}
+ security_group_rule_prototype_model['direction'] = 'inbound'
+ security_group_rule_prototype_model['ip_version'] = 'ipv4'
+ security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
+ security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
+ security_group_rule_prototype_model['protocol'] = 'all'
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_prototype = cluster_network_subnet_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 = {
- "cluster_network_id": cluster_network_id,
- "cluster_network_subnet_prototype": cluster_network_subnet_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_cluster_network_subnet(**req_copy)
+ _service.create_security_group(**req_copy)
- def test_create_cluster_network_subnet_value_error_with_retries(self):
- # Enable retries and run test_create_cluster_network_subnet_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_cluster_network_subnet_value_error()
+ self.test_create_security_group_value_error()
- # Disable retries and run test_create_cluster_network_subnet_value_error.
+ # Disable retries and run test_create_security_group_value_error.
_service.disable_retries()
- self.test_create_cluster_network_subnet_value_error()
+ self.test_create_security_group_value_error()
-class TestListClusterNetworkSubnetReservedIps:
+class TestDeleteSecurityGroup:
"""
- Test Class for list_cluster_network_subnet_reserved_ips
+ Test Class for delete_security_group
"""
@responses.activate
- def test_list_cluster_network_subnet_reserved_ips_all_params(self):
+ def test_delete_security_group_all_params(self):
"""
- list_cluster_network_subnet_reserved_ips()
+ delete_security_group()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}'
+ url = preprocess_url('/security_groups/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_security_group(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ 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.
+ _service.enable_retries()
+ self.test_delete_security_group_all_params()
+
+ # Disable retries and run test_delete_security_group_all_params.
+ _service.disable_retries()
+ self.test_delete_security_group_all_params()
+
+ @responses.activate
+ def test_delete_security_group_value_error(self):
+ """
+ test_delete_security_group_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/security_groups/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_security_group(**req_copy)
+
+ 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_security_group_value_error()
+
+ # Disable retries and run test_delete_security_group_value_error.
+ _service.disable_retries()
+ self.test_delete_security_group_value_error()
+
+
+class TestGetSecurityGroup:
+ """
+ Test Class for get_security_group
+ """
+
+ @responses.activate
+ def test_get_security_group_all_params(self):
+ """
+ get_security_group()
+ """
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -35439,52 +35276,35 @@ def test_list_cluster_network_subnet_reserved_ips_all_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
- start = 'testString'
- limit = 50
- name = 'my-name'
- sort = 'name'
+ id = 'testString'
# Invoke method
- response = _service.list_cluster_network_subnet_reserved_ips(
- cluster_network_id,
- cluster_network_subnet_id,
- start=start,
- limit=limit,
- name=name,
- sort=sort,
+ response = _service.get_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 'name={}'.format(name) in query_string
- assert 'sort={}'.format(sort) in query_string
- def test_list_cluster_network_subnet_reserved_ips_all_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_subnet_reserved_ips_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_list_cluster_network_subnet_reserved_ips_all_params()
+ self.test_get_security_group_all_params()
- # Disable retries and run test_list_cluster_network_subnet_reserved_ips_all_params.
+ # Disable retries and run test_get_security_group_all_params.
_service.disable_retries()
- self.test_list_cluster_network_subnet_reserved_ips_all_params()
+ self.test_get_security_group_all_params()
@responses.activate
- def test_list_cluster_network_subnet_reserved_ips_required_params(self):
+ def test_get_security_group_value_error(self):
"""
- test_list_cluster_network_subnet_reserved_ips_required_params()
+ test_get_security_group_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -35494,159 +35314,217 @@ def test_list_cluster_network_subnet_reserved_ips_required_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ 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_security_group(**req_copy)
+
+ 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_security_group_value_error()
+
+ # Disable retries and run test_get_security_group_value_error.
+ _service.disable_retries()
+ self.test_get_security_group_value_error()
+
+
+class TestUpdateSecurityGroup:
+ """
+ Test Class for update_security_group
+ """
+
+ @responses.activate
+ def test_update_security_group_all_params(self):
+ """
+ update_security_group()
+ """
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 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.list_cluster_network_subnet_reserved_ips(
- cluster_network_id,
- cluster_network_subnet_id,
+ response = _service.update_security_group(
+ 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_list_cluster_network_subnet_reserved_ips_required_params_with_retries(self):
- # Enable retries and run test_list_cluster_network_subnet_reserved_ips_required_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_list_cluster_network_subnet_reserved_ips_required_params()
+ self.test_update_security_group_all_params()
- # Disable retries and run test_list_cluster_network_subnet_reserved_ips_required_params.
+ # Disable retries and run test_update_security_group_all_params.
_service.disable_retries()
- self.test_list_cluster_network_subnet_reserved_ips_required_params()
+ self.test_update_security_group_all_params()
@responses.activate
- def test_list_cluster_network_subnet_reserved_ips_value_error(self):
+ def test_update_security_group_value_error(self):
"""
- test_list_cluster_network_subnet_reserved_ips_value_error()
+ test_update_security_group_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}'
+ 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
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
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ id = 'testString'
+ security_group_patch = security_group_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_id,
- "cluster_network_subnet_id": cluster_network_subnet_id,
+ "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.list_cluster_network_subnet_reserved_ips(**req_copy)
+ _service.update_security_group(**req_copy)
- def test_list_cluster_network_subnet_reserved_ips_value_error_with_retries(self):
- # Enable retries and run test_list_cluster_network_subnet_reserved_ips_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_list_cluster_network_subnet_reserved_ips_value_error()
+ self.test_update_security_group_value_error()
- # Disable retries and run test_list_cluster_network_subnet_reserved_ips_value_error.
+ # Disable retries and run test_update_security_group_value_error.
_service.disable_retries()
- self.test_list_cluster_network_subnet_reserved_ips_value_error()
+ self.test_update_security_group_value_error()
+
+
+class TestListSecurityGroupRules:
+ """
+ Test Class for list_security_group_rules
+ """
@responses.activate
- def test_list_cluster_network_subnet_reserved_ips_with_pager_get_next(self):
+ def test_list_security_group_rules_all_params(self):
"""
- test_list_cluster_network_subnet_reserved_ips_with_pager_get_next()
+ list_security_group_rules()
"""
- # Set up a two-page mock response
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}'
responses.add(
responses.GET,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = ClusterNetworkSubnetReservedIpsPager(
- client=_service,
- cluster_network_id='testString',
- cluster_network_subnet_id='testString',
- limit=10,
- name='my-name',
- sort='name',
+ # Set up parameter values
+ security_group_id = 'testString'
+
+ # Invoke method
+ response = _service.list_security_group_rules(
+ security_group_id,
+ headers={},
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ 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_security_group_rules_all_params()
+
+ # Disable retries and run test_list_security_group_rules_all_params.
+ _service.disable_retries()
+ self.test_list_security_group_rules_all_params()
@responses.activate
- def test_list_cluster_network_subnet_reserved_ips_with_pager_get_all(self):
+ def test_list_security_group_rules_value_error(self):
"""
- test_list_cluster_network_subnet_reserved_ips_with_pager_get_all()
+ test_list_security_group_rules_value_error()
"""
- # Set up a two-page mock response
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","id":"0717-d4d6489a-3bf5-4104-a33a-3572faf2d117","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}'
responses.add(
responses.GET,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- pager = ClusterNetworkSubnetReservedIpsPager(
- client=_service,
- cluster_network_id='testString',
- cluster_network_subnet_id='testString',
- limit=10,
- name='my-name',
- sort='name',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # 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_rules(**req_copy)
-class TestCreateClusterNetworkSubnetReservedIp:
+ 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_security_group_rules_value_error()
+
+ # Disable retries and run test_list_security_group_rules_value_error.
+ _service.disable_retries()
+ self.test_list_security_group_rules_value_error()
+
+
+class TestCreateSecurityGroupRule:
"""
- Test Class for create_cluster_network_subnet_reserved_ip
+ Test Class for create_security_group_rule
"""
@responses.activate
- def test_create_cluster_network_subnet_reserved_ip_all_params(self):
+ def test_create_security_group_rule_all_params(self):
"""
- create_cluster_network_subnet_reserved_ip()
+ create_security_group_rule()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/rules')
+ mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
responses.add(
responses.POST,
url,
@@ -35655,18 +35533,30 @@ def test_create_cluster_network_subnet_reserved_ip_all_params(self):
status=201,
)
+ # Construct a dict representation of a SecurityGroupRuleLocalPrototypeIP model
+ security_group_rule_local_prototype_model = {}
+ security_group_rule_local_prototype_model['address'] = '192.168.3.4'
+
+ # 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 SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
+ security_group_rule_prototype_model = {}
+ security_group_rule_prototype_model['direction'] = 'inbound'
+ security_group_rule_prototype_model['ip_version'] = 'ipv4'
+ security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
+ security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
+ security_group_rule_prototype_model['protocol'] = 'all'
+
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
- address = '192.168.3.4'
- name = 'my-cluster-network-subnet-reserved-ip'
+ security_group_id = 'testString'
+ security_group_rule_prototype = security_group_rule_prototype_model
# Invoke method
- response = _service.create_cluster_network_subnet_reserved_ip(
- cluster_network_id,
- cluster_network_subnet_id,
- address=address,
- name=name,
+ response = _service.create_security_group_rule(
+ security_group_id,
+ security_group_rule_prototype,
headers={},
)
@@ -35675,26 +35565,25 @@ def test_create_cluster_network_subnet_reserved_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['address'] == '192.168.3.4'
- assert req_body['name'] == 'my-cluster-network-subnet-reserved-ip'
+ assert req_body == security_group_rule_prototype
- def test_create_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_create_cluster_network_subnet_reserved_ip_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_cluster_network_subnet_reserved_ip_all_params()
+ self.test_create_security_group_rule_all_params()
- # Disable retries and run test_create_cluster_network_subnet_reserved_ip_all_params.
+ # Disable retries and run test_create_security_group_rule_all_params.
_service.disable_retries()
- self.test_create_cluster_network_subnet_reserved_ip_all_params()
+ self.test_create_security_group_rule_all_params()
@responses.activate
- def test_create_cluster_network_subnet_reserved_ip_value_error(self):
+ def test_create_security_group_rule_value_error(self):
"""
- test_create_cluster_network_subnet_reserved_ip_value_error()
+ test_create_security_group_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/rules')
+ mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
responses.add(
responses.POST,
url,
@@ -35703,554 +35592,631 @@ def test_create_cluster_network_subnet_reserved_ip_value_error(self):
status=201,
)
+ # Construct a dict representation of a SecurityGroupRuleLocalPrototypeIP model
+ security_group_rule_local_prototype_model = {}
+ security_group_rule_local_prototype_model['address'] = '192.168.3.4'
+
+ # 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 SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
+ security_group_rule_prototype_model = {}
+ security_group_rule_prototype_model['direction'] = 'inbound'
+ security_group_rule_prototype_model['ip_version'] = 'ipv4'
+ security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
+ security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
+ security_group_rule_prototype_model['protocol'] = 'all'
+
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
- address = '192.168.3.4'
- name = 'my-cluster-network-subnet-reserved-ip'
+ 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 = {
- "cluster_network_id": cluster_network_id,
- "cluster_network_subnet_id": cluster_network_subnet_id,
+ "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_cluster_network_subnet_reserved_ip(**req_copy)
+ _service.create_security_group_rule(**req_copy)
- def test_create_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_create_cluster_network_subnet_reserved_ip_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_cluster_network_subnet_reserved_ip_value_error()
+ self.test_create_security_group_rule_value_error()
- # Disable retries and run test_create_cluster_network_subnet_reserved_ip_value_error.
+ # Disable retries and run test_create_security_group_rule_value_error.
_service.disable_retries()
- self.test_create_cluster_network_subnet_reserved_ip_value_error()
+ self.test_create_security_group_rule_value_error()
-class TestDeleteClusterNetworkSubnetReservedIp:
+class TestDeleteSecurityGroupRule:
"""
- Test Class for delete_cluster_network_subnet_reserved_ip
+ Test Class for delete_security_group_rule
"""
@responses.activate
- def test_delete_cluster_network_subnet_reserved_ip_all_params(self):
+ def test_delete_security_group_rule_all_params(self):
"""
- delete_cluster_network_subnet_reserved_ip()
+ delete_security_group_rule()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/rules/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.delete_cluster_network_subnet_reserved_ip(
- cluster_network_id,
- cluster_network_subnet_id,
+ response = _service.delete_security_group_rule(
+ security_group_id,
id,
- if_match=if_match,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_subnet_reserved_ip_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_cluster_network_subnet_reserved_ip_all_params()
+ self.test_delete_security_group_rule_all_params()
- # Disable retries and run test_delete_cluster_network_subnet_reserved_ip_all_params.
+ # Disable retries and run test_delete_security_group_rule_all_params.
_service.disable_retries()
- self.test_delete_cluster_network_subnet_reserved_ip_all_params()
+ self.test_delete_security_group_rule_all_params()
@responses.activate
- def test_delete_cluster_network_subnet_reserved_ip_required_params(self):
+ def test_delete_security_group_rule_value_error(self):
"""
- test_delete_cluster_network_subnet_reserved_ip_required_params()
+ test_delete_security_group_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ 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_security_group_rule(**req_copy)
+
+ 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_security_group_rule_value_error()
+
+ # Disable retries and run test_delete_security_group_rule_value_error.
+ _service.disable_retries()
+ self.test_delete_security_group_rule_value_error()
+
+
+class TestGetSecurityGroupRule:
+ """
+ Test Class for get_security_group_rule
+ """
+
+ @responses.activate
+ def test_get_security_group_rule_all_params(self):
+ """
+ get_security_group_rule()
+ """
+ # 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ responses.add(
+ responses.GET,
+ url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_cluster_network_subnet_reserved_ip(
- cluster_network_id,
- cluster_network_subnet_id,
+ response = _service.get_security_group_rule(
+ security_group_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_cluster_network_subnet_reserved_ip_required_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_subnet_reserved_ip_required_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_delete_cluster_network_subnet_reserved_ip_required_params()
+ self.test_get_security_group_rule_all_params()
- # Disable retries and run test_delete_cluster_network_subnet_reserved_ip_required_params.
+ # Disable retries and run test_get_security_group_rule_all_params.
_service.disable_retries()
- self.test_delete_cluster_network_subnet_reserved_ip_required_params()
+ self.test_get_security_group_rule_all_params()
@responses.activate
- def test_delete_cluster_network_subnet_reserved_ip_value_error(self):
+ def test_get_security_group_rule_value_error(self):
"""
- test_delete_cluster_network_subnet_reserved_ip_value_error()
+ test_get_security_group_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/rules/testString')
+ mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_id,
- "cluster_network_subnet_id": cluster_network_subnet_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_cluster_network_subnet_reserved_ip(**req_copy)
+ _service.get_security_group_rule(**req_copy)
- def test_delete_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_delete_cluster_network_subnet_reserved_ip_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_delete_cluster_network_subnet_reserved_ip_value_error()
+ self.test_get_security_group_rule_value_error()
- # Disable retries and run test_delete_cluster_network_subnet_reserved_ip_value_error.
+ # Disable retries and run test_get_security_group_rule_value_error.
_service.disable_retries()
- self.test_delete_cluster_network_subnet_reserved_ip_value_error()
+ self.test_get_security_group_rule_value_error()
-class TestGetClusterNetworkSubnetReservedIp:
+class TestUpdateSecurityGroupRule:
"""
- Test Class for get_cluster_network_subnet_reserved_ip
+ Test Class for update_security_group_rule
"""
@responses.activate
- def test_get_cluster_network_subnet_reserved_ip_all_params(self):
+ def test_update_security_group_rule_all_params(self):
"""
- get_cluster_network_subnet_reserved_ip()
+ update_security_group_rule()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/rules/testString')
+ mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a SecurityGroupRuleLocalPatchIP model
+ security_group_rule_local_patch_model = {}
+ security_group_rule_local_patch_model['address'] = '192.168.3.4'
+
+ # Construct a dict representation of a SecurityGroupRuleRemotePatchCIDR model
+ security_group_rule_remote_patch_model = {}
+ security_group_rule_remote_patch_model['cidr_block'] = '10.0.0.0/8'
+
+ # 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['local'] = security_group_rule_local_patch_model
+ 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
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
+ security_group_rule_patch = security_group_rule_patch_model
# Invoke method
- response = _service.get_cluster_network_subnet_reserved_ip(
- cluster_network_id,
- cluster_network_subnet_id,
+ response = _service.update_security_group_rule(
+ security_group_id,
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_get_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_get_cluster_network_subnet_reserved_ip_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_get_cluster_network_subnet_reserved_ip_all_params()
+ self.test_update_security_group_rule_all_params()
- # Disable retries and run test_get_cluster_network_subnet_reserved_ip_all_params.
+ # Disable retries and run test_update_security_group_rule_all_params.
_service.disable_retries()
- self.test_get_cluster_network_subnet_reserved_ip_all_params()
+ self.test_update_security_group_rule_all_params()
@responses.activate
- def test_get_cluster_network_subnet_reserved_ip_value_error(self):
+ def test_update_security_group_rule_value_error(self):
"""
- test_get_cluster_network_subnet_reserved_ip_value_error()
+ test_update_security_group_rule_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/rules/testString')
+ mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a SecurityGroupRuleLocalPatchIP model
+ security_group_rule_local_patch_model = {}
+ security_group_rule_local_patch_model['address'] = '192.168.3.4'
+
+ # Construct a dict representation of a SecurityGroupRuleRemotePatchCIDR model
+ security_group_rule_remote_patch_model = {}
+ security_group_rule_remote_patch_model['cidr_block'] = '10.0.0.0/8'
+
+ # 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['local'] = security_group_rule_local_patch_model
+ 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
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
+ 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 = {
- "cluster_network_id": cluster_network_id,
- "cluster_network_subnet_id": cluster_network_subnet_id,
+ "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.get_cluster_network_subnet_reserved_ip(**req_copy)
+ _service.update_security_group_rule(**req_copy)
- def test_get_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_get_cluster_network_subnet_reserved_ip_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_get_cluster_network_subnet_reserved_ip_value_error()
+ self.test_update_security_group_rule_value_error()
- # Disable retries and run test_get_cluster_network_subnet_reserved_ip_value_error.
+ # Disable retries and run test_update_security_group_rule_value_error.
_service.disable_retries()
- self.test_get_cluster_network_subnet_reserved_ip_value_error()
+ self.test_update_security_group_rule_value_error()
-class TestUpdateClusterNetworkSubnetReservedIp:
+class TestListSecurityGroupTargets:
"""
- Test Class for update_cluster_network_subnet_reserved_ip
+ Test Class for list_security_group_targets
"""
@responses.activate
- def test_update_cluster_network_subnet_reserved_ip_all_params(self):
+ def test_list_security_group_targets_all_params(self):
"""
- update_cluster_network_subnet_reserved_ip()
+ list_security_group_targets()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/targets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkSubnetReservedIPPatch model
- cluster_network_subnet_reserved_ip_patch_model = {}
- cluster_network_subnet_reserved_ip_patch_model['auto_delete'] = False
- cluster_network_subnet_reserved_ip_patch_model['name'] = 'my-cluster-network-subnet-reserved-ip'
-
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
- id = 'testString'
- cluster_network_subnet_reserved_ip_patch = cluster_network_subnet_reserved_ip_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ security_group_id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.update_cluster_network_subnet_reserved_ip(
- cluster_network_id,
- cluster_network_subnet_id,
- id,
- cluster_network_subnet_reserved_ip_patch,
- if_match=if_match,
+ response = _service.list_security_group_targets(
+ security_group_id,
+ start=start,
+ limit=limit,
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 == cluster_network_subnet_reserved_ip_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
- def test_update_cluster_network_subnet_reserved_ip_all_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_subnet_reserved_ip_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_update_cluster_network_subnet_reserved_ip_all_params()
+ self.test_list_security_group_targets_all_params()
- # Disable retries and run test_update_cluster_network_subnet_reserved_ip_all_params.
+ # Disable retries and run test_list_security_group_targets_all_params.
_service.disable_retries()
- self.test_update_cluster_network_subnet_reserved_ip_all_params()
+ self.test_list_security_group_targets_all_params()
@responses.activate
- def test_update_cluster_network_subnet_reserved_ip_required_params(self):
+ def test_list_security_group_targets_required_params(self):
"""
- test_update_cluster_network_subnet_reserved_ip_required_params()
+ test_list_security_group_targets_required_params()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/targets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkSubnetReservedIPPatch model
- cluster_network_subnet_reserved_ip_patch_model = {}
- cluster_network_subnet_reserved_ip_patch_model['auto_delete'] = False
- cluster_network_subnet_reserved_ip_patch_model['name'] = 'my-cluster-network-subnet-reserved-ip'
-
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
- id = 'testString'
- cluster_network_subnet_reserved_ip_patch = cluster_network_subnet_reserved_ip_patch_model
+ security_group_id = 'testString'
# Invoke method
- response = _service.update_cluster_network_subnet_reserved_ip(
- cluster_network_id,
- cluster_network_subnet_id,
- id,
- cluster_network_subnet_reserved_ip_patch,
+ response = _service.list_security_group_targets(
+ security_group_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 == cluster_network_subnet_reserved_ip_patch
- def test_update_cluster_network_subnet_reserved_ip_required_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_subnet_reserved_ip_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_update_cluster_network_subnet_reserved_ip_required_params()
+ self.test_list_security_group_targets_required_params()
- # Disable retries and run test_update_cluster_network_subnet_reserved_ip_required_params.
+ # Disable retries and run test_list_security_group_targets_required_params.
_service.disable_retries()
- self.test_update_cluster_network_subnet_reserved_ip_required_params()
+ self.test_list_security_group_targets_required_params()
@responses.activate
- def test_update_cluster_network_subnet_reserved_ip_value_error(self):
+ def test_list_security_group_targets_value_error(self):
"""
- test_update_cluster_network_subnet_reserved_ip_value_error()
+ test_list_security_group_targets_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString/reserved_ips/testString')
- mock_response = '{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "id": "0717-d4d6489a-3bf5-4104-a33a-3572faf2d117", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}'
+ url = preprocess_url('/security_groups/testString/targets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkSubnetReservedIPPatch model
- cluster_network_subnet_reserved_ip_patch_model = {}
- cluster_network_subnet_reserved_ip_patch_model['auto_delete'] = False
- cluster_network_subnet_reserved_ip_patch_model['name'] = 'my-cluster-network-subnet-reserved-ip'
-
# Set up parameter values
- cluster_network_id = 'testString'
- cluster_network_subnet_id = 'testString'
- id = 'testString'
- cluster_network_subnet_reserved_ip_patch = cluster_network_subnet_reserved_ip_patch_model
+ security_group_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_id,
- "cluster_network_subnet_id": cluster_network_subnet_id,
- "id": id,
- "cluster_network_subnet_reserved_ip_patch": cluster_network_subnet_reserved_ip_patch,
+ "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.update_cluster_network_subnet_reserved_ip(**req_copy)
+ _service.list_security_group_targets(**req_copy)
- def test_update_cluster_network_subnet_reserved_ip_value_error_with_retries(self):
- # Enable retries and run test_update_cluster_network_subnet_reserved_ip_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_update_cluster_network_subnet_reserved_ip_value_error()
+ self.test_list_security_group_targets_value_error()
- # Disable retries and run test_update_cluster_network_subnet_reserved_ip_value_error.
+ # Disable retries and run test_list_security_group_targets_value_error.
_service.disable_retries()
- self.test_update_cluster_network_subnet_reserved_ip_value_error()
-
-
-class TestDeleteClusterNetworkSubnet:
- """
- Test Class for delete_cluster_network_subnet
- """
+ self.test_list_security_group_targets_value_error()
@responses.activate
- def test_delete_cluster_network_subnet_all_params(self):
+ def test_list_security_group_targets_with_pager_get_next(self):
"""
- delete_cluster_network_subnet()
+ test_list_security_group_targets_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ # Set up a two-page mock response
+ url = preprocess_url('/security_groups/testString/targets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
content_type='application/json',
- status=202,
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Set up parameter values
- cluster_network_id = 'testString'
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = SecurityGroupTargetsPager(
+ client=_service,
+ security_group_id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
- # Invoke method
- response = _service.delete_cluster_network_subnet(
- cluster_network_id,
- id,
- if_match=if_match,
- headers={},
+ @responses.activate
+ def test_list_security_group_targets_with_pager_get_all(self):
+ """
+ test_list_security_group_targets_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/security_groups/testString/targets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
+ # Exercise the pager class for this operation
+ pager = SecurityGroupTargetsPager(
+ client=_service,
+ security_group_id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
- def test_delete_cluster_network_subnet_all_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_subnet_all_params.
- _service.enable_retries()
- self.test_delete_cluster_network_subnet_all_params()
- # Disable retries and run test_delete_cluster_network_subnet_all_params.
- _service.disable_retries()
- self.test_delete_cluster_network_subnet_all_params()
+class TestDeleteSecurityGroupTargetBinding:
+ """
+ Test Class for delete_security_group_target_binding
+ """
@responses.activate
- def test_delete_cluster_network_subnet_required_params(self):
+ def test_delete_security_group_target_binding_all_params(self):
"""
- test_delete_cluster_network_subnet_required_params()
+ delete_security_group_target_binding()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ url = preprocess_url('/security_groups/testString/targets/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
- cluster_network_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_cluster_network_subnet(
- cluster_network_id,
+ response = _service.delete_security_group_target_binding(
+ security_group_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_cluster_network_subnet_required_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_subnet_required_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_cluster_network_subnet_required_params()
+ self.test_delete_security_group_target_binding_all_params()
- # Disable retries and run test_delete_cluster_network_subnet_required_params.
+ # Disable retries and run test_delete_security_group_target_binding_all_params.
_service.disable_retries()
- self.test_delete_cluster_network_subnet_required_params()
+ self.test_delete_security_group_target_binding_all_params()
@responses.activate
- def test_delete_cluster_network_subnet_value_error(self):
+ def test_delete_security_group_target_binding_value_error(self):
"""
- test_delete_cluster_network_subnet_value_error()
+ test_delete_security_group_target_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ url = preprocess_url('/security_groups/testString/targets/testString')
responses.add(
responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=202,
+ status=204,
)
# Set up parameter values
- cluster_network_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_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_cluster_network_subnet(**req_copy)
+ _service.delete_security_group_target_binding(**req_copy)
- def test_delete_cluster_network_subnet_value_error_with_retries(self):
- # Enable retries and run test_delete_cluster_network_subnet_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_cluster_network_subnet_value_error()
+ self.test_delete_security_group_target_binding_value_error()
- # Disable retries and run test_delete_cluster_network_subnet_value_error.
+ # Disable retries and run test_delete_security_group_target_binding_value_error.
_service.disable_retries()
- self.test_delete_cluster_network_subnet_value_error()
+ self.test_delete_security_group_target_binding_value_error()
-class TestGetClusterNetworkSubnet:
+class TestGetSecurityGroupTarget:
"""
- Test Class for get_cluster_network_subnet
+ Test Class for get_security_group_target
"""
@responses.activate
- def test_get_cluster_network_subnet_all_params(self):
+ def test_get_security_group_target_all_params(self):
"""
- get_cluster_network_subnet()
+ get_security_group_target()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ 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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
responses.add(
responses.GET,
url,
@@ -36260,12 +36226,12 @@ def test_get_cluster_network_subnet_all_params(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_cluster_network_subnet(
- cluster_network_id,
+ response = _service.get_security_group_target(
+ security_group_id,
id,
headers={},
)
@@ -36274,23 +36240,23 @@ def test_get_cluster_network_subnet_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_cluster_network_subnet_all_params_with_retries(self):
- # Enable retries and run test_get_cluster_network_subnet_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_cluster_network_subnet_all_params()
+ self.test_get_security_group_target_all_params()
- # Disable retries and run test_get_cluster_network_subnet_all_params.
+ # Disable retries and run test_get_security_group_target_all_params.
_service.disable_retries()
- self.test_get_cluster_network_subnet_all_params()
+ self.test_get_security_group_target_all_params()
@responses.activate
- def test_get_cluster_network_subnet_value_error(self):
+ def test_get_security_group_target_value_error(self):
"""
- test_get_cluster_network_subnet_value_error()
+ test_get_security_group_target_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ 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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
responses.add(
responses.GET,
url,
@@ -36300,597 +36266,455 @@ def test_get_cluster_network_subnet_value_error(self):
)
# Set up parameter values
- cluster_network_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "cluster_network_id": cluster_network_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_cluster_network_subnet(**req_copy)
+ _service.get_security_group_target(**req_copy)
- def test_get_cluster_network_subnet_value_error_with_retries(self):
- # Enable retries and run test_get_cluster_network_subnet_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_cluster_network_subnet_value_error()
+ self.test_get_security_group_target_value_error()
- # Disable retries and run test_get_cluster_network_subnet_value_error.
+ # Disable retries and run test_get_security_group_target_value_error.
_service.disable_retries()
- self.test_get_cluster_network_subnet_value_error()
+ self.test_get_security_group_target_value_error()
-class TestUpdateClusterNetworkSubnet:
+class TestCreateSecurityGroupTargetBinding:
"""
- Test Class for update_cluster_network_subnet
+ Test Class for create_security_group_target_binding
"""
@responses.activate
- def test_update_cluster_network_subnet_all_params(self):
+ def test_create_security_group_target_binding_all_params(self):
"""
- update_cluster_network_subnet()
+ create_security_group_target_binding()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ 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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
responses.add(
- responses.PATCH,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkSubnetPatch model
- cluster_network_subnet_patch_model = {}
- cluster_network_subnet_patch_model['name'] = 'my-cluster-network-subnet'
-
# Set up parameter values
- cluster_network_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
- cluster_network_subnet_patch = cluster_network_subnet_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_cluster_network_subnet(
- cluster_network_id,
+ response = _service.create_security_group_target_binding(
+ security_group_id,
id,
- cluster_network_subnet_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 == cluster_network_subnet_patch
- def test_update_cluster_network_subnet_all_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_subnet_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_cluster_network_subnet_all_params()
+ self.test_create_security_group_target_binding_all_params()
- # Disable retries and run test_update_cluster_network_subnet_all_params.
+ # Disable retries and run test_create_security_group_target_binding_all_params.
_service.disable_retries()
- self.test_update_cluster_network_subnet_all_params()
+ self.test_create_security_group_target_binding_all_params()
@responses.activate
- def test_update_cluster_network_subnet_required_params(self):
+ def test_create_security_group_target_binding_value_error(self):
"""
- test_update_cluster_network_subnet_required_params()
+ test_create_security_group_target_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
+ 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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
responses.add(
- responses.PATCH,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkSubnetPatch model
- cluster_network_subnet_patch_model = {}
- cluster_network_subnet_patch_model['name'] = 'my-cluster-network-subnet'
-
# Set up parameter values
- cluster_network_id = 'testString'
+ security_group_id = 'testString'
id = 'testString'
- cluster_network_subnet_patch = cluster_network_subnet_patch_model
-
- # Invoke method
- response = _service.update_cluster_network_subnet(
- cluster_network_id,
- id,
- cluster_network_subnet_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 == cluster_network_subnet_patch
+ # 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)
- def test_update_cluster_network_subnet_required_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_subnet_required_params.
+ 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_cluster_network_subnet_required_params()
+ self.test_create_security_group_target_binding_value_error()
- # Disable retries and run test_update_cluster_network_subnet_required_params.
+ # Disable retries and run test_create_security_group_target_binding_value_error.
_service.disable_retries()
- self.test_update_cluster_network_subnet_required_params()
+ self.test_create_security_group_target_binding_value_error()
- @responses.activate
- def test_update_cluster_network_subnet_value_error(self):
+
+# endregion
+##############################################################################
+# End of Service: SecurityGroups
+##############################################################################
+
+##############################################################################
+# Start of Service: Shares
+##############################################################################
+# region
+
+
+class TestNewInstance:
+ """
+ Test Class for new_instance
+ """
+
+ def test_new_instance(self):
"""
- test_update_cluster_network_subnet_value_error()
+ new_instance()
"""
- # Set up mock
- url = preprocess_url('/cluster_networks/testString/subnets/testString')
- mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
- # Construct a dict representation of a ClusterNetworkSubnetPatch model
- cluster_network_subnet_patch_model = {}
- cluster_network_subnet_patch_model['name'] = 'my-cluster-network-subnet'
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE',
+ )
- # Set up parameter values
- cluster_network_id = 'testString'
- id = 'testString'
- cluster_network_subnet_patch = cluster_network_subnet_patch_model
+ assert service is not None
+ assert isinstance(service, VpcV1)
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "cluster_network_id": cluster_network_id,
- "id": id,
- "cluster_network_subnet_patch": cluster_network_subnet_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_cluster_network_subnet(**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_update_cluster_network_subnet_value_error_with_retries(self):
- # Enable retries and run test_update_cluster_network_subnet_value_error.
- _service.enable_retries()
- self.test_update_cluster_network_subnet_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_update_cluster_network_subnet_value_error.
- _service.disable_retries()
- self.test_update_cluster_network_subnet_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 TestDeleteClusterNetwork:
+class TestListShareProfiles:
"""
- Test Class for delete_cluster_network
+ Test Class for list_share_profiles
"""
@responses.activate
- def test_delete_cluster_network_all_params(self):
+ def test_list_share_profiles_all_params(self):
"""
- delete_cluster_network()
+ list_share_profiles()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/share/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"allowed_access_protocols": {"default": ["nfs4"], "type": "subset", "values": ["nfs4"]}, "allowed_transit_encryption_modes": {"default": ["ipsec"], "type": "subset", "values": ["ipsec"]}, "availability_modes": {"default": "zonal", "type": "enum", "values": ["zonal"]}, "bandwidth": {"default": 100, "max": 1024, "min": 1, "step": 1, "type": "range", "value": 5}, "capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile", "storage_generation": {"type": "fixed", "value": 1}}], "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
# Set up parameter values
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ start = 'testString'
+ limit = 50
+ sort = 'name'
# Invoke method
- response = _service.delete_cluster_network(
- id,
- if_match=if_match,
+ response = _service.list_share_profiles(
+ start=start,
+ limit=limit,
+ sort=sort,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ 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_delete_cluster_network_all_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_all_params.
+ def test_list_share_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_share_profiles_all_params.
_service.enable_retries()
- self.test_delete_cluster_network_all_params()
+ self.test_list_share_profiles_all_params()
- # Disable retries and run test_delete_cluster_network_all_params.
+ # Disable retries and run test_list_share_profiles_all_params.
_service.disable_retries()
- self.test_delete_cluster_network_all_params()
+ self.test_list_share_profiles_all_params()
@responses.activate
- def test_delete_cluster_network_required_params(self):
+ def test_list_share_profiles_required_params(self):
"""
- test_delete_cluster_network_required_params()
+ test_list_share_profiles_required_params()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/share/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"allowed_access_protocols": {"default": ["nfs4"], "type": "subset", "values": ["nfs4"]}, "allowed_transit_encryption_modes": {"default": ["ipsec"], "type": "subset", "values": ["ipsec"]}, "availability_modes": {"default": "zonal", "type": "enum", "values": ["zonal"]}, "bandwidth": {"default": 100, "max": 1024, "min": 1, "step": 1, "type": "range", "value": 5}, "capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile", "storage_generation": {"type": "fixed", "value": 1}}], "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ status=200,
)
- # Set up parameter values
- id = 'testString'
-
# Invoke method
- response = _service.delete_cluster_network(
- id,
- headers={},
- )
+ response = _service.list_share_profiles()
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_cluster_network_required_params_with_retries(self):
- # Enable retries and run test_delete_cluster_network_required_params.
+ def test_list_share_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_share_profiles_required_params.
_service.enable_retries()
- self.test_delete_cluster_network_required_params()
+ self.test_list_share_profiles_required_params()
- # Disable retries and run test_delete_cluster_network_required_params.
+ # Disable retries and run test_list_share_profiles_required_params.
_service.disable_retries()
- self.test_delete_cluster_network_required_params()
+ self.test_list_share_profiles_required_params()
@responses.activate
- def test_delete_cluster_network_value_error(self):
+ def test_list_share_profiles_value_error(self):
"""
- test_delete_cluster_network_value_error()
+ test_list_share_profiles_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/share/profiles')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"allowed_access_protocols": {"default": ["nfs4"], "type": "subset", "values": ["nfs4"]}, "allowed_transit_encryption_modes": {"default": ["ipsec"], "type": "subset", "values": ["ipsec"]}, "availability_modes": {"default": "zonal", "type": "enum", "values": ["zonal"]}, "bandwidth": {"default": 100, "max": 1024, "min": 1, "step": 1, "type": "range", "value": 5}, "capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile", "storage_generation": {"type": "fixed", "value": 1}}], "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=202,
+ 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.delete_cluster_network(**req_copy)
+ _service.list_share_profiles(**req_copy)
- def test_delete_cluster_network_value_error_with_retries(self):
- # Enable retries and run test_delete_cluster_network_value_error.
+ def test_list_share_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_share_profiles_value_error.
_service.enable_retries()
- self.test_delete_cluster_network_value_error()
+ self.test_list_share_profiles_value_error()
- # Disable retries and run test_delete_cluster_network_value_error.
+ # Disable retries and run test_list_share_profiles_value_error.
_service.disable_retries()
- self.test_delete_cluster_network_value_error()
-
-
-class TestGetClusterNetwork:
- """
- Test Class for get_cluster_network
- """
+ self.test_list_share_profiles_value_error()
@responses.activate
- def test_get_cluster_network_all_params(self):
+ def test_list_share_profiles_with_pager_get_next(self):
"""
- get_cluster_network()
+ test_list_share_profiles_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}'
+ # Set up a two-page mock response
+ url = preprocess_url('/share/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"allowed_access_protocols":{"default":["nfs4"],"type":"subset","values":["nfs4"]},"allowed_transit_encryption_modes":{"default":["ipsec"],"type":"subset","values":["ipsec"]},"availability_modes":{"default":"zonal","type":"enum","values":["zonal"]},"bandwidth":{"default":100,"max":1024,"min":1,"step":1,"type":"range","value":5},"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile","storage_generation":{"type":"fixed","value":1}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"allowed_access_protocols":{"default":["nfs4"],"type":"subset","values":["nfs4"]},"allowed_transit_encryption_modes":{"default":["ipsec"],"type":"subset","values":["ipsec"]},"availability_modes":{"default":"zonal","type":"enum","values":["zonal"]},"bandwidth":{"default":100,"max":1024,"min":1,"step":1,"type":"range","value":5},"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile","storage_generation":{"type":"fixed","value":1}}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
content_type='application/json',
status=200,
)
-
- # Set up parameter values
- id = 'testString'
-
- # Invoke method
- response = _service.get_cluster_network(
- id,
- headers={},
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_get_cluster_network_all_params_with_retries(self):
- # Enable retries and run test_get_cluster_network_all_params.
- _service.enable_retries()
- self.test_get_cluster_network_all_params()
-
- # Disable retries and run test_get_cluster_network_all_params.
- _service.disable_retries()
- self.test_get_cluster_network_all_params()
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = ShareProfilesPager(
+ client=_service,
+ limit=10,
+ sort='name',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_get_cluster_network_value_error(self):
+ def test_list_share_profiles_with_pager_get_all(self):
"""
- test_get_cluster_network_value_error()
+ test_list_share_profiles_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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"}}'
+ # Set up a two-page mock response
+ url = preprocess_url('/share/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"allowed_access_protocols":{"default":["nfs4"],"type":"subset","values":["nfs4"]},"allowed_transit_encryption_modes":{"default":["ipsec"],"type":"subset","values":["ipsec"]},"availability_modes":{"default":"zonal","type":"enum","values":["zonal"]},"bandwidth":{"default":100,"max":1024,"min":1,"step":1,"type":"range","value":5},"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile","storage_generation":{"type":"fixed","value":1}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"allowed_access_protocols":{"default":["nfs4"],"type":"subset","values":["nfs4"]},"allowed_transit_encryption_modes":{"default":["ipsec"],"type":"subset","values":["ipsec"]},"availability_modes":{"default":"zonal","type":"enum","values":["zonal"]},"bandwidth":{"default":100,"max":1024,"min":1,"step":1,"type":"range","value":5},"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile","storage_generation":{"type":"fixed","value":1}}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
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_cluster_network(**req_copy)
-
- def test_get_cluster_network_value_error_with_retries(self):
- # Enable retries and run test_get_cluster_network_value_error.
- _service.enable_retries()
- self.test_get_cluster_network_value_error()
-
- # Disable retries and run test_get_cluster_network_value_error.
- _service.disable_retries()
- self.test_get_cluster_network_value_error()
-
-
-class TestUpdateClusterNetwork:
- """
- Test Class for update_cluster_network
- """
-
- @responses.activate
- def test_update_cluster_network_all_params(self):
- """
- update_cluster_network()
- """
- # Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.GET,
url,
- body=mock_response,
+ body=mock_response2,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkPatch model
- cluster_network_patch_model = {}
- cluster_network_patch_model['name'] = 'my-cluster-network'
-
- # Set up parameter values
- id = 'testString'
- cluster_network_patch = cluster_network_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
-
- # Invoke method
- response = _service.update_cluster_network(
- id,
- cluster_network_patch,
- if_match=if_match,
- headers={},
+ # Exercise the pager class for this operation
+ pager = ShareProfilesPager(
+ client=_service,
+ limit=10,
+ sort='name',
)
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
- # 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 == cluster_network_patch
-
- def test_update_cluster_network_all_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_all_params.
- _service.enable_retries()
- self.test_update_cluster_network_all_params()
- # Disable retries and run test_update_cluster_network_all_params.
- _service.disable_retries()
- self.test_update_cluster_network_all_params()
+class TestGetShareProfile:
+ """
+ Test Class for get_share_profile
+ """
@responses.activate
- def test_update_cluster_network_required_params(self):
+ def test_get_share_profile_all_params(self):
"""
- test_update_cluster_network_required_params()
+ get_share_profile()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/share/profiles/dp2')
+ mock_response = '{"allowed_access_protocols": {"default": ["nfs4"], "type": "subset", "values": ["nfs4"]}, "allowed_transit_encryption_modes": {"default": ["ipsec"], "type": "subset", "values": ["ipsec"]}, "availability_modes": {"default": "zonal", "type": "enum", "values": ["zonal"]}, "bandwidth": {"default": 100, "max": 1024, "min": 1, "step": 1, "type": "range", "value": 5}, "capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile", "storage_generation": {"type": "fixed", "value": 1}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkPatch model
- cluster_network_patch_model = {}
- cluster_network_patch_model['name'] = 'my-cluster-network'
-
# Set up parameter values
- id = 'testString'
- cluster_network_patch = cluster_network_patch_model
+ name = 'dp2'
# Invoke method
- response = _service.update_cluster_network(
- id,
- cluster_network_patch,
+ response = _service.get_share_profile(
+ name,
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 == cluster_network_patch
- def test_update_cluster_network_required_params_with_retries(self):
- # Enable retries and run test_update_cluster_network_required_params.
+ def test_get_share_profile_all_params_with_retries(self):
+ # Enable retries and run test_get_share_profile_all_params.
_service.enable_retries()
- self.test_update_cluster_network_required_params()
+ self.test_get_share_profile_all_params()
- # Disable retries and run test_update_cluster_network_required_params.
+ # Disable retries and run test_get_share_profile_all_params.
_service.disable_retries()
- self.test_update_cluster_network_required_params()
+ self.test_get_share_profile_all_params()
@responses.activate
- def test_update_cluster_network_value_error(self):
+ def test_get_share_profile_value_error(self):
"""
- test_update_cluster_network_value_error()
+ test_get_share_profile_value_error()
"""
# Set up mock
- url = preprocess_url('/cluster_networks/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/share/profiles/dp2')
+ mock_response = '{"allowed_access_protocols": {"default": ["nfs4"], "type": "subset", "values": ["nfs4"]}, "allowed_transit_encryption_modes": {"default": ["ipsec"], "type": "subset", "values": ["ipsec"]}, "availability_modes": {"default": "zonal", "type": "enum", "values": ["zonal"]}, "bandwidth": {"default": 100, "max": 1024, "min": 1, "step": 1, "type": "range", "value": 5}, "capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile", "storage_generation": {"type": "fixed", "value": 1}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a ClusterNetworkPatch model
- cluster_network_patch_model = {}
- cluster_network_patch_model['name'] = 'my-cluster-network'
-
# Set up parameter values
- id = 'testString'
- cluster_network_patch = cluster_network_patch_model
+ name = 'dp2'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "cluster_network_patch": cluster_network_patch,
+ "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.update_cluster_network(**req_copy)
+ _service.get_share_profile(**req_copy)
- def test_update_cluster_network_value_error_with_retries(self):
- # Enable retries and run test_update_cluster_network_value_error.
+ def test_get_share_profile_value_error_with_retries(self):
+ # Enable retries and run test_get_share_profile_value_error.
_service.enable_retries()
- self.test_update_cluster_network_value_error()
+ self.test_get_share_profile_value_error()
- # Disable retries and run test_update_cluster_network_value_error.
+ # Disable retries and run test_get_share_profile_value_error.
_service.disable_retries()
- self.test_update_cluster_network_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: ClusterNetworks
-##############################################################################
-
-##############################################################################
-# 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()
-
- 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,
- )
+ self.test_get_share_profile_value_error()
-class TestListPublicGateways:
+class TestListShares:
"""
- Test Class for list_public_gateways
+ Test Class for list_shares
"""
@responses.activate
- def test_list_public_gateways_all_params(self):
+ def test_list_shares_all_params(self):
"""
- list_public_gateways()
+ list_shares()
"""
# Set up mock
- url = preprocess_url('/public_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -36903,12 +36727,18 @@ def test_list_public_gateways_all_params(self):
start = 'testString'
limit = 50
resource_group_id = 'testString'
+ name = 'my-name'
+ sort = 'name'
+ replication_role = 'none'
# Invoke method
- response = _service.list_public_gateways(
+ response = _service.list_shares(
start=start,
limit=limit,
resource_group_id=resource_group_id,
+ name=name,
+ sort=sort,
+ replication_role=replication_role,
headers={},
)
@@ -36921,24 +36751,27 @@ def test_list_public_gateways_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 'name={}'.format(name) in query_string
+ assert 'sort={}'.format(sort) in query_string
+ assert 'replication_role={}'.format(replication_role) 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_shares_all_params_with_retries(self):
+ # Enable retries and run test_list_shares_all_params.
_service.enable_retries()
- self.test_list_public_gateways_all_params()
+ self.test_list_shares_all_params()
- # Disable retries and run test_list_public_gateways_all_params.
+ # Disable retries and run test_list_shares_all_params.
_service.disable_retries()
- self.test_list_public_gateways_all_params()
+ self.test_list_shares_all_params()
@responses.activate
- def test_list_public_gateways_required_params(self):
+ def test_list_shares_required_params(self):
"""
- test_list_public_gateways_required_params()
+ test_list_shares_required_params()
"""
# Set up mock
- url = preprocess_url('/public_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -36948,29 +36781,29 @@ def test_list_public_gateways_required_params(self):
)
# Invoke method
- response = _service.list_public_gateways()
+ response = _service.list_shares()
# 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_shares_required_params_with_retries(self):
+ # Enable retries and run test_list_shares_required_params.
_service.enable_retries()
- self.test_list_public_gateways_required_params()
+ self.test_list_shares_required_params()
- # Disable retries and run test_list_public_gateways_required_params.
+ # Disable retries and run test_list_shares_required_params.
_service.disable_retries()
- self.test_list_public_gateways_required_params()
+ self.test_list_shares_required_params()
@responses.activate
- def test_list_public_gateways_value_error(self):
+ def test_list_shares_value_error(self):
"""
- test_list_public_gateways_value_error()
+ test_list_shares_value_error()
"""
# Set up mock
- url = preprocess_url('/public_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -36985,26 +36818,26 @@ def test_list_public_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_public_gateways(**req_copy)
+ _service.list_shares(**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_shares_value_error_with_retries(self):
+ # Enable retries and run test_list_shares_value_error.
_service.enable_retries()
- self.test_list_public_gateways_value_error()
+ self.test_list_shares_value_error()
- # Disable retries and run test_list_public_gateways_value_error.
+ # Disable retries and run test_list_shares_value_error.
_service.disable_retries()
- self.test_list_public_gateways_value_error()
+ self.test_list_shares_value_error()
@responses.activate
- def test_list_public_gateways_with_pager_get_next(self):
+ def test_list_shares_with_pager_get_next(self):
"""
- test_list_public_gateways_with_pager_get_next()
+ test_list_shares_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/public_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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('/shares')
+ mock_response1 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_access_protocols":["nfs4"],"allowed_transit_encryption_modes":["ipsec"],"availability_mode":"zonal","bandwidth":1,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"storage_generation":1,"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_access_protocols":["nfs4"],"allowed_transit_encryption_modes":["ipsec"],"availability_mode":"zonal","bandwidth":1,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"storage_generation":1,"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -37022,10 +36855,13 @@ def test_list_public_gateways_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = PublicGatewaysPager(
+ pager = SharesPager(
client=_service,
limit=10,
resource_group_id='testString',
+ name='my-name',
+ sort='name',
+ replication_role='none',
)
while pager.has_next():
next_page = pager.get_next()
@@ -37034,14 +36870,14 @@ def test_list_public_gateways_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_public_gateways_with_pager_get_all(self):
+ def test_list_shares_with_pager_get_all(self):
"""
- test_list_public_gateways_with_pager_get_all()
+ test_list_shares_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/public_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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('/shares')
+ mock_response1 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_access_protocols":["nfs4"],"allowed_transit_encryption_modes":["ipsec"],"availability_mode":"zonal","bandwidth":1,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"storage_generation":1,"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_access_protocols":["nfs4"],"allowed_transit_encryption_modes":["ipsec"],"availability_mode":"zonal","bandwidth":1,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","initial_owner":{"gid":50,"uid":50},"iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"cloning_in_progress","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"snapshot_count":0,"snapshot_size":0,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","name":"my-share-snapshot","resource_type":"share_snapshot"},"storage_generation":1,"user_tags":["user_tags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -37058,29 +36894,32 @@ def test_list_public_gateways_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = PublicGatewaysPager(
+ pager = SharesPager(
client=_service,
limit=10,
resource_group_id='testString',
+ name='my-name',
+ sort='name',
+ replication_role='none',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreatePublicGateway:
+class TestCreateShare:
"""
- Test Class for create_public_gateway
+ Test Class for create_share
"""
@responses.activate
- def test_create_public_gateway_all_params(self):
+ def test_create_share_all_params(self):
"""
- create_public_gateway()
+ create_share()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -37089,36 +36928,103 @@ def test_create_public_gateway_all_params(self):
status=201,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
+ share_mount_target_virtual_network_interface_prototype_model = {}
+ share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
+ share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
+ share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
+ share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
+ share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
+ share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
+ share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
+ share_mount_target_prototype_model = {}
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
+ share_mount_target_prototype_model['name'] = 'my-share-mount-target'
+ share_mount_target_prototype_model['transit_encryption'] = 'none'
+ share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
+
+ # Construct a dict representation of a ShareProfileIdentityByName model
+ share_profile_identity_model = {}
+ share_profile_identity_model['name'] = 'tier-3iops'
# 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'] = 'r006-f45e0d90-12a8-4460-8210-290ff2ab75cd'
+ # Construct a dict representation of a SharePrototypeShareContext model
+ share_prototype_share_context_model = {}
+ share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_prototype_share_context_model['iops'] = 100
+ share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
+ share_prototype_share_context_model['name'] = 'my-share'
+ share_prototype_share_context_model['profile'] = share_profile_identity_model
+ share_prototype_share_context_model['replication_cron_spec'] = '0 */5 * * *'
+ share_prototype_share_context_model['resource_group'] = resource_group_identity_model
+ share_prototype_share_context_model['user_tags'] = []
+ share_prototype_share_context_model['zone'] = zone_identity_model
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a ShareInitialOwner model
+ share_initial_owner_model = {}
+ share_initial_owner_model['gid'] = 50
+ share_initial_owner_model['uid'] = 50
+
+ # Construct a dict representation of a SharePrototypeShareBySize model
+ share_prototype_model = {}
+ share_prototype_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_prototype_model['mount_targets'] = [share_mount_target_prototype_model]
+ share_prototype_model['name'] = 'my-share'
+ share_prototype_model['replica_share'] = share_prototype_share_context_model
+ share_prototype_model['user_tags'] = []
+ share_prototype_model['access_control_mode'] = 'security_group'
+ share_prototype_model['allowed_access_protocols'] = ['nfs4']
+ share_prototype_model['bandwidth'] = 100
+ share_prototype_model['encryption_key'] = encryption_key_identity_model
+ share_prototype_model['initial_owner'] = share_initial_owner_model
+ share_prototype_model['iops'] = 100
+ share_prototype_model['profile'] = share_profile_identity_model
+ share_prototype_model['resource_group'] = resource_group_identity_model
+ share_prototype_model['size'] = 200
+ share_prototype_model['zone'] = zone_identity_model
# 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
+ share_prototype = share_prototype_model
# Invoke method
- response = _service.create_public_gateway(
- vpc,
- zone,
- floating_ip=floating_ip,
- name=name,
- resource_group=resource_group,
+ response = _service.create_share(
+ share_prototype,
headers={},
)
@@ -37127,29 +37033,25 @@ 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 == share_prototype
- def test_create_public_gateway_all_params_with_retries(self):
- # Enable retries and run test_create_public_gateway_all_params.
+ def test_create_share_all_params_with_retries(self):
+ # Enable retries and run test_create_share_all_params.
_service.enable_retries()
- self.test_create_public_gateway_all_params()
+ self.test_create_share_all_params()
- # Disable retries and run test_create_public_gateway_all_params.
+ # Disable retries and run test_create_share_all_params.
_service.disable_retries()
- self.test_create_public_gateway_all_params()
+ self.test_create_share_all_params()
@responses.activate
- def test_create_public_gateway_value_error(self):
+ def test_create_share_value_error(self):
"""
- test_create_public_gateway_value_error()
+ test_create_share_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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -37158,100 +37060,216 @@ def test_create_public_gateway_value_error(self):
status=201,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
+ share_mount_target_virtual_network_interface_prototype_model = {}
+ share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
+ share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
+ share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
+ share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
+ share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
+ share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
+ share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
+ share_mount_target_prototype_model = {}
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
+ share_mount_target_prototype_model['name'] = 'my-share-mount-target'
+ share_mount_target_prototype_model['transit_encryption'] = 'none'
+ share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
+
+ # Construct a dict representation of a ShareProfileIdentityByName model
+ share_profile_identity_model = {}
+ share_profile_identity_model['name'] = 'tier-3iops'
# 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'] = 'r006-f45e0d90-12a8-4460-8210-290ff2ab75cd'
+ # Construct a dict representation of a SharePrototypeShareContext model
+ share_prototype_share_context_model = {}
+ share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_prototype_share_context_model['iops'] = 100
+ share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
+ share_prototype_share_context_model['name'] = 'my-share'
+ share_prototype_share_context_model['profile'] = share_profile_identity_model
+ share_prototype_share_context_model['replication_cron_spec'] = '0 */5 * * *'
+ share_prototype_share_context_model['resource_group'] = resource_group_identity_model
+ share_prototype_share_context_model['user_tags'] = []
+ share_prototype_share_context_model['zone'] = zone_identity_model
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
+
+ # Construct a dict representation of a ShareInitialOwner model
+ share_initial_owner_model = {}
+ share_initial_owner_model['gid'] = 50
+ share_initial_owner_model['uid'] = 50
+
+ # Construct a dict representation of a SharePrototypeShareBySize model
+ share_prototype_model = {}
+ share_prototype_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_prototype_model['mount_targets'] = [share_mount_target_prototype_model]
+ share_prototype_model['name'] = 'my-share'
+ share_prototype_model['replica_share'] = share_prototype_share_context_model
+ share_prototype_model['user_tags'] = []
+ share_prototype_model['access_control_mode'] = 'security_group'
+ share_prototype_model['allowed_access_protocols'] = ['nfs4']
+ share_prototype_model['bandwidth'] = 100
+ share_prototype_model['encryption_key'] = encryption_key_identity_model
+ share_prototype_model['initial_owner'] = share_initial_owner_model
+ share_prototype_model['iops'] = 100
+ share_prototype_model['profile'] = share_profile_identity_model
+ share_prototype_model['resource_group'] = resource_group_identity_model
+ share_prototype_model['size'] = 200
+ share_prototype_model['zone'] = zone_identity_model
# 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
+ share_prototype = share_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc": vpc,
- "zone": zone,
+ "share_prototype": share_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_share(**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_share_value_error_with_retries(self):
+ # Enable retries and run test_create_share_value_error.
_service.enable_retries()
- self.test_create_public_gateway_value_error()
+ self.test_create_share_value_error()
- # Disable retries and run test_create_public_gateway_value_error.
+ # Disable retries and run test_create_share_value_error.
_service.disable_retries()
- self.test_create_public_gateway_value_error()
+ self.test_create_share_value_error()
-class TestDeletePublicGateway:
+class TestDeleteShare:
"""
- Test Class for delete_public_gateway
+ Test Class for delete_share
"""
@responses.activate
- def test_delete_public_gateway_all_params(self):
+ def test_delete_share_all_params(self):
"""
- delete_public_gateway()
+ delete_share()
"""
# Set up mock
- url = preprocess_url('/public_gateways/testString')
+ url = preprocess_url('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
responses.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# Set up parameter values
id = 'testString'
+ if_match = 'W/96d225c4-56bd-43d9-98fc-d7148e5c5028'
# Invoke method
- response = _service.delete_public_gateway(
+ response = _service.delete_share(
id,
+ if_match=if_match,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 202
- def test_delete_public_gateway_all_params_with_retries(self):
- # Enable retries and run test_delete_public_gateway_all_params.
+ def test_delete_share_all_params_with_retries(self):
+ # Enable retries and run test_delete_share_all_params.
_service.enable_retries()
- self.test_delete_public_gateway_all_params()
+ self.test_delete_share_all_params()
- # Disable retries and run test_delete_public_gateway_all_params.
+ # Disable retries and run test_delete_share_all_params.
_service.disable_retries()
- self.test_delete_public_gateway_all_params()
+ self.test_delete_share_all_params()
@responses.activate
- def test_delete_public_gateway_value_error(self):
+ def test_delete_share_required_params(self):
"""
- test_delete_public_gateway_value_error()
+ test_delete_share_required_params()
"""
# Set up mock
- url = preprocess_url('/public_gateways/testString')
+ url = preprocess_url('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
responses.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_share(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_share_required_params_with_retries(self):
+ # Enable retries and run test_delete_share_required_params.
+ _service.enable_retries()
+ self.test_delete_share_required_params()
+
+ # Disable retries and run test_delete_share_required_params.
+ _service.disable_retries()
+ self.test_delete_share_required_params()
+
+ @responses.activate
+ def test_delete_share_value_error(self):
+ """
+ test_delete_share_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ responses.add(
+ responses.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# Set up parameter values
@@ -37264,31 +37282,31 @@ def test_delete_public_gateway_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_public_gateway(**req_copy)
+ _service.delete_share(**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_share_value_error_with_retries(self):
+ # Enable retries and run test_delete_share_value_error.
_service.enable_retries()
- self.test_delete_public_gateway_value_error()
+ self.test_delete_share_value_error()
- # Disable retries and run test_delete_public_gateway_value_error.
+ # Disable retries and run test_delete_share_value_error.
_service.disable_retries()
- self.test_delete_public_gateway_value_error()
+ self.test_delete_share_value_error()
-class TestGetPublicGateway:
+class TestGetShare:
"""
- Test Class for get_public_gateway
+ Test Class for get_share
"""
@responses.activate
- def test_get_public_gateway_all_params(self):
+ def test_get_share_all_params(self):
"""
- get_public_gateway()
+ get_share()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -37301,7 +37319,7 @@ def test_get_public_gateway_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_public_gateway(
+ response = _service.get_share(
id,
headers={},
)
@@ -37310,23 +37328,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_share_all_params_with_retries(self):
+ # Enable retries and run test_get_share_all_params.
_service.enable_retries()
- self.test_get_public_gateway_all_params()
+ self.test_get_share_all_params()
- # Disable retries and run test_get_public_gateway_all_params.
+ # Disable retries and run test_get_share_all_params.
_service.disable_retries()
- self.test_get_public_gateway_all_params()
+ self.test_get_share_all_params()
@responses.activate
- def test_get_public_gateway_value_error(self):
+ def test_get_share_value_error(self):
"""
- test_get_public_gateway_value_error()
+ test_get_share_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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -37345,31 +37363,31 @@ def test_get_public_gateway_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_public_gateway(**req_copy)
+ _service.get_share(**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_share_value_error_with_retries(self):
+ # Enable retries and run test_get_share_value_error.
_service.enable_retries()
- self.test_get_public_gateway_value_error()
+ self.test_get_share_value_error()
- # Disable retries and run test_get_public_gateway_value_error.
+ # Disable retries and run test_get_share_value_error.
_service.disable_retries()
- self.test_get_public_gateway_value_error()
+ self.test_get_share_value_error()
-class TestUpdatePublicGateway:
+class TestUpdateShare:
"""
- Test Class for update_public_gateway
+ Test Class for update_share
"""
@responses.activate
- def test_update_public_gateway_all_params(self):
+ def test_update_share_all_params(self):
"""
- update_public_gateway()
+ update_share()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -37378,18 +37396,33 @@ def test_update_public_gateway_all_params(self):
status=200,
)
- # Construct a dict representation of a PublicGatewayPatch model
- public_gateway_patch_model = {}
- public_gateway_patch_model['name'] = 'my-public-gateway-updated'
+ # Construct a dict representation of a ShareProfileIdentityByName model
+ share_profile_identity_model = {}
+ share_profile_identity_model['name'] = 'tier-3iops'
+
+ # Construct a dict representation of a SharePatch model
+ share_patch_model = {}
+ share_patch_model['access_control_mode'] = 'security_group'
+ share_patch_model['allowed_access_protocols'] = ['nfs4']
+ share_patch_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_patch_model['bandwidth'] = 1
+ share_patch_model['iops'] = 100
+ share_patch_model['name'] = 'my-share'
+ share_patch_model['profile'] = share_profile_identity_model
+ share_patch_model['replication_cron_spec'] = '0 */5 * * *'
+ share_patch_model['size'] = 8000
+ share_patch_model['user_tags'] = ['testString']
# Set up parameter values
id = 'testString'
- public_gateway_patch = public_gateway_patch_model
+ share_patch = share_patch_model
+ if_match = 'W/96d225c4-56bd-43d9-98fc-d7148e5c5028'
# Invoke method
- response = _service.update_public_gateway(
+ response = _service.update_share(
id,
- public_gateway_patch,
+ share_patch,
+ if_match=if_match,
headers={},
)
@@ -37398,25 +37431,25 @@ 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 == share_patch
- def test_update_public_gateway_all_params_with_retries(self):
- # Enable retries and run test_update_public_gateway_all_params.
+ def test_update_share_all_params_with_retries(self):
+ # Enable retries and run test_update_share_all_params.
_service.enable_retries()
- self.test_update_public_gateway_all_params()
+ self.test_update_share_all_params()
- # Disable retries and run test_update_public_gateway_all_params.
+ # Disable retries and run test_update_share_all_params.
_service.disable_retries()
- self.test_update_public_gateway_all_params()
+ self.test_update_share_all_params()
@responses.activate
- def test_update_public_gateway_value_error(self):
+ def test_update_share_required_params(self):
"""
- test_update_public_gateway_value_error()
+ test_update_share_required_params()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
@@ -37425,104 +37458,120 @@ def test_update_public_gateway_value_error(self):
status=200,
)
- # Construct a dict representation of a PublicGatewayPatch model
- public_gateway_patch_model = {}
- public_gateway_patch_model['name'] = 'my-public-gateway-updated'
+ # Construct a dict representation of a ShareProfileIdentityByName model
+ share_profile_identity_model = {}
+ share_profile_identity_model['name'] = 'tier-3iops'
+
+ # Construct a dict representation of a SharePatch model
+ share_patch_model = {}
+ share_patch_model['access_control_mode'] = 'security_group'
+ share_patch_model['allowed_access_protocols'] = ['nfs4']
+ share_patch_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_patch_model['bandwidth'] = 1
+ share_patch_model['iops'] = 100
+ share_patch_model['name'] = 'my-share'
+ share_patch_model['profile'] = share_profile_identity_model
+ share_patch_model['replication_cron_spec'] = '0 */5 * * *'
+ share_patch_model['size'] = 8000
+ share_patch_model['user_tags'] = ['testString']
# Set up parameter values
id = 'testString'
- public_gateway_patch = public_gateway_patch_model
+ share_patch = share_patch_model
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "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_public_gateway(**req_copy)
+ # Invoke method
+ response = _service.update_share(
+ id,
+ share_patch,
+ headers={},
+ )
- def test_update_public_gateway_value_error_with_retries(self):
- # Enable retries and run test_update_public_gateway_value_error.
+ # 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 == share_patch
+
+ def test_update_share_required_params_with_retries(self):
+ # Enable retries and run test_update_share_required_params.
_service.enable_retries()
- self.test_update_public_gateway_value_error()
+ self.test_update_share_required_params()
- # Disable retries and run test_update_public_gateway_value_error.
+ # Disable retries and run test_update_share_required_params.
_service.disable_retries()
- self.test_update_public_gateway_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: PublicGateways
-##############################################################################
-
-##############################################################################
-# Start of Service: FloatingIPs
-##############################################################################
-# region
-
-
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ self.test_update_share_required_params()
- def test_new_instance(self):
+ @responses.activate
+ def test_update_share_value_error(self):
"""
- new_instance()
+ test_update_share_value_error()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
-
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up mock
+ url = preprocess_url('/shares/testString')
+ mock_response = '{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_access_protocols": ["nfs4"], "allowed_transit_encryption_modes": ["ipsec"], "availability_mode": "zonal", "bandwidth": 1, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "initial_owner": {"gid": 50, "uid": 50}, "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "cloning_in_progress", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "snapshot_count": 0, "snapshot_size": 0, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "name": "my-share-snapshot", "resource_type": "share_snapshot"}, "storage_generation": 1, "user_tags": ["user_tags"], "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,
)
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Construct a dict representation of a ShareProfileIdentityByName model
+ share_profile_identity_model = {}
+ share_profile_identity_model['name'] = 'tier-3iops'
- 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',
- )
+ # Construct a dict representation of a SharePatch model
+ share_patch_model = {}
+ share_patch_model['access_control_mode'] = 'security_group'
+ share_patch_model['allowed_access_protocols'] = ['nfs4']
+ share_patch_model['allowed_transit_encryption_modes'] = ['ipsec']
+ share_patch_model['bandwidth'] = 1
+ share_patch_model['iops'] = 100
+ share_patch_model['name'] = 'my-share'
+ share_patch_model['profile'] = share_profile_identity_model
+ share_patch_model['replication_cron_spec'] = '0 */5 * * *'
+ share_patch_model['size'] = 8000
+ share_patch_model['user_tags'] = ['testString']
- 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()
+ # Set up parameter values
+ id = 'testString'
+ share_patch = share_patch_model
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "share_patch": share_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_share(**req_copy)
- 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,
- )
+ def test_update_share_value_error_with_retries(self):
+ # Enable retries and run test_update_share_value_error.
+ _service.enable_retries()
+ self.test_update_share_value_error()
+
+ # Disable retries and run test_update_share_value_error.
+ _service.disable_retries()
+ self.test_update_share_value_error()
-class TestListFloatingIps:
+class TestListShareAccessorBindings:
"""
- Test Class for list_floating_ips
+ Test Class for list_share_accessor_bindings
"""
@responses.activate
- def test_list_floating_ips_all_params(self):
+ def test_list_share_accessor_bindings_all_params(self):
"""
- list_floating_ips()
+ list_share_accessor_bindings()
"""
# Set up mock
- url = preprocess_url('/floating_ips')
- mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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": "href"}, "total_count": 132}'
+ url = preprocess_url('/shares/testString/accessor_bindings')
+ mock_response = '{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -37532,25 +37581,15 @@ def test_list_floating_ips_all_params(self):
)
# Set up parameter values
+ id = 'testString'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
- sort = 'name'
- target_id = 'testString'
- target_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
- target_name = 'my-resource'
- target_resource_type = 'testString'
# Invoke method
- response = _service.list_floating_ips(
+ response = _service.list_share_accessor_bindings(
+ id,
start=start,
limit=limit,
- resource_group_id=resource_group_id,
- sort=sort,
- target_id=target_id,
- target_crn=target_crn,
- target_name=target_name,
- target_resource_type=target_resource_type,
headers={},
)
@@ -37562,30 +37601,24 @@ def test_list_floating_ips_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 'sort={}'.format(sort) in query_string
- assert 'target.id={}'.format(target_id) in query_string
- assert 'target.crn={}'.format(target_crn) in query_string
- assert 'target.name={}'.format(target_name) in query_string
- assert 'target.resource_type={}'.format(target_resource_type) 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_share_accessor_bindings_all_params_with_retries(self):
+ # Enable retries and run test_list_share_accessor_bindings_all_params.
_service.enable_retries()
- self.test_list_floating_ips_all_params()
+ self.test_list_share_accessor_bindings_all_params()
- # Disable retries and run test_list_floating_ips_all_params.
+ # Disable retries and run test_list_share_accessor_bindings_all_params.
_service.disable_retries()
- self.test_list_floating_ips_all_params()
+ self.test_list_share_accessor_bindings_all_params()
@responses.activate
- def test_list_floating_ips_required_params(self):
+ def test_list_share_accessor_bindings_required_params(self):
"""
- test_list_floating_ips_required_params()
+ test_list_share_accessor_bindings_required_params()
"""
# Set up mock
- url = preprocess_url('/floating_ips')
- mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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": "href"}, "total_count": 132}'
+ url = preprocess_url('/shares/testString/accessor_bindings')
+ mock_response = '{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -37594,30 +37627,36 @@ def test_list_floating_ips_required_params(self):
status=200,
)
+ # Set up parameter values
+ id = 'testString'
+
# Invoke method
- response = _service.list_floating_ips()
+ response = _service.list_share_accessor_bindings(
+ id,
+ headers={},
+ )
# 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_share_accessor_bindings_required_params_with_retries(self):
+ # Enable retries and run test_list_share_accessor_bindings_required_params.
_service.enable_retries()
- self.test_list_floating_ips_required_params()
+ self.test_list_share_accessor_bindings_required_params()
- # Disable retries and run test_list_floating_ips_required_params.
+ # Disable retries and run test_list_share_accessor_bindings_required_params.
_service.disable_retries()
- self.test_list_floating_ips_required_params()
+ self.test_list_share_accessor_bindings_required_params()
@responses.activate
- def test_list_floating_ips_value_error(self):
+ def test_list_share_accessor_bindings_value_error(self):
"""
- test_list_floating_ips_value_error()
+ test_list_share_accessor_bindings_value_error()
"""
# Set up mock
- url = preprocess_url('/floating_ips')
- mock_response = '{"first": {"href": "href"}, "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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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": "href"}, "total_count": 132}'
+ url = preprocess_url('/shares/testString/accessor_bindings')
+ mock_response = '{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -37626,32 +37665,36 @@ def test_list_floating_ips_value_error(self):
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.list_floating_ips(**req_copy)
+ _service.list_share_accessor_bindings(**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_share_accessor_bindings_value_error_with_retries(self):
+ # Enable retries and run test_list_share_accessor_bindings_value_error.
_service.enable_retries()
- self.test_list_floating_ips_value_error()
+ self.test_list_share_accessor_bindings_value_error()
- # Disable retries and run test_list_floating_ips_value_error.
+ # Disable retries and run test_list_share_accessor_bindings_value_error.
_service.disable_retries()
- self.test_list_floating_ips_value_error()
+ self.test_list_share_accessor_bindings_value_error()
@responses.activate
- def test_list_floating_ips_with_pager_get_next(self):
+ def test_list_share_accessor_bindings_with_pager_get_next(self):
"""
- test_list_floating_ips_with_pager_get_next()
+ test_list_share_accessor_bindings_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/floating_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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('/shares/testString/accessor_bindings')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -37669,15 +37712,10 @@ def test_list_floating_ips_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = FloatingIpsPager(
+ pager = ShareAccessorBindingsPager(
client=_service,
+ id='testString',
limit=10,
- resource_group_id='testString',
- sort='name',
- target_id='testString',
- target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
- target_name='my-resource',
- target_resource_type='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -37686,14 +37724,14 @@ def test_list_floating_ips_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_floating_ips_with_pager_get_all(self):
+ def test_list_share_accessor_bindings_with_pager_get_all(self):
"""
- test_list_floating_ips_with_pager_get_all()
+ test_list_share_accessor_bindings_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/floating_ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-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('/shares/testString/accessor_bindings')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r006-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -37710,145 +37748,28 @@ def test_list_floating_ips_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = FloatingIpsPager(
+ pager = ShareAccessorBindingsPager(
client=_service,
+ id='testString',
limit=10,
- resource_group_id='testString',
- sort='name',
- target_id='testString',
- target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
- target_name='my-resource',
- target_resource_type='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateFloatingIp:
- """
- Test Class for create_floating_ip
- """
-
- @responses.activate
- def test_create_floating_ip_all_params(self):
- """
- create_floating_ip()
- """
- # 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
- 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 FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
- floating_ip_target_prototype_model = {}
- floating_ip_target_prototype_model['id'] = '0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
-
- # Construct a dict representation of a FloatingIPPrototypeFloatingIPByTarget 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['target'] = floating_ip_target_prototype_model
-
- # Set up parameter values
- floating_ip_prototype = floating_ip_prototype_model
-
- # Invoke method
- response = _service.create_floating_ip(
- floating_ip_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 == floating_ip_prototype
-
- 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_floating_ip_all_params()
-
- # Disable retries and run test_create_floating_ip_all_params.
- _service.disable_retries()
- self.test_create_floating_ip_all_params()
-
- @responses.activate
- def test_create_floating_ip_value_error(self):
- """
- test_create_floating_ip_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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,
- 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 FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
- floating_ip_target_prototype_model = {}
- floating_ip_target_prototype_model['id'] = '0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
-
- # Construct a dict representation of a FloatingIPPrototypeFloatingIPByTarget 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['target'] = floating_ip_target_prototype_model
-
- # Set up parameter values
- floating_ip_prototype = floating_ip_prototype_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "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_floating_ip(**req_copy)
-
- 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_floating_ip_value_error()
-
- # Disable retries and run test_create_floating_ip_value_error.
- _service.disable_retries()
- self.test_create_floating_ip_value_error()
-
-
-class TestDeleteFloatingIp:
+class TestDeleteShareAccessorBinding:
"""
- Test Class for delete_floating_ip
+ Test Class for delete_share_accessor_binding
"""
@responses.activate
- def test_delete_floating_ip_all_params(self):
+ def test_delete_share_accessor_binding_all_params(self):
"""
- delete_floating_ip()
+ delete_share_accessor_binding()
"""
# Set up mock
- url = preprocess_url('/floating_ips/testString')
+ url = preprocess_url('/shares/testString/accessor_bindings/testString')
responses.add(
responses.DELETE,
url,
@@ -37856,10 +37777,12 @@ def test_delete_floating_ip_all_params(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_floating_ip(
+ response = _service.delete_share_accessor_binding(
+ share_id,
id,
headers={},
)
@@ -37868,22 +37791,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_share_accessor_binding_all_params_with_retries(self):
+ # Enable retries and run test_delete_share_accessor_binding_all_params.
_service.enable_retries()
- self.test_delete_floating_ip_all_params()
+ self.test_delete_share_accessor_binding_all_params()
- # Disable retries and run test_delete_floating_ip_all_params.
+ # Disable retries and run test_delete_share_accessor_binding_all_params.
_service.disable_retries()
- self.test_delete_floating_ip_all_params()
+ self.test_delete_share_accessor_binding_all_params()
@responses.activate
- def test_delete_floating_ip_value_error(self):
+ def test_delete_share_accessor_binding_value_error(self):
"""
- test_delete_floating_ip_value_error()
+ test_delete_share_accessor_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/floating_ips/testString')
+ url = preprocess_url('/shares/testString/accessor_bindings/testString')
responses.add(
responses.DELETE,
url,
@@ -37891,40 +37814,42 @@ def test_delete_floating_ip_value_error(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_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_floating_ip(**req_copy)
+ _service.delete_share_accessor_binding(**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_share_accessor_binding_value_error_with_retries(self):
+ # Enable retries and run test_delete_share_accessor_binding_value_error.
_service.enable_retries()
- self.test_delete_floating_ip_value_error()
+ self.test_delete_share_accessor_binding_value_error()
- # Disable retries and run test_delete_floating_ip_value_error.
+ # Disable retries and run test_delete_share_accessor_binding_value_error.
_service.disable_retries()
- self.test_delete_floating_ip_value_error()
+ self.test_delete_share_accessor_binding_value_error()
-class TestGetFloatingIp:
+class TestGetShareAccessorBinding:
"""
- Test Class for get_floating_ip
+ Test Class for get_share_accessor_binding
"""
@responses.activate
- def test_get_floating_ip_all_params(self):
+ def test_get_share_accessor_binding_all_params(self):
"""
- get_floating_ip()
+ get_share_accessor_binding()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/shares/testString/accessor_bindings/testString')
+ mock_response = '{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}'
responses.add(
responses.GET,
url,
@@ -37934,10 +37859,12 @@ def test_get_floating_ip_all_params(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_floating_ip(
+ response = _service.get_share_accessor_binding(
+ share_id,
id,
headers={},
)
@@ -37946,23 +37873,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_share_accessor_binding_all_params_with_retries(self):
+ # Enable retries and run test_get_share_accessor_binding_all_params.
_service.enable_retries()
- self.test_get_floating_ip_all_params()
+ self.test_get_share_accessor_binding_all_params()
- # Disable retries and run test_get_floating_ip_all_params.
+ # Disable retries and run test_get_share_accessor_binding_all_params.
_service.disable_retries()
- self.test_get_floating_ip_all_params()
+ self.test_get_share_accessor_binding_all_params()
@responses.activate
- def test_get_floating_ip_value_error(self):
+ def test_get_share_accessor_binding_value_error(self):
"""
- test_get_floating_ip_value_error()
+ test_get_share_accessor_binding_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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/shares/testString/accessor_bindings/testString')
+ mock_response = '{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r006-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r006-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}'
responses.add(
responses.GET,
url,
@@ -37972,203 +37899,160 @@ def test_get_floating_ip_value_error(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_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_floating_ip(**req_copy)
+ _service.get_share_accessor_binding(**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_share_accessor_binding_value_error_with_retries(self):
+ # Enable retries and run test_get_share_accessor_binding_value_error.
_service.enable_retries()
- self.test_get_floating_ip_value_error()
+ self.test_get_share_accessor_binding_value_error()
- # Disable retries and run test_get_floating_ip_value_error.
+ # Disable retries and run test_get_share_accessor_binding_value_error.
_service.disable_retries()
- self.test_get_floating_ip_value_error()
+ self.test_get_share_accessor_binding_value_error()
-class TestUpdateFloatingIp:
+class TestFailoverShare:
"""
- Test Class for update_floating_ip
+ Test Class for failover_share
"""
@responses.activate
- def test_update_floating_ip_all_params(self):
+ def test_failover_share_all_params(self):
"""
- update_floating_ip()
+ failover_share()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/shares/testString/failover')
responses.add(
- responses.PATCH,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Construct a dict representation of a FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
- floating_ip_target_patch_model = {}
- floating_ip_target_patch_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
-
- # 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'
- floating_ip_patch = floating_ip_patch_model
+ share_id = 'testString'
+ fallback_policy = 'fail'
+ timeout = 600
# Invoke method
- response = _service.update_floating_ip(
- id,
- floating_ip_patch,
+ response = _service.failover_share(
+ share_id,
+ fallback_policy=fallback_policy,
+ timeout=timeout,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 202
# Validate body params
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body == floating_ip_patch
+ assert req_body['fallback_policy'] == 'fail'
+ assert req_body['timeout'] == 600
- def test_update_floating_ip_all_params_with_retries(self):
- # Enable retries and run test_update_floating_ip_all_params.
+ def test_failover_share_all_params_with_retries(self):
+ # Enable retries and run test_failover_share_all_params.
_service.enable_retries()
- self.test_update_floating_ip_all_params()
+ self.test_failover_share_all_params()
- # Disable retries and run test_update_floating_ip_all_params.
+ # Disable retries and run test_failover_share_all_params.
_service.disable_retries()
- self.test_update_floating_ip_all_params()
+ self.test_failover_share_all_params()
@responses.activate
- def test_update_floating_ip_value_error(self):
+ def test_failover_share_required_params(self):
"""
- test_update_floating_ip_value_error()
+ test_failover_share_required_params()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "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/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-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('/shares/testString/failover')
responses.add(
- responses.PATCH,
+ responses.POST,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Construct a dict representation of a FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityById model
- floating_ip_target_patch_model = {}
- floating_ip_target_patch_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
-
- # 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'
- floating_ip_patch = floating_ip_patch_model
+ share_id = 'testString'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "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_floating_ip(**req_copy)
+ # Invoke method
+ response = _service.failover_share(
+ share_id,
+ headers={},
+ )
- def test_update_floating_ip_value_error_with_retries(self):
- # Enable retries and run test_update_floating_ip_value_error.
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_failover_share_required_params_with_retries(self):
+ # Enable retries and run test_failover_share_required_params.
_service.enable_retries()
- self.test_update_floating_ip_value_error()
+ self.test_failover_share_required_params()
- # Disable retries and run test_update_floating_ip_value_error.
+ # Disable retries and run test_failover_share_required_params.
_service.disable_retries()
- self.test_update_floating_ip_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: FloatingIPs
-##############################################################################
-
-##############################################################################
-# Start of Service: PublicAddressRanges
-##############################################################################
-# region
-
-
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ self.test_failover_share_required_params()
- def test_new_instance(self):
+ @responses.activate
+ def test_failover_share_value_error(self):
"""
- new_instance()
+ test_failover_share_value_error()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
-
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up mock
+ url = preprocess_url('/shares/testString/failover')
+ responses.add(
+ responses.POST,
+ url,
+ status=202,
)
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Set up parameter values
+ share_id = 'testString'
- 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',
- )
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "share_id": share_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.failover_share(**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_failover_share_value_error_with_retries(self):
+ # Enable retries and run test_failover_share_value_error.
+ _service.enable_retries()
+ self.test_failover_share_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,
- )
+ # Disable retries and run test_failover_share_value_error.
+ _service.disable_retries()
+ self.test_failover_share_value_error()
-class TestListPublicAddressRanges:
+class TestListShareMountTargets:
"""
- Test Class for list_public_address_ranges
+ Test Class for list_share_mount_targets
"""
@responses.activate
- def test_list_public_address_ranges_all_params(self):
+ def test_list_share_mount_targets_all_params(self):
"""
- list_public_address_ranges()
+ list_share_mount_targets()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_address_ranges": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -38178,15 +38062,17 @@ def test_list_public_address_ranges_all_params(self):
)
# Set up parameter values
+ share_id = 'testString'
+ name = 'my-name'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
# Invoke method
- response = _service.list_public_address_ranges(
+ response = _service.list_share_mount_targets(
+ share_id,
+ name=name,
start=start,
limit=limit,
- resource_group_id=resource_group_id,
headers={},
)
@@ -38196,27 +38082,27 @@ def test_list_public_address_ranges_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
- def test_list_public_address_ranges_all_params_with_retries(self):
- # Enable retries and run test_list_public_address_ranges_all_params.
+ def test_list_share_mount_targets_all_params_with_retries(self):
+ # Enable retries and run test_list_share_mount_targets_all_params.
_service.enable_retries()
- self.test_list_public_address_ranges_all_params()
+ self.test_list_share_mount_targets_all_params()
- # Disable retries and run test_list_public_address_ranges_all_params.
+ # Disable retries and run test_list_share_mount_targets_all_params.
_service.disable_retries()
- self.test_list_public_address_ranges_all_params()
+ self.test_list_share_mount_targets_all_params()
@responses.activate
- def test_list_public_address_ranges_required_params(self):
+ def test_list_share_mount_targets_required_params(self):
"""
- test_list_public_address_ranges_required_params()
+ test_list_share_mount_targets_required_params()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_address_ranges": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -38225,30 +38111,36 @@ def test_list_public_address_ranges_required_params(self):
status=200,
)
+ # Set up parameter values
+ share_id = 'testString'
+
# Invoke method
- response = _service.list_public_address_ranges()
+ response = _service.list_share_mount_targets(
+ share_id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_public_address_ranges_required_params_with_retries(self):
- # Enable retries and run test_list_public_address_ranges_required_params.
+ def test_list_share_mount_targets_required_params_with_retries(self):
+ # Enable retries and run test_list_share_mount_targets_required_params.
_service.enable_retries()
- self.test_list_public_address_ranges_required_params()
+ self.test_list_share_mount_targets_required_params()
- # Disable retries and run test_list_public_address_ranges_required_params.
+ # Disable retries and run test_list_share_mount_targets_required_params.
_service.disable_retries()
- self.test_list_public_address_ranges_required_params()
+ self.test_list_share_mount_targets_required_params()
@responses.activate
- def test_list_public_address_ranges_value_error(self):
+ def test_list_share_mount_targets_value_error(self):
"""
- test_list_public_address_ranges_value_error()
+ test_list_share_mount_targets_value_error()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "public_address_ranges": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -38257,32 +38149,36 @@ def test_list_public_address_ranges_value_error(self):
status=200,
)
+ # Set up parameter values
+ share_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_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_address_ranges(**req_copy)
+ _service.list_share_mount_targets(**req_copy)
- def test_list_public_address_ranges_value_error_with_retries(self):
- # Enable retries and run test_list_public_address_ranges_value_error.
+ def test_list_share_mount_targets_value_error_with_retries(self):
+ # Enable retries and run test_list_share_mount_targets_value_error.
_service.enable_retries()
- self.test_list_public_address_ranges_value_error()
+ self.test_list_share_mount_targets_value_error()
- # Disable retries and run test_list_public_address_ranges_value_error.
+ # Disable retries and run test_list_share_mount_targets_value_error.
_service.disable_retries()
- self.test_list_public_address_ranges_value_error()
+ self.test_list_share_mount_targets_value_error()
@responses.activate
- def test_list_public_address_ranges_with_pager_get_next(self):
+ def test_list_share_mount_targets_with_pager_get_next(self):
"""
- test_list_public_address_ranges_with_pager_get_next()
+ test_list_share_mount_targets_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/public_address_ranges')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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('/shares/testString/mount_targets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","access_protocol":"nfs4","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","access_protocol":"nfs4","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -38300,10 +38196,11 @@ def test_list_public_address_ranges_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = PublicAddressRangesPager(
+ pager = ShareMountTargetsPager(
client=_service,
+ share_id='testString',
+ name='my-name',
limit=10,
- resource_group_id='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -38312,14 +38209,14 @@ def test_list_public_address_ranges_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_public_address_ranges_with_pager_get_all(self):
+ def test_list_share_mount_targets_with_pager_get_all(self):
"""
- test_list_public_address_ranges_with_pager_get_all()
+ test_list_share_mount_targets_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/public_address_ranges')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"public_address_ranges":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","ipv4_address_count":8,"lifecycle_state":"stable","name":"my-public-address-range","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_address_range","target":{"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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('/shares/testString/mount_targets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","access_protocol":"nfs4","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","access_protocol":"nfs4","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -38336,29 +38233,30 @@ def test_list_public_address_ranges_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = PublicAddressRangesPager(
+ pager = ShareMountTargetsPager(
client=_service,
+ share_id='testString',
+ name='my-name',
limit=10,
- resource_group_id='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreatePublicAddressRange:
+class TestCreateShareMountTarget:
"""
- Test Class for create_public_address_range
+ Test Class for create_share_mount_target
"""
@responses.activate
- def test_create_public_address_range_all_params(self):
+ def test_create_share_mount_target_all_params(self):
"""
- create_public_address_range()
+ create_share_mount_target()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -38367,35 +38265,58 @@ def test_create_public_address_range_all_params(self):
status=201,
)
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
# 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'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- # Construct a dict representation of a PublicAddressRangeTargetPrototype model
- public_address_range_target_prototype_model = {}
- public_address_range_target_prototype_model['vpc'] = vpc_identity_model
- public_address_range_target_prototype_model['zone'] = zone_identity_model
+ # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
+ share_mount_target_virtual_network_interface_prototype_model = {}
+ share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
+ share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
+ share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
+ share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
+ share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
+ share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
+ share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
+ share_mount_target_prototype_model = {}
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
+ share_mount_target_prototype_model['name'] = 'my-share-mount-target'
+ share_mount_target_prototype_model['transit_encryption'] = 'none'
+ share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
# Set up parameter values
- ipv4_address_count = 8
- name = 'my-public-address-range'
- resource_group = resource_group_identity_model
- target = public_address_range_target_prototype_model
+ share_id = 'testString'
+ share_mount_target_prototype = share_mount_target_prototype_model
# Invoke method
- response = _service.create_public_address_range(
- ipv4_address_count,
- name=name,
- resource_group=resource_group,
- target=target,
+ response = _service.create_share_mount_target(
+ share_id,
+ share_mount_target_prototype,
headers={},
)
@@ -38404,28 +38325,25 @@ def test_create_public_address_range_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['ipv4_address_count'] == 8
- assert req_body['name'] == 'my-public-address-range'
- assert req_body['resource_group'] == resource_group_identity_model
- assert req_body['target'] == public_address_range_target_prototype_model
+ assert req_body == share_mount_target_prototype
- def test_create_public_address_range_all_params_with_retries(self):
- # Enable retries and run test_create_public_address_range_all_params.
+ def test_create_share_mount_target_all_params_with_retries(self):
+ # Enable retries and run test_create_share_mount_target_all_params.
_service.enable_retries()
- self.test_create_public_address_range_all_params()
+ self.test_create_share_mount_target_all_params()
- # Disable retries and run test_create_public_address_range_all_params.
+ # Disable retries and run test_create_share_mount_target_all_params.
_service.disable_retries()
- self.test_create_public_address_range_all_params()
+ self.test_create_share_mount_target_all_params()
@responses.activate
- def test_create_public_address_range_value_error(self):
+ def test_create_share_mount_target_value_error(self):
"""
- test_create_public_address_range_value_error()
+ test_create_share_mount_target_value_error()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.POST,
url,
@@ -38434,61 +38352,87 @@ def test_create_public_address_range_value_error(self):
status=201,
)
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
# 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'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a SecurityGroupIdentityById model
+ security_group_identity_model = {}
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
- # Construct a dict representation of a ZoneIdentityByName model
- zone_identity_model = {}
- zone_identity_model['name'] = 'us-south-1'
+ # Construct a dict representation of a SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- # Construct a dict representation of a PublicAddressRangeTargetPrototype model
- public_address_range_target_prototype_model = {}
- public_address_range_target_prototype_model['vpc'] = vpc_identity_model
- public_address_range_target_prototype_model['zone'] = zone_identity_model
+ # Construct a dict representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
+ share_mount_target_virtual_network_interface_prototype_model = {}
+ share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
+ share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
+ share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
+ share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
+ share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
+ share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
+ share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a dict representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
+ share_mount_target_prototype_model = {}
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
+ share_mount_target_prototype_model['name'] = 'my-share-mount-target'
+ share_mount_target_prototype_model['transit_encryption'] = 'none'
+ share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
# Set up parameter values
- ipv4_address_count = 8
- name = 'my-public-address-range'
- resource_group = resource_group_identity_model
- target = public_address_range_target_prototype_model
+ share_id = 'testString'
+ share_mount_target_prototype = share_mount_target_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "ipv4_address_count": ipv4_address_count,
+ "share_id": share_id,
+ "share_mount_target_prototype": share_mount_target_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_address_range(**req_copy)
+ _service.create_share_mount_target(**req_copy)
- def test_create_public_address_range_value_error_with_retries(self):
- # Enable retries and run test_create_public_address_range_value_error.
+ def test_create_share_mount_target_value_error_with_retries(self):
+ # Enable retries and run test_create_share_mount_target_value_error.
_service.enable_retries()
- self.test_create_public_address_range_value_error()
+ self.test_create_share_mount_target_value_error()
- # Disable retries and run test_create_public_address_range_value_error.
+ # Disable retries and run test_create_share_mount_target_value_error.
_service.disable_retries()
- self.test_create_public_address_range_value_error()
+ self.test_create_share_mount_target_value_error()
-class TestDeletePublicAddressRange:
+class TestDeleteShareMountTarget:
"""
- Test Class for delete_public_address_range
+ Test Class for delete_share_mount_target
"""
@responses.activate
- def test_delete_public_address_range_all_params(self):
+ def test_delete_share_mount_target_all_params(self):
"""
- delete_public_address_range()
+ delete_share_mount_target()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets/testString')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.DELETE,
url,
@@ -38498,10 +38442,12 @@ def test_delete_public_address_range_all_params(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_public_address_range(
+ response = _service.delete_share_mount_target(
+ share_id,
id,
headers={},
)
@@ -38510,23 +38456,23 @@ def test_delete_public_address_range_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 202
- def test_delete_public_address_range_all_params_with_retries(self):
- # Enable retries and run test_delete_public_address_range_all_params.
+ def test_delete_share_mount_target_all_params_with_retries(self):
+ # Enable retries and run test_delete_share_mount_target_all_params.
_service.enable_retries()
- self.test_delete_public_address_range_all_params()
+ self.test_delete_share_mount_target_all_params()
- # Disable retries and run test_delete_public_address_range_all_params.
+ # Disable retries and run test_delete_share_mount_target_all_params.
_service.disable_retries()
- self.test_delete_public_address_range_all_params()
+ self.test_delete_share_mount_target_all_params()
@responses.activate
- def test_delete_public_address_range_value_error(self):
+ def test_delete_share_mount_target_value_error(self):
"""
- test_delete_public_address_range_value_error()
+ test_delete_share_mount_target_value_error()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets/testString')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.DELETE,
url,
@@ -38536,40 +38482,42 @@ def test_delete_public_address_range_value_error(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_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_address_range(**req_copy)
+ _service.delete_share_mount_target(**req_copy)
- def test_delete_public_address_range_value_error_with_retries(self):
- # Enable retries and run test_delete_public_address_range_value_error.
+ def test_delete_share_mount_target_value_error_with_retries(self):
+ # Enable retries and run test_delete_share_mount_target_value_error.
_service.enable_retries()
- self.test_delete_public_address_range_value_error()
+ self.test_delete_share_mount_target_value_error()
- # Disable retries and run test_delete_public_address_range_value_error.
+ # Disable retries and run test_delete_share_mount_target_value_error.
_service.disable_retries()
- self.test_delete_public_address_range_value_error()
+ self.test_delete_share_mount_target_value_error()
-class TestGetPublicAddressRange:
+class TestGetShareMountTarget:
"""
- Test Class for get_public_address_range
+ Test Class for get_share_mount_target
"""
@responses.activate
- def test_get_public_address_range_all_params(self):
+ def test_get_share_mount_target_all_params(self):
"""
- get_public_address_range()
+ get_share_mount_target()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets/testString')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -38579,10 +38527,12 @@ def test_get_public_address_range_all_params(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_public_address_range(
+ response = _service.get_share_mount_target(
+ share_id,
id,
headers={},
)
@@ -38591,23 +38541,23 @@ def test_get_public_address_range_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_public_address_range_all_params_with_retries(self):
- # Enable retries and run test_get_public_address_range_all_params.
+ def test_get_share_mount_target_all_params_with_retries(self):
+ # Enable retries and run test_get_share_mount_target_all_params.
_service.enable_retries()
- self.test_get_public_address_range_all_params()
+ self.test_get_share_mount_target_all_params()
- # Disable retries and run test_get_public_address_range_all_params.
+ # Disable retries and run test_get_share_mount_target_all_params.
_service.disable_retries()
- self.test_get_public_address_range_all_params()
+ self.test_get_share_mount_target_all_params()
@responses.activate
- def test_get_public_address_range_value_error(self):
+ def test_get_share_mount_target_value_error(self):
"""
- test_get_public_address_range_value_error()
+ test_get_share_mount_target_value_error()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets/testString')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
@@ -38617,40 +38567,42 @@ def test_get_public_address_range_value_error(self):
)
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_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_address_range(**req_copy)
+ _service.get_share_mount_target(**req_copy)
- def test_get_public_address_range_value_error_with_retries(self):
- # Enable retries and run test_get_public_address_range_value_error.
+ def test_get_share_mount_target_value_error_with_retries(self):
+ # Enable retries and run test_get_share_mount_target_value_error.
_service.enable_retries()
- self.test_get_public_address_range_value_error()
+ self.test_get_share_mount_target_value_error()
- # Disable retries and run test_get_public_address_range_value_error.
+ # Disable retries and run test_get_share_mount_target_value_error.
_service.disable_retries()
- self.test_get_public_address_range_value_error()
+ self.test_get_share_mount_target_value_error()
-class TestUpdatePublicAddressRange:
+class TestUpdateShareMountTarget:
"""
- Test Class for update_public_address_range
+ Test Class for update_share_mount_target
"""
@responses.activate
- def test_update_public_address_range_all_params(self):
+ def test_update_share_mount_target_all_params(self):
"""
- update_public_address_range()
+ update_share_mount_target()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets/testString')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.PATCH,
url,
@@ -38659,32 +38611,20 @@ def test_update_public_address_range_all_params(self):
status=200,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-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 PublicAddressRangeTargetPatch model
- public_address_range_target_patch_model = {}
- public_address_range_target_patch_model['vpc'] = vpc_identity_model
- public_address_range_target_patch_model['zone'] = zone_identity_model
-
- # Construct a dict representation of a PublicAddressRangePatch model
- public_address_range_patch_model = {}
- public_address_range_patch_model['name'] = 'my-public-address-range-updated'
- public_address_range_patch_model['target'] = public_address_range_target_patch_model
+ # Construct a dict representation of a ShareMountTargetPatch model
+ share_mount_target_patch_model = {}
+ share_mount_target_patch_model['name'] = 'my-share-mount-target'
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
- public_address_range_patch = public_address_range_patch_model
+ share_mount_target_patch = share_mount_target_patch_model
# Invoke method
- response = _service.update_public_address_range(
+ response = _service.update_share_mount_target(
+ share_id,
id,
- public_address_range_patch,
+ share_mount_target_patch,
headers={},
)
@@ -38693,145 +38633,76 @@ def test_update_public_address_range_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_address_range_patch
+ assert req_body == share_mount_target_patch
- def test_update_public_address_range_all_params_with_retries(self):
- # Enable retries and run test_update_public_address_range_all_params.
+ def test_update_share_mount_target_all_params_with_retries(self):
+ # Enable retries and run test_update_share_mount_target_all_params.
_service.enable_retries()
- self.test_update_public_address_range_all_params()
+ self.test_update_share_mount_target_all_params()
- # Disable retries and run test_update_public_address_range_all_params.
+ # Disable retries and run test_update_share_mount_target_all_params.
_service.disable_retries()
- self.test_update_public_address_range_all_params()
+ self.test_update_share_mount_target_all_params()
@responses.activate
- def test_update_public_address_range_value_error(self):
+ def test_update_share_mount_target_value_error(self):
"""
- test_update_public_address_range_value_error()
+ test_update_share_mount_target_value_error()
"""
# Set up mock
- url = preprocess_url('/public_address_ranges/testString')
- mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "ipv4_address_count": 8, "lifecycle_state": "stable", "name": "my-public-address-range", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_address_range", "target": {"vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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('/shares/testString/mount_targets/testString')
+ mock_response = '{"access_control_mode": "security_group", "access_protocol": "nfs4", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-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 PublicAddressRangeTargetPatch model
- public_address_range_target_patch_model = {}
- public_address_range_target_patch_model['vpc'] = vpc_identity_model
- public_address_range_target_patch_model['zone'] = zone_identity_model
-
- # Construct a dict representation of a PublicAddressRangePatch model
- public_address_range_patch_model = {}
- public_address_range_patch_model['name'] = 'my-public-address-range-updated'
- public_address_range_patch_model['target'] = public_address_range_target_patch_model
-
- # Set up parameter values
- id = 'testString'
- public_address_range_patch = public_address_range_patch_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "id": id,
- "public_address_range_patch": public_address_range_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_address_range(**req_copy)
-
- def test_update_public_address_range_value_error_with_retries(self):
- # Enable retries and run test_update_public_address_range_value_error.
- _service.enable_retries()
- self.test_update_public_address_range_value_error()
-
- # Disable retries and run test_update_public_address_range_value_error.
- _service.disable_retries()
- self.test_update_public_address_range_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: PublicAddressRanges
-##############################################################################
-
-##############################################################################
-# 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',
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Construct a dict representation of a ShareMountTargetPatch model
+ share_mount_target_patch_model = {}
+ share_mount_target_patch_model['name'] = 'my-share-mount-target'
- 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',
- )
+ # Set up parameter values
+ share_id = 'testString'
+ id = 'testString'
+ share_mount_target_patch = share_mount_target_patch_model
- 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()
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "share_id": share_id,
+ "id": id,
+ "share_mount_target_patch": share_mount_target_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_share_mount_target(**req_copy)
- 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,
- )
+ def test_update_share_mount_target_value_error_with_retries(self):
+ # Enable retries and run test_update_share_mount_target_value_error.
+ _service.enable_retries()
+ self.test_update_share_mount_target_value_error()
+
+ # Disable retries and run test_update_share_mount_target_value_error.
+ _service.disable_retries()
+ self.test_update_share_mount_target_value_error()
-class TestListNetworkAcls:
+class TestListShareSnapshots:
"""
- Test Class for list_network_acls
+ Test Class for list_share_snapshots
"""
@responses.activate
- def test_list_network_acls_all_params(self):
+ def test_list_share_snapshots_all_params(self):
"""
- list_network_acls()
+ list_share_snapshots()
"""
# Set up mock
- url = preprocess_url('/network_acls')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/shares/testString/snapshots')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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,
@@ -38841,15 +38712,21 @@ def test_list_network_acls_all_params(self):
)
# Set up parameter values
+ share_id = 'testString'
+ backup_policy_plan_id = 'testString'
+ name = 'my-name'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
+ sort = 'name'
# Invoke method
- response = _service.list_network_acls(
+ response = _service.list_share_snapshots(
+ share_id,
+ backup_policy_plan_id=backup_policy_plan_id,
+ name=name,
start=start,
limit=limit,
- resource_group_id=resource_group_id,
+ sort=sort,
headers={},
)
@@ -38859,27 +38736,29 @@ def test_list_network_acls_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 'backup_policy_plan.id={}'.format(backup_policy_plan_id) in 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 'sort={}'.format(sort) in query_string
- def test_list_network_acls_all_params_with_retries(self):
- # Enable retries and run test_list_network_acls_all_params.
+ def test_list_share_snapshots_all_params_with_retries(self):
+ # Enable retries and run test_list_share_snapshots_all_params.
_service.enable_retries()
- self.test_list_network_acls_all_params()
+ self.test_list_share_snapshots_all_params()
- # Disable retries and run test_list_network_acls_all_params.
+ # Disable retries and run test_list_share_snapshots_all_params.
_service.disable_retries()
- self.test_list_network_acls_all_params()
+ self.test_list_share_snapshots_all_params()
@responses.activate
- def test_list_network_acls_required_params(self):
+ def test_list_share_snapshots_required_params(self):
"""
- test_list_network_acls_required_params()
+ test_list_share_snapshots_required_params()
"""
# Set up mock
- url = preprocess_url('/network_acls')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/shares/testString/snapshots')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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,
@@ -38888,30 +38767,36 @@ def test_list_network_acls_required_params(self):
status=200,
)
+ # Set up parameter values
+ share_id = 'testString'
+
# Invoke method
- response = _service.list_network_acls()
+ response = _service.list_share_snapshots(
+ share_id,
+ headers={},
+ )
# 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_share_snapshots_required_params_with_retries(self):
+ # Enable retries and run test_list_share_snapshots_required_params.
_service.enable_retries()
- self.test_list_network_acls_required_params()
+ self.test_list_share_snapshots_required_params()
- # Disable retries and run test_list_network_acls_required_params.
+ # Disable retries and run test_list_share_snapshots_required_params.
_service.disable_retries()
- self.test_list_network_acls_required_params()
+ self.test_list_share_snapshots_required_params()
@responses.activate
- def test_list_network_acls_value_error(self):
+ def test_list_share_snapshots_value_error(self):
"""
- test_list_network_acls_value_error()
+ test_list_share_snapshots_value_error()
"""
# Set up mock
- url = preprocess_url('/network_acls')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/shares/testString/snapshots')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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,
@@ -38920,32 +38805,36 @@ def test_list_network_acls_value_error(self):
status=200,
)
+ # Set up parameter values
+ share_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_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_share_snapshots(**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_share_snapshots_value_error_with_retries(self):
+ # Enable retries and run test_list_share_snapshots_value_error.
_service.enable_retries()
- self.test_list_network_acls_value_error()
+ self.test_list_share_snapshots_value_error()
- # Disable retries and run test_list_network_acls_value_error.
+ # Disable retries and run test_list_share_snapshots_value_error.
_service.disable_retries()
- self.test_list_network_acls_value_error()
+ self.test_list_share_snapshots_value_error()
@responses.activate
- def test_list_network_acls_with_pager_get_next(self):
+ def test_list_share_snapshots_with_pager_get_next(self):
"""
- test_list_network_acls_with_pager_get_next()
+ test_list_share_snapshots_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/network_acls')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/shares/testString/snapshots')
+ mock_response1 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -38963,10 +38852,13 @@ def test_list_network_acls_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = NetworkAclsPager(
+ pager = ShareSnapshotsPager(
client=_service,
+ share_id='testString',
+ backup_policy_plan_id='testString',
+ name='my-name',
limit=10,
- resource_group_id='testString',
+ sort='name',
)
while pager.has_next():
next_page = pager.get_next()
@@ -38975,14 +38867,14 @@ def test_list_network_acls_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_network_acls_with_pager_get_all(self):
+ def test_list_share_snapshots_with_pager_get_all(self):
"""
- test_list_network_acls_with_pager_get_all()
+ test_list_share_snapshots_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/network_acls')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/shares/testString/snapshots')
+ mock_response1 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","fingerprint":"7abc3aef-c2bc-4f65-a296-2928e534d498","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","id":"r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","minimum_size":10,"name":"my-share-snapshot","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share_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"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -38999,29 +38891,32 @@ def test_list_network_acls_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = NetworkAclsPager(
+ pager = ShareSnapshotsPager(
client=_service,
+ share_id='testString',
+ backup_policy_plan_id='testString',
+ name='my-name',
limit=10,
- resource_group_id='testString',
+ sort='name',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateNetworkAcl:
+class TestCreateShareSnapshot:
"""
- Test Class for create_network_acl
+ Test Class for create_share_snapshot
"""
@responses.activate
- def test_create_network_acl_all_params(self):
+ def test_create_share_snapshot_all_params(self):
"""
- create_network_acl()
+ create_share_snapshot()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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,
@@ -39030,37 +38925,16 @@ def test_create_network_acl_all_params(self):
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'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
- network_acl_rule_prototype_network_acl_context_model['name'] = 'my-network-acl-rule'
- network_acl_rule_prototype_network_acl_context_model['source'] = '192.168.3.2/32'
- network_acl_rule_prototype_network_acl_context_model['protocol'] = 'all'
-
- # 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
- network_acl_prototype = network_acl_prototype_model
+ share_id = 'testString'
+ name = 'my-share-snapshot'
+ user_tags = ['testString']
# Invoke method
- response = _service.create_network_acl(
- network_acl_prototype,
+ response = _service.create_share_snapshot(
+ share_id,
+ name=name,
+ user_tags=user_tags,
headers={},
)
@@ -39069,25 +38943,26 @@ 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['name'] == 'my-share-snapshot'
+ assert req_body['user_tags'] == ['testString']
- def test_create_network_acl_all_params_with_retries(self):
- # Enable retries and run test_create_network_acl_all_params.
+ def test_create_share_snapshot_all_params_with_retries(self):
+ # Enable retries and run test_create_share_snapshot_all_params.
_service.enable_retries()
- self.test_create_network_acl_all_params()
+ self.test_create_share_snapshot_all_params()
- # Disable retries and run test_create_network_acl_all_params.
+ # Disable retries and run test_create_share_snapshot_all_params.
_service.disable_retries()
- self.test_create_network_acl_all_params()
+ self.test_create_share_snapshot_all_params()
@responses.activate
- def test_create_network_acl_value_error(self):
+ def test_create_share_snapshot_value_error(self):
"""
- test_create_network_acl_value_error()
+ test_create_share_snapshot_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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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,
@@ -39096,318 +38971,580 @@ def test_create_network_acl_value_error(self):
status=201,
)
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Set up parameter values
+ share_id = 'testString'
+ name = 'my-share-snapshot'
+ user_tags = ['testString']
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "share_id": share_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_share_snapshot(**req_copy)
- # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
- network_acl_rule_prototype_network_acl_context_model['name'] = 'my-network-acl-rule'
- network_acl_rule_prototype_network_acl_context_model['source'] = '192.168.3.2/32'
- network_acl_rule_prototype_network_acl_context_model['protocol'] = 'all'
+ def test_create_share_snapshot_value_error_with_retries(self):
+ # Enable retries and run test_create_share_snapshot_value_error.
+ _service.enable_retries()
+ self.test_create_share_snapshot_value_error()
- # 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]
+ # Disable retries and run test_create_share_snapshot_value_error.
+ _service.disable_retries()
+ self.test_create_share_snapshot_value_error()
+
+
+class TestDeleteShareSnapshot:
+ """
+ Test Class for delete_share_snapshot
+ """
+
+ @responses.activate
+ def test_delete_share_snapshot_all_params(self):
+ """
+ delete_share_snapshot()
+ """
+ # Set up mock
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ responses.add(
+ responses.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
+ )
# Set up parameter values
- network_acl_prototype = network_acl_prototype_model
+ share_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_share_snapshot(
+ share_id,
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_share_snapshot_all_params_with_retries(self):
+ # Enable retries and run test_delete_share_snapshot_all_params.
+ _service.enable_retries()
+ self.test_delete_share_snapshot_all_params()
+
+ # Disable retries and run test_delete_share_snapshot_all_params.
+ _service.disable_retries()
+ self.test_delete_share_snapshot_all_params()
+
+ @responses.activate
+ def test_delete_share_snapshot_value_error(self):
+ """
+ test_delete_share_snapshot_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
+ responses.add(
+ responses.DELETE,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
+ )
+
+ # Set up parameter values
+ share_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "network_acl_prototype": network_acl_prototype,
+ "share_id": share_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_network_acl(**req_copy)
+ _service.delete_share_snapshot(**req_copy)
- def test_create_network_acl_value_error_with_retries(self):
- # Enable retries and run test_create_network_acl_value_error.
+ def test_delete_share_snapshot_value_error_with_retries(self):
+ # Enable retries and run test_delete_share_snapshot_value_error.
_service.enable_retries()
- self.test_create_network_acl_value_error()
+ self.test_delete_share_snapshot_value_error()
- # Disable retries and run test_create_network_acl_value_error.
+ # Disable retries and run test_delete_share_snapshot_value_error.
_service.disable_retries()
- self.test_create_network_acl_value_error()
+ self.test_delete_share_snapshot_value_error()
-class TestDeleteNetworkAcl:
+class TestGetShareSnapshot:
"""
- Test Class for delete_network_acl
+ Test Class for get_share_snapshot
"""
@responses.activate
- def test_delete_network_acl_all_params(self):
+ def test_get_share_snapshot_all_params(self):
"""
- delete_network_acl()
+ get_share_snapshot()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString')
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ share_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.get_share_snapshot(
+ share_id,
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_get_share_snapshot_all_params_with_retries(self):
+ # Enable retries and run test_get_share_snapshot_all_params.
+ _service.enable_retries()
+ self.test_get_share_snapshot_all_params()
+
+ # Disable retries and run test_get_share_snapshot_all_params.
+ _service.disable_retries()
+ self.test_get_share_snapshot_all_params()
+
+ @responses.activate
+ def test_get_share_snapshot_value_error(self):
+ """
+ test_get_share_snapshot_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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
+ share_id = 'testString'
+ id = 'testString'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "share_id": share_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_share_snapshot(**req_copy)
+
+ def test_get_share_snapshot_value_error_with_retries(self):
+ # Enable retries and run test_get_share_snapshot_value_error.
+ _service.enable_retries()
+ self.test_get_share_snapshot_value_error()
+
+ # Disable retries and run test_get_share_snapshot_value_error.
+ _service.disable_retries()
+ self.test_get_share_snapshot_value_error()
+
+
+class TestUpdateShareSnapshot:
+ """
+ Test Class for update_share_snapshot
+ """
+
+ @responses.activate
+ def test_update_share_snapshot_all_params(self):
+ """
+ update_share_snapshot()
+ """
+ # Set up mock
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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 ShareSnapshotPatch model
+ share_snapshot_patch_model = {}
+ share_snapshot_patch_model['name'] = 'my-share-snapshot'
+ share_snapshot_patch_model['user_tags'] = ['testString']
+
+ # Set up parameter values
+ share_id = 'testString'
+ id = 'testString'
+ share_snapshot_patch = share_snapshot_patch_model
+ if_match = 'W/96d225c4-56bd-43d9-98fc-d7148e5c5028'
+
+ # Invoke method
+ response = _service.update_share_snapshot(
+ share_id,
+ id,
+ share_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 == share_snapshot_patch
+
+ def test_update_share_snapshot_all_params_with_retries(self):
+ # Enable retries and run test_update_share_snapshot_all_params.
+ _service.enable_retries()
+ self.test_update_share_snapshot_all_params()
+
+ # Disable retries and run test_update_share_snapshot_all_params.
+ _service.disable_retries()
+ self.test_update_share_snapshot_all_params()
+
+ @responses.activate
+ def test_update_share_snapshot_required_params(self):
+ """
+ test_update_share_snapshot_required_params()
+ """
+ # Set up mock
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "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,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
+ # Construct a dict representation of a ShareSnapshotPatch model
+ share_snapshot_patch_model = {}
+ share_snapshot_patch_model['name'] = 'my-share-snapshot'
+ share_snapshot_patch_model['user_tags'] = ['testString']
+
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
+ share_snapshot_patch = share_snapshot_patch_model
# Invoke method
- response = _service.delete_network_acl(
+ response = _service.update_share_snapshot(
+ share_id,
id,
+ share_snapshot_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 == share_snapshot_patch
- def test_delete_network_acl_all_params_with_retries(self):
- # Enable retries and run test_delete_network_acl_all_params.
+ def test_update_share_snapshot_required_params_with_retries(self):
+ # Enable retries and run test_update_share_snapshot_required_params.
_service.enable_retries()
- self.test_delete_network_acl_all_params()
+ self.test_update_share_snapshot_required_params()
- # Disable retries and run test_delete_network_acl_all_params.
+ # Disable retries and run test_update_share_snapshot_required_params.
_service.disable_retries()
- self.test_delete_network_acl_all_params()
+ self.test_update_share_snapshot_required_params()
@responses.activate
- def test_delete_network_acl_value_error(self):
+ def test_update_share_snapshot_value_error(self):
"""
- test_delete_network_acl_value_error()
+ test_update_share_snapshot_value_error()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString')
+ url = preprocess_url('/shares/testString/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share-snapshot:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "fingerprint": "7abc3aef-c2bc-4f65-a296-2928e534d498", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/snapshots/r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "id": "r006-e13ee54f-baa4-40d3-b35c-b9ec163972b4", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "minimum_size": 10, "name": "my-share-snapshot", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share_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"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
- responses.DELETE,
+ responses.PATCH,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
+ # Construct a dict representation of a ShareSnapshotPatch model
+ share_snapshot_patch_model = {}
+ share_snapshot_patch_model['name'] = 'my-share-snapshot'
+ share_snapshot_patch_model['user_tags'] = ['testString']
+
# Set up parameter values
+ share_id = 'testString'
id = 'testString'
+ share_snapshot_patch = share_snapshot_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "share_id": share_id,
"id": id,
+ "share_snapshot_patch": share_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.delete_network_acl(**req_copy)
+ _service.update_share_snapshot(**req_copy)
- def test_delete_network_acl_value_error_with_retries(self):
- # Enable retries and run test_delete_network_acl_value_error.
+ def test_update_share_snapshot_value_error_with_retries(self):
+ # Enable retries and run test_update_share_snapshot_value_error.
_service.enable_retries()
- self.test_delete_network_acl_value_error()
+ self.test_update_share_snapshot_value_error()
- # Disable retries and run test_delete_network_acl_value_error.
+ # Disable retries and run test_update_share_snapshot_value_error.
_service.disable_retries()
- self.test_delete_network_acl_value_error()
+ self.test_update_share_snapshot_value_error()
-class TestGetNetworkAcl:
+class TestDeleteShareSource:
"""
- Test Class for get_network_acl
+ Test Class for delete_share_source
"""
@responses.activate
- def test_get_network_acl_all_params(self):
+ def test_delete_share_source_all_params(self):
"""
- get_network_acl()
+ delete_share_source()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/shares/testString/source')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- id = 'testString'
+ share_id = 'testString'
# Invoke method
- response = _service.get_network_acl(
- id,
+ response = _service.delete_share_source(
+ share_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 202
- def test_get_network_acl_all_params_with_retries(self):
- # Enable retries and run test_get_network_acl_all_params.
+ def test_delete_share_source_all_params_with_retries(self):
+ # Enable retries and run test_delete_share_source_all_params.
_service.enable_retries()
- self.test_get_network_acl_all_params()
+ self.test_delete_share_source_all_params()
- # Disable retries and run test_get_network_acl_all_params.
+ # Disable retries and run test_delete_share_source_all_params.
_service.disable_retries()
- self.test_get_network_acl_all_params()
+ self.test_delete_share_source_all_params()
@responses.activate
- def test_get_network_acl_value_error(self):
+ def test_delete_share_source_value_error(self):
"""
- test_get_network_acl_value_error()
+ test_delete_share_source_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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/shares/testString/source')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- id = 'testString'
+ share_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "share_id": share_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.delete_share_source(**req_copy)
- def test_get_network_acl_value_error_with_retries(self):
- # Enable retries and run test_get_network_acl_value_error.
+ def test_delete_share_source_value_error_with_retries(self):
+ # Enable retries and run test_delete_share_source_value_error.
_service.enable_retries()
- self.test_get_network_acl_value_error()
+ self.test_delete_share_source_value_error()
- # Disable retries and run test_get_network_acl_value_error.
+ # Disable retries and run test_delete_share_source_value_error.
_service.disable_retries()
- self.test_get_network_acl_value_error()
+ self.test_delete_share_source_value_error()
-class TestUpdateNetworkAcl:
+class TestGetShareSource:
"""
- Test Class for update_network_acl
+ Test Class for get_share_source
"""
@responses.activate
- def test_update_network_acl_all_params(self):
+ def test_get_share_source_all_params(self):
"""
- update_network_acl()
+ get_share_source()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/shares/testString/source')
+ mock_response = '{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}'
responses.add(
- responses.PATCH,
+ responses.GET,
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-updated'
-
# Set up parameter values
- id = 'testString'
- network_acl_patch = network_acl_patch_model
+ share_id = 'testString'
# Invoke method
- response = _service.update_network_acl(
- id,
- network_acl_patch,
+ response = _service.get_share_source(
+ share_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 == network_acl_patch
- def test_update_network_acl_all_params_with_retries(self):
- # Enable retries and run test_update_network_acl_all_params.
+ def test_get_share_source_all_params_with_retries(self):
+ # Enable retries and run test_get_share_source_all_params.
_service.enable_retries()
- self.test_update_network_acl_all_params()
+ self.test_get_share_source_all_params()
- # Disable retries and run test_update_network_acl_all_params.
+ # Disable retries and run test_get_share_source_all_params.
_service.disable_retries()
- self.test_update_network_acl_all_params()
+ self.test_get_share_source_all_params()
@responses.activate
- def test_update_network_acl_value_error(self):
+ def test_get_share_source_value_error(self):
"""
- test_update_network_acl_value_error()
+ test_get_share_source_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/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/shares/testString/source')
+ mock_response = '{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}'
responses.add(
- responses.PATCH,
+ responses.GET,
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-updated'
-
# Set up parameter values
- id = 'testString'
- network_acl_patch = network_acl_patch_model
+ share_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "network_acl_patch": network_acl_patch,
+ "share_id": share_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_network_acl(**req_copy)
+ _service.get_share_source(**req_copy)
- def test_update_network_acl_value_error_with_retries(self):
- # Enable retries and run test_update_network_acl_value_error.
+ def test_get_share_source_value_error_with_retries(self):
+ # Enable retries and run test_get_share_source_value_error.
_service.enable_retries()
- self.test_update_network_acl_value_error()
+ self.test_get_share_source_value_error()
- # Disable retries and run test_update_network_acl_value_error.
+ # Disable retries and run test_get_share_source_value_error.
_service.disable_retries()
- self.test_update_network_acl_value_error()
+ self.test_get_share_source_value_error()
-class TestListNetworkAclRules:
+# endregion
+##############################################################################
+# End of Service: Shares
+##############################################################################
+
+##############################################################################
+# Start of Service: Snapshots
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_network_acl_rules
+ 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 TestListSnapshotConsistencyGroups:
+ """
+ Test Class for list_snapshot_consistency_groups
"""
@responses.activate
- def test_list_network_acl_rules_all_params(self):
+ def test_list_snapshot_consistency_groups_all_params(self):
"""
- list_network_acl_rules()
+ list_snapshot_consistency_groups()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString/rules')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "total_count": 132}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshot_consistency_groups": [{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -39417,17 +39554,21 @@ def test_list_network_acl_rules_all_params(self):
)
# Set up parameter values
- network_acl_id = 'testString'
start = 'testString'
limit = 50
- direction = 'inbound'
+ resource_group_id = 'testString'
+ name = 'my-name'
+ sort = 'name'
+ backup_policy_plan_id = 'testString'
# Invoke method
- response = _service.list_network_acl_rules(
- network_acl_id,
+ response = _service.list_snapshot_consistency_groups(
start=start,
limit=limit,
- direction=direction,
+ resource_group_id=resource_group_id,
+ name=name,
+ sort=sort,
+ backup_policy_plan_id=backup_policy_plan_id,
headers={},
)
@@ -39439,25 +39580,28 @@ 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
+ assert 'resource_group.id={}'.format(resource_group_id) in query_string
+ assert 'name={}'.format(name) 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_network_acl_rules_all_params_with_retries(self):
- # Enable retries and run test_list_network_acl_rules_all_params.
+ def test_list_snapshot_consistency_groups_all_params_with_retries(self):
+ # Enable retries and run test_list_snapshot_consistency_groups_all_params.
_service.enable_retries()
- self.test_list_network_acl_rules_all_params()
+ self.test_list_snapshot_consistency_groups_all_params()
- # Disable retries and run test_list_network_acl_rules_all_params.
+ # Disable retries and run test_list_snapshot_consistency_groups_all_params.
_service.disable_retries()
- self.test_list_network_acl_rules_all_params()
+ self.test_list_snapshot_consistency_groups_all_params()
@responses.activate
- def test_list_network_acl_rules_required_params(self):
+ def test_list_snapshot_consistency_groups_required_params(self):
"""
- test_list_network_acl_rules_required_params()
+ test_list_snapshot_consistency_groups_required_params()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString/rules')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "total_count": 132}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshot_consistency_groups": [{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -39466,36 +39610,30 @@ def test_list_network_acl_rules_required_params(self):
status=200,
)
- # Set up parameter values
- network_acl_id = 'testString'
-
# Invoke method
- response = _service.list_network_acl_rules(
- network_acl_id,
- headers={},
- )
+ response = _service.list_snapshot_consistency_groups()
# Check for correct operation
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_snapshot_consistency_groups_required_params_with_retries(self):
+ # Enable retries and run test_list_snapshot_consistency_groups_required_params.
_service.enable_retries()
- self.test_list_network_acl_rules_required_params()
+ self.test_list_snapshot_consistency_groups_required_params()
- # Disable retries and run test_list_network_acl_rules_required_params.
+ # Disable retries and run test_list_snapshot_consistency_groups_required_params.
_service.disable_retries()
- self.test_list_network_acl_rules_required_params()
+ self.test_list_snapshot_consistency_groups_required_params()
@responses.activate
- def test_list_network_acl_rules_value_error(self):
+ def test_list_snapshot_consistency_groups_value_error(self):
"""
- test_list_network_acl_rules_value_error()
+ test_list_snapshot_consistency_groups_value_error()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString/rules')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "total_count": 132}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshot_consistency_groups": [{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -39504,36 +39642,32 @@ 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)
+ _service.list_snapshot_consistency_groups(**req_copy)
- def test_list_network_acl_rules_value_error_with_retries(self):
- # Enable retries and run test_list_network_acl_rules_value_error.
+ def test_list_snapshot_consistency_groups_value_error_with_retries(self):
+ # Enable retries and run test_list_snapshot_consistency_groups_value_error.
_service.enable_retries()
- self.test_list_network_acl_rules_value_error()
+ self.test_list_snapshot_consistency_groups_value_error()
- # Disable retries and run test_list_network_acl_rules_value_error.
+ # Disable retries and run test_list_snapshot_consistency_groups_value_error.
_service.disable_retries()
- self.test_list_network_acl_rules_value_error()
+ self.test_list_snapshot_consistency_groups_value_error()
@responses.activate
- def test_list_network_acl_rules_with_pager_get_next(self):
+ def test_list_snapshot_consistency_groups_with_pager_get_next(self):
"""
- test_list_network_acl_rules_with_pager_get_next()
+ test_list_snapshot_consistency_groups_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/network_acls/testString/rules')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
+ mock_response2 = '{"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -39551,11 +39685,13 @@ def test_list_network_acl_rules_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = NetworkAclRulesPager(
+ pager = SnapshotConsistencyGroupsPager(
client=_service,
- network_acl_id='testString',
limit=10,
- direction='inbound',
+ resource_group_id='testString',
+ name='my-name',
+ sort='name',
+ backup_policy_plan_id='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -39564,14 +39700,14 @@ def test_list_network_acl_rules_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_network_acl_rules_with_pager_get_all(self):
+ def test_list_snapshot_consistency_groups_with_pager_get_all(self):
"""
- test_list_network_acl_rules_with_pager_get_all()
+ test_list_snapshot_consistency_groups_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/network_acls/testString/rules')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","name":"my-network-acl-rule"},"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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9","id":"r006-8daca77a-4980-4d33-8f3e-7038797be8f9","ip_version":"ipv4","name":"my-network-acl-rule","source":"192.168.3.0/24","protocol":"all"}]}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
+ mock_response2 = '{"snapshot_consistency_groups":[{"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["service_tags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -39588,30 +39724,32 @@ def test_list_network_acl_rules_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = NetworkAclRulesPager(
+ pager = SnapshotConsistencyGroupsPager(
client=_service,
- network_acl_id='testString',
limit=10,
- direction='inbound',
+ resource_group_id='testString',
+ name='my-name',
+ sort='name',
+ backup_policy_plan_id='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateNetworkAclRule:
+class TestCreateSnapshotConsistencyGroup:
"""
- Test Class for create_network_acl_rule
+ Test Class for create_snapshot_consistency_group
"""
@responses.activate
- def test_create_network_acl_rule_all_params(self):
+ def test_create_snapshot_consistency_group_all_params(self):
"""
- create_network_acl_rule()
+ create_snapshot_consistency_group()
"""
# 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.POST,
url,
@@ -39620,29 +39758,33 @@ def test_create_network_acl_rule_all_params(self):
status=201,
)
- # Construct a dict representation of a NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById model
- network_acl_rule_before_prototype_model = {}
- network_acl_rule_before_prototype_model['id'] = 'r006-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 NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
- network_acl_rule_prototype_model['name'] = 'my-network-acl-rule'
- network_acl_rule_prototype_model['source'] = '192.168.3.2/32'
- network_acl_rule_prototype_model['protocol'] = 'all'
+ # Construct a dict representation of a VolumeIdentityById model
+ volume_identity_model = {}
+ volume_identity_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+
+ # Construct a dict representation of a SnapshotPrototypeSnapshotConsistencyGroupContext model
+ snapshot_prototype_snapshot_consistency_group_context_model = {}
+ snapshot_prototype_snapshot_consistency_group_context_model['name'] = 'my-snapshot'
+ snapshot_prototype_snapshot_consistency_group_context_model['source_volume'] = volume_identity_model
+ snapshot_prototype_snapshot_consistency_group_context_model['user_tags'] = ['testString']
+
+ # Construct a dict representation of a SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model
+ snapshot_consistency_group_prototype_model = {}
+ snapshot_consistency_group_prototype_model['delete_snapshots_on_delete'] = True
+ snapshot_consistency_group_prototype_model['name'] = 'my-snapshot-consistency-group'
+ snapshot_consistency_group_prototype_model['resource_group'] = resource_group_identity_model
+ snapshot_consistency_group_prototype_model['snapshots'] = [snapshot_prototype_snapshot_consistency_group_context_model]
# Set up parameter values
- network_acl_id = 'testString'
- network_acl_rule_prototype = network_acl_rule_prototype_model
+ snapshot_consistency_group_prototype = snapshot_consistency_group_prototype_model
# Invoke method
- response = _service.create_network_acl_rule(
- network_acl_id,
- network_acl_rule_prototype,
+ response = _service.create_snapshot_consistency_group(
+ snapshot_consistency_group_prototype,
headers={},
)
@@ -39651,25 +39793,25 @@ def test_create_network_acl_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 == network_acl_rule_prototype
+ assert req_body == snapshot_consistency_group_prototype
- def test_create_network_acl_rule_all_params_with_retries(self):
- # Enable retries and run test_create_network_acl_rule_all_params.
+ def test_create_snapshot_consistency_group_all_params_with_retries(self):
+ # Enable retries and run test_create_snapshot_consistency_group_all_params.
_service.enable_retries()
- self.test_create_network_acl_rule_all_params()
+ self.test_create_snapshot_consistency_group_all_params()
- # Disable retries and run test_create_network_acl_rule_all_params.
+ # Disable retries and run test_create_snapshot_consistency_group_all_params.
_service.disable_retries()
- self.test_create_network_acl_rule_all_params()
+ self.test_create_snapshot_consistency_group_all_params()
@responses.activate
- def test_create_network_acl_rule_value_error(self):
+ def test_create_snapshot_consistency_group_value_error(self):
"""
- test_create_network_acl_rule_value_error()
+ test_create_snapshot_consistency_group_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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
+ url = preprocess_url('/snapshot_consistency_groups')
+ 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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.POST,
url,
@@ -39678,137 +39820,143 @@ def test_create_network_acl_rule_value_error(self):
status=201,
)
- # Construct a dict representation of a NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById model
- network_acl_rule_before_prototype_model = {}
- network_acl_rule_before_prototype_model['id'] = 'r006-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 NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype 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['ip_version'] = 'ipv4'
- network_acl_rule_prototype_model['name'] = 'my-network-acl-rule'
- network_acl_rule_prototype_model['source'] = '192.168.3.2/32'
- network_acl_rule_prototype_model['protocol'] = 'all'
+ # Construct a dict representation of a VolumeIdentityById model
+ volume_identity_model = {}
+ volume_identity_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+
+ # Construct a dict representation of a SnapshotPrototypeSnapshotConsistencyGroupContext model
+ snapshot_prototype_snapshot_consistency_group_context_model = {}
+ snapshot_prototype_snapshot_consistency_group_context_model['name'] = 'my-snapshot'
+ snapshot_prototype_snapshot_consistency_group_context_model['source_volume'] = volume_identity_model
+ snapshot_prototype_snapshot_consistency_group_context_model['user_tags'] = ['testString']
+
+ # Construct a dict representation of a SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model
+ snapshot_consistency_group_prototype_model = {}
+ snapshot_consistency_group_prototype_model['delete_snapshots_on_delete'] = True
+ snapshot_consistency_group_prototype_model['name'] = 'my-snapshot-consistency-group'
+ snapshot_consistency_group_prototype_model['resource_group'] = resource_group_identity_model
+ snapshot_consistency_group_prototype_model['snapshots'] = [snapshot_prototype_snapshot_consistency_group_context_model]
# Set up parameter values
- network_acl_id = 'testString'
- network_acl_rule_prototype = network_acl_rule_prototype_model
+ snapshot_consistency_group_prototype = snapshot_consistency_group_prototype_model
# 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,
+ "snapshot_consistency_group_prototype": snapshot_consistency_group_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_rule(**req_copy)
+ _service.create_snapshot_consistency_group(**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_create_snapshot_consistency_group_value_error_with_retries(self):
+ # Enable retries and run test_create_snapshot_consistency_group_value_error.
_service.enable_retries()
- self.test_create_network_acl_rule_value_error()
+ self.test_create_snapshot_consistency_group_value_error()
- # Disable retries and run test_create_network_acl_rule_value_error.
+ # Disable retries and run test_create_snapshot_consistency_group_value_error.
_service.disable_retries()
- self.test_create_network_acl_rule_value_error()
+ self.test_create_snapshot_consistency_group_value_error()
-class TestDeleteNetworkAclRule:
+class TestDeleteSnapshotConsistencyGroup:
"""
- Test Class for delete_network_acl_rule
+ Test Class for delete_snapshot_consistency_group
"""
@responses.activate
- def test_delete_network_acl_rule_all_params(self):
+ def test_delete_snapshot_consistency_group_all_params(self):
"""
- delete_network_acl_rule()
+ delete_snapshot_consistency_group()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString/rules/testString')
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# Set up parameter values
- network_acl_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_network_acl_rule(
- network_acl_id,
+ response = _service.delete_snapshot_consistency_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_network_acl_rule_all_params_with_retries(self):
- # Enable retries and run test_delete_network_acl_rule_all_params.
+ def test_delete_snapshot_consistency_group_all_params_with_retries(self):
+ # Enable retries and run test_delete_snapshot_consistency_group_all_params.
_service.enable_retries()
- self.test_delete_network_acl_rule_all_params()
+ self.test_delete_snapshot_consistency_group_all_params()
- # Disable retries and run test_delete_network_acl_rule_all_params.
+ # Disable retries and run test_delete_snapshot_consistency_group_all_params.
_service.disable_retries()
- self.test_delete_network_acl_rule_all_params()
+ self.test_delete_snapshot_consistency_group_all_params()
@responses.activate
- def test_delete_network_acl_rule_value_error(self):
+ def test_delete_snapshot_consistency_group_value_error(self):
"""
- test_delete_network_acl_rule_value_error()
+ test_delete_snapshot_consistency_group_value_error()
"""
# Set up mock
- url = preprocess_url('/network_acls/testString/rules/testString')
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.DELETE,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=202,
)
# 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_network_acl_rule(**req_copy)
+ _service.delete_snapshot_consistency_group(**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_snapshot_consistency_group_value_error_with_retries(self):
+ # Enable retries and run test_delete_snapshot_consistency_group_value_error.
_service.enable_retries()
- self.test_delete_network_acl_rule_value_error()
+ self.test_delete_snapshot_consistency_group_value_error()
- # Disable retries and run test_delete_network_acl_rule_value_error.
+ # Disable retries and run test_delete_snapshot_consistency_group_value_error.
_service.disable_retries()
- self.test_delete_network_acl_rule_value_error()
+ self.test_delete_snapshot_consistency_group_value_error()
-class TestGetNetworkAclRule:
+class TestGetSnapshotConsistencyGroup:
"""
- Test Class for get_network_acl_rule
+ Test Class for get_snapshot_consistency_group
"""
@responses.activate
- def test_get_network_acl_rule_all_params(self):
+ def test_get_snapshot_consistency_group_all_params(self):
"""
- get_network_acl_rule()
+ get_snapshot_consistency_group()
"""
# 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.GET,
url,
@@ -39818,12 +39966,10 @@ def test_get_network_acl_rule_all_params(self):
)
# Set up parameter values
- network_acl_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_network_acl_rule(
- network_acl_id,
+ response = _service.get_snapshot_consistency_group(
id,
headers={},
)
@@ -39832,23 +39978,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_snapshot_consistency_group_all_params_with_retries(self):
+ # Enable retries and run test_get_snapshot_consistency_group_all_params.
_service.enable_retries()
- self.test_get_network_acl_rule_all_params()
+ self.test_get_snapshot_consistency_group_all_params()
- # Disable retries and run test_get_network_acl_rule_all_params.
+ # Disable retries and run test_get_snapshot_consistency_group_all_params.
_service.disable_retries()
- self.test_get_network_acl_rule_all_params()
+ self.test_get_snapshot_consistency_group_all_params()
@responses.activate
- def test_get_network_acl_rule_value_error(self):
+ def test_get_snapshot_consistency_group_value_error(self):
"""
- test_get_network_acl_rule_value_error()
+ test_get_snapshot_consistency_group_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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.GET,
url,
@@ -39858,42 +40004,40 @@ def test_get_network_acl_rule_value_error(self):
)
# 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_network_acl_rule(**req_copy)
+ _service.get_snapshot_consistency_group(**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_snapshot_consistency_group_value_error_with_retries(self):
+ # Enable retries and run test_get_snapshot_consistency_group_value_error.
_service.enable_retries()
- self.test_get_network_acl_rule_value_error()
+ self.test_get_snapshot_consistency_group_value_error()
- # Disable retries and run test_get_network_acl_rule_value_error.
+ # Disable retries and run test_get_snapshot_consistency_group_value_error.
_service.disable_retries()
- self.test_get_network_acl_rule_value_error()
+ self.test_get_snapshot_consistency_group_value_error()
-class TestUpdateNetworkAclRule:
+class TestUpdateSnapshotConsistencyGroup:
"""
- Test Class for update_network_acl_rule
+ Test Class for update_snapshot_consistency_group
"""
@responses.activate
- def test_update_network_acl_rule_all_params(self):
+ def test_update_snapshot_consistency_group_all_params(self):
"""
- update_network_acl_rule()
+ update_snapshot_consistency_group()
"""
# 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.PATCH,
url,
@@ -39902,35 +40046,21 @@ def test_update_network_acl_rule_all_params(self):
status=200,
)
- # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model
- network_acl_rule_before_patch_model = {}
- network_acl_rule_before_patch_model['id'] = 'r006-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-network-acl-rule'
- network_acl_rule_patch_model['source'] = '10.0.0.0/0'
- 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
+ # Construct a dict representation of a SnapshotConsistencyGroupPatch model
+ snapshot_consistency_group_patch_model = {}
+ snapshot_consistency_group_patch_model['delete_snapshots_on_delete'] = False
+ snapshot_consistency_group_patch_model['name'] = 'my-snapshot-consistency-group'
# Set up parameter values
- network_acl_id = 'testString'
id = 'testString'
- network_acl_rule_patch = network_acl_rule_patch_model
+ snapshot_consistency_group_patch = snapshot_consistency_group_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_network_acl_rule(
- network_acl_id,
+ response = _service.update_snapshot_consistency_group(
id,
- network_acl_rule_patch,
+ snapshot_consistency_group_patch,
+ if_match=if_match,
headers={},
)
@@ -39939,25 +40069,25 @@ def test_update_network_acl_rule_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_rule_patch
+ assert req_body == snapshot_consistency_group_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_update_snapshot_consistency_group_all_params_with_retries(self):
+ # Enable retries and run test_update_snapshot_consistency_group_all_params.
_service.enable_retries()
- self.test_update_network_acl_rule_all_params()
+ self.test_update_snapshot_consistency_group_all_params()
- # Disable retries and run test_update_network_acl_rule_all_params.
+ # Disable retries and run test_update_snapshot_consistency_group_all_params.
_service.disable_retries()
- self.test_update_network_acl_rule_all_params()
+ self.test_update_snapshot_consistency_group_all_params()
@responses.activate
- def test_update_network_acl_rule_value_error(self):
+ def test_update_snapshot_consistency_group_required_params(self):
"""
- test_update_network_acl_rule_value_error()
+ test_update_snapshot_consistency_group_required_params()
"""
# 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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}'
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
responses.add(
responses.PATCH,
url,
@@ -39966,121 +40096,175 @@ def test_update_network_acl_rule_value_error(self):
status=200,
)
- # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model
- network_acl_rule_before_patch_model = {}
- network_acl_rule_before_patch_model['id'] = 'r006-8daca77a-4980-4d33-8f3e-7038797be8f9'
+ # Construct a dict representation of a SnapshotConsistencyGroupPatch model
+ snapshot_consistency_group_patch_model = {}
+ snapshot_consistency_group_patch_model['delete_snapshots_on_delete'] = False
+ snapshot_consistency_group_patch_model['name'] = 'my-snapshot-consistency-group'
- # 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-network-acl-rule'
- network_acl_rule_patch_model['source'] = '10.0.0.0/0'
- 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
+ id = 'testString'
+ snapshot_consistency_group_patch = snapshot_consistency_group_patch_model
+
+ # Invoke method
+ response = _service.update_snapshot_consistency_group(
+ id,
+ snapshot_consistency_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 == snapshot_consistency_group_patch
+
+ def test_update_snapshot_consistency_group_required_params_with_retries(self):
+ # Enable retries and run test_update_snapshot_consistency_group_required_params.
+ _service.enable_retries()
+ self.test_update_snapshot_consistency_group_required_params()
+
+ # Disable retries and run test_update_snapshot_consistency_group_required_params.
+ _service.disable_retries()
+ self.test_update_snapshot_consistency_group_required_params()
+
+ @responses.activate
+ def test_update_snapshot_consistency_group_value_error(self):
+ """
+ test_update_snapshot_consistency_group_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/snapshot_consistency_groups/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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["service_tags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}'
+ responses.add(
+ responses.PATCH,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Construct a dict representation of a SnapshotConsistencyGroupPatch model
+ snapshot_consistency_group_patch_model = {}
+ snapshot_consistency_group_patch_model['delete_snapshots_on_delete'] = False
+ snapshot_consistency_group_patch_model['name'] = 'my-snapshot-consistency-group'
# Set up parameter values
- network_acl_id = 'testString'
id = 'testString'
- network_acl_rule_patch = network_acl_rule_patch_model
+ snapshot_consistency_group_patch = snapshot_consistency_group_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,
- "network_acl_rule_patch": network_acl_rule_patch,
+ "snapshot_consistency_group_patch": snapshot_consistency_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_network_acl_rule(**req_copy)
+ _service.update_snapshot_consistency_group(**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_update_snapshot_consistency_group_value_error_with_retries(self):
+ # Enable retries and run test_update_snapshot_consistency_group_value_error.
_service.enable_retries()
- self.test_update_network_acl_rule_value_error()
+ self.test_update_snapshot_consistency_group_value_error()
- # Disable retries and run test_update_network_acl_rule_value_error.
+ # Disable retries and run test_update_snapshot_consistency_group_value_error.
_service.disable_retries()
- self.test_update_network_acl_rule_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: NetworkACLs
-##############################################################################
-
-##############################################################################
-# Start of Service: SecurityGroups
-##############################################################################
-# region
+ self.test_update_snapshot_consistency_group_value_error()
-class TestNewInstance:
+class TestDeleteSnapshots:
"""
- Test Class for new_instance
+ Test Class for delete_snapshots
"""
- def test_new_instance(self):
+ @responses.activate
+ def test_delete_snapshots_all_params(self):
"""
- new_instance()
+ delete_snapshots()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
+ # Set up mock
+ url = preprocess_url('/snapshots')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=202,
+ )
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up parameter values
+ source_volume_id = 'testString'
+
+ # Invoke method
+ response = _service.delete_snapshots(
+ source_volume_id,
+ headers={},
)
- assert service is not None
- assert isinstance(service, VpcV1)
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+ # 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_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_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()
- 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_delete_snapshots_all_params.
+ _service.disable_retries()
+ self.test_delete_snapshots_all_params()
- def test_new_instance_required_param_none(self):
+ @responses.activate
+ def test_delete_snapshots_value_error(self):
"""
- new_instance_required_param_none()
+ test_delete_snapshots_value_error()
"""
- with pytest.raises(ValueError, match='version must be provided'):
- service = VpcV1.new_instance(
- version=None,
- )
+ # Set up mock
+ url = preprocess_url('/snapshots')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=202,
+ )
+ # Set up parameter values
+ source_volume_id = 'testString'
-class TestListSecurityGroups:
+ # 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:
"""
- Test Class for list_security_groups
+ Test Class for list_snapshots
"""
@responses.activate
- def test_list_security_groups_all_params(self):
+ def test_list_snapshots_all_params(self):
"""
- list_security_groups()
+ list_snapshots()
"""
# Set up mock
- url = preprocess_url('/security_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}'
+ url = preprocess_url('/snapshots')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshots": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -40092,19 +40276,51 @@ def test_list_security_groups_all_params(self):
# Set up parameter values
start = 'testString'
limit = 50
+ tag = 'testString'
resource_group_id = 'testString'
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
+ name = 'my-name'
+ source_volume_id = 'testString'
+ source_volume_crn = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
+ source_image_id = 'testString'
+ source_image_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
+ sort = 'name'
+ backup_policy_plan_id = 'testString'
+ copies_id = 'testString'
+ copies_name = 'my-snapshot-copy'
+ copies_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
+ copies_remote_region_name = 'us-south'
+ source_snapshot_id = 'testString'
+ source_snapshot_remote_region_name = 'us-south'
+ source_volume_remote_region_name = 'us-east'
+ source_image_remote_region_name = 'us-south'
+ clones_zone_name = 'us-south-1'
+ snapshot_consistency_group_id = 'testString'
+ snapshot_consistency_group_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263'
# Invoke method
- response = _service.list_security_groups(
+ response = _service.list_snapshots(
start=start,
limit=limit,
+ tag=tag,
resource_group_id=resource_group_id,
- vpc_id=vpc_id,
- vpc_crn=vpc_crn,
- vpc_name=vpc_name,
+ 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,
+ copies_id=copies_id,
+ copies_name=copies_name,
+ copies_crn=copies_crn,
+ copies_remote_region_name=copies_remote_region_name,
+ source_snapshot_id=source_snapshot_id,
+ source_snapshot_remote_region_name=source_snapshot_remote_region_name,
+ source_volume_remote_region_name=source_volume_remote_region_name,
+ source_image_remote_region_name=source_image_remote_region_name,
+ clones_zone_name=clones_zone_name,
+ snapshot_consistency_group_id=snapshot_consistency_group_id,
+ snapshot_consistency_group_crn=snapshot_consistency_group_crn,
headers={},
)
@@ -40116,28 +40332,44 @@ 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 'tag={}'.format(tag) 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
+ 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
+ assert 'copies[].id={}'.format(copies_id) in query_string
+ assert 'copies[].name={}'.format(copies_name) in query_string
+ assert 'copies[].crn={}'.format(copies_crn) in query_string
+ assert 'copies[].remote.region.name={}'.format(copies_remote_region_name) in query_string
+ assert 'source_snapshot.id={}'.format(source_snapshot_id) in query_string
+ assert 'source_snapshot.remote.region.name={}'.format(source_snapshot_remote_region_name) in query_string
+ assert 'source_volume.remote.region.name={}'.format(source_volume_remote_region_name) in query_string
+ assert 'source_image.remote.region.name={}'.format(source_image_remote_region_name) in query_string
+ assert 'clones[].zone.name={}'.format(clones_zone_name) in query_string
+ assert 'snapshot_consistency_group.id={}'.format(snapshot_consistency_group_id) in query_string
+ assert 'snapshot_consistency_group.crn={}'.format(snapshot_consistency_group_crn) 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_snapshots_all_params_with_retries(self):
+ # Enable retries and run test_list_snapshots_all_params.
_service.enable_retries()
- self.test_list_security_groups_all_params()
+ self.test_list_snapshots_all_params()
- # Disable retries and run test_list_security_groups_all_params.
+ # Disable retries and run test_list_snapshots_all_params.
_service.disable_retries()
- self.test_list_security_groups_all_params()
+ self.test_list_snapshots_all_params()
@responses.activate
- def test_list_security_groups_required_params(self):
+ def test_list_snapshots_required_params(self):
"""
- test_list_security_groups_required_params()
+ test_list_snapshots_required_params()
"""
# Set up mock
- url = preprocess_url('/security_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}'
+ url = preprocess_url('/snapshots')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshots": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -40147,29 +40379,29 @@ def test_list_security_groups_required_params(self):
)
# Invoke method
- response = _service.list_security_groups()
+ response = _service.list_snapshots()
# 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_snapshots_required_params_with_retries(self):
+ # Enable retries and run test_list_snapshots_required_params.
_service.enable_retries()
- self.test_list_security_groups_required_params()
+ self.test_list_snapshots_required_params()
- # Disable retries and run test_list_security_groups_required_params.
+ # Disable retries and run test_list_snapshots_required_params.
_service.disable_retries()
- self.test_list_security_groups_required_params()
+ self.test_list_snapshots_required_params()
@responses.activate
- def test_list_security_groups_value_error(self):
+ def test_list_snapshots_value_error(self):
"""
- test_list_security_groups_value_error()
+ test_list_snapshots_value_error()
"""
# Set up mock
- url = preprocess_url('/security_groups')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}'
+ url = preprocess_url('/snapshots')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "snapshots": [{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -40184,26 +40416,26 @@ 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_snapshots(**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_snapshots_value_error_with_retries(self):
+ # Enable retries and run test_list_snapshots_value_error.
_service.enable_retries()
- self.test_list_security_groups_value_error()
+ self.test_list_snapshots_value_error()
- # Disable retries and run test_list_security_groups_value_error.
+ # Disable retries and run test_list_snapshots_value_error.
_service.disable_retries()
- self.test_list_security_groups_value_error()
+ self.test_list_snapshots_value_error()
@responses.activate
- def test_list_security_groups_with_pager_get_next(self):
+ def test_list_snapshots_with_pager_get_next(self):
"""
- test_list_security_groups_with_pager_get_next()
+ test_list_snapshots_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/security_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/snapshots')
+ mock_response1 = '{"snapshots":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"snapshots":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -40221,13 +40453,29 @@ def test_list_security_groups_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = SecurityGroupsPager(
+ pager = SnapshotsPager(
client=_service,
limit=10,
+ tag='testString',
resource_group_id='testString',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
+ name='my-name',
+ source_volume_id='testString',
+ source_volume_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5',
+ source_image_id='testString',
+ source_image_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8',
+ sort='name',
+ backup_policy_plan_id='testString',
+ copies_id='testString',
+ copies_name='my-snapshot-copy',
+ copies_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
+ copies_remote_region_name='us-south',
+ source_snapshot_id='testString',
+ source_snapshot_remote_region_name='us-south',
+ source_volume_remote_region_name='us-east',
+ source_image_remote_region_name='us-south',
+ clones_zone_name='us-south-1',
+ snapshot_consistency_group_id='testString',
+ snapshot_consistency_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263',
)
while pager.has_next():
next_page = pager.get_next()
@@ -40236,14 +40484,14 @@ def test_list_security_groups_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_security_groups_with_pager_get_all(self):
+ def test_list_snapshots_with_pager_get_all(self):
"""
- test_list_security_groups_with_pager_get_all()
+ test_list_snapshots_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/security_groups')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/snapshots')
+ mock_response1 = '{"snapshots":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"snapshots":[{"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"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,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r006-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"storage_generation":1,"user_tags":["user_tags"]}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -40260,32 +40508,48 @@ def test_list_security_groups_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = SecurityGroupsPager(
+ pager = SnapshotsPager(
client=_service,
limit=10,
+ tag='testString',
resource_group_id='testString',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
+ name='my-name',
+ source_volume_id='testString',
+ source_volume_crn='crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5',
+ source_image_id='testString',
+ source_image_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8',
+ sort='name',
+ backup_policy_plan_id='testString',
+ copies_id='testString',
+ copies_name='my-snapshot-copy',
+ copies_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263',
+ copies_remote_region_name='us-south',
+ source_snapshot_id='testString',
+ source_snapshot_remote_region_name='us-south',
+ source_volume_remote_region_name='us-east',
+ source_image_remote_region_name='us-south',
+ clones_zone_name='us-south-1',
+ snapshot_consistency_group_id='testString',
+ snapshot_consistency_group_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateSecurityGroup:
+class TestCreateSnapshot:
"""
- Test Class for create_security_group
+ Test Class for create_snapshot
"""
@responses.activate
- def test_create_security_group_all_params(self):
+ def test_create_snapshot_all_params(self):
"""
- create_security_group()
+ create_snapshot()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/snapshots')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
responses.add(
responses.POST,
url,
@@ -40294,42 +40558,43 @@ def test_create_security_group_all_params(self):
status=201,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a SnapshotAllowedUsePrototype model
+ snapshot_allowed_use_prototype_model = {}
+ snapshot_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a SnapshotClonePrototype model
+ snapshot_clone_prototype_model = {}
+ snapshot_clone_prototype_model['zone'] = zone_identity_model
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a SecurityGroupRuleLocalPrototypeIP model
- security_group_rule_local_prototype_model = {}
- security_group_rule_local_prototype_model['address'] = '192.168.3.4'
-
- # 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 VolumeIdentityById model
+ volume_identity_model = {}
+ volume_identity_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
- # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
- security_group_rule_prototype_model = {}
- security_group_rule_prototype_model['direction'] = 'inbound'
- security_group_rule_prototype_model['ip_version'] = 'ipv4'
- security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
- security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
- security_group_rule_prototype_model['protocol'] = 'all'
+ # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model
+ snapshot_prototype_model = {}
+ snapshot_prototype_model['allowed_use'] = snapshot_allowed_use_prototype_model
+ snapshot_prototype_model['clones'] = [snapshot_clone_prototype_model]
+ snapshot_prototype_model['name'] = 'my-snapshot'
+ snapshot_prototype_model['resource_group'] = resource_group_identity_model
+ snapshot_prototype_model['user_tags'] = []
+ snapshot_prototype_model['source_volume'] = volume_identity_model
# Set up parameter values
- vpc = vpc_identity_model
- name = 'my-security-group'
- resource_group = resource_group_identity_model
- rules = [security_group_rule_prototype_model]
+ snapshot_prototype = snapshot_prototype_model
# Invoke method
- response = _service.create_security_group(
- vpc,
- name=name,
- resource_group=resource_group,
- rules=rules,
+ response = _service.create_snapshot(
+ snapshot_prototype,
headers={},
)
@@ -40338,28 +40603,25 @@ 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['resource_group'] == resource_group_identity_model
- assert req_body['rules'] == [security_group_rule_prototype_model]
+ assert req_body == snapshot_prototype
- def test_create_security_group_all_params_with_retries(self):
- # Enable retries and run test_create_security_group_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_create_security_group_all_params()
+ self.test_create_snapshot_all_params()
- # Disable retries and run test_create_security_group_all_params.
+ # Disable retries and run test_create_snapshot_all_params.
_service.disable_retries()
- self.test_create_security_group_all_params()
+ self.test_create_snapshot_all_params()
@responses.activate
- def test_create_security_group_value_error(self):
+ def test_create_snapshot_value_error(self):
"""
- test_create_security_group_value_error()
+ test_create_snapshot_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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/snapshots')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
responses.add(
responses.POST,
url,
@@ -40368,106 +40630,147 @@ def test_create_security_group_value_error(self):
status=201,
)
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a SnapshotAllowedUsePrototype model
+ snapshot_allowed_use_prototype_model = {}
+ snapshot_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a SnapshotClonePrototype model
+ snapshot_clone_prototype_model = {}
+ snapshot_clone_prototype_model['zone'] = zone_identity_model
# Construct a dict representation of a ResourceGroupIdentityById model
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
- # Construct a dict representation of a SecurityGroupRuleLocalPrototypeIP model
- security_group_rule_local_prototype_model = {}
- security_group_rule_local_prototype_model['address'] = '192.168.3.4'
-
- # 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 VolumeIdentityById model
+ volume_identity_model = {}
+ volume_identity_model['id'] = 'r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5'
- # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
- security_group_rule_prototype_model = {}
- security_group_rule_prototype_model['direction'] = 'inbound'
- security_group_rule_prototype_model['ip_version'] = 'ipv4'
- security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
- security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
- security_group_rule_prototype_model['protocol'] = 'all'
+ # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model
+ snapshot_prototype_model = {}
+ snapshot_prototype_model['allowed_use'] = snapshot_allowed_use_prototype_model
+ snapshot_prototype_model['clones'] = [snapshot_clone_prototype_model]
+ snapshot_prototype_model['name'] = 'my-snapshot'
+ snapshot_prototype_model['resource_group'] = resource_group_identity_model
+ snapshot_prototype_model['user_tags'] = []
+ snapshot_prototype_model['source_volume'] = volume_identity_model
# Set up parameter values
- vpc = vpc_identity_model
- name = 'my-security-group'
- resource_group = resource_group_identity_model
- rules = [security_group_rule_prototype_model]
+ snapshot_prototype = snapshot_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpc": vpc,
+ "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.create_security_group(**req_copy)
+ _service.create_snapshot(**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_snapshot_value_error_with_retries(self):
+ # Enable retries and run test_create_snapshot_value_error.
_service.enable_retries()
- self.test_create_security_group_value_error()
+ self.test_create_snapshot_value_error()
- # Disable retries and run test_create_security_group_value_error.
+ # Disable retries and run test_create_snapshot_value_error.
_service.disable_retries()
- self.test_create_security_group_value_error()
+ self.test_create_snapshot_value_error()
-class TestDeleteSecurityGroup:
+class TestDeleteSnapshot:
"""
- Test Class for delete_security_group
+ Test Class for delete_snapshot
"""
@responses.activate
- def test_delete_security_group_all_params(self):
+ def test_delete_snapshot_all_params(self):
"""
- delete_security_group()
+ delete_snapshot()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString')
+ url = preprocess_url('/snapshots/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.delete_security_group(
+ response = _service.delete_snapshot(
id,
+ if_match=if_match,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 202
- def test_delete_security_group_all_params_with_retries(self):
- # Enable retries and run test_delete_security_group_all_params.
+ def test_delete_snapshot_all_params_with_retries(self):
+ # Enable retries and run test_delete_snapshot_all_params.
_service.enable_retries()
- self.test_delete_security_group_all_params()
+ self.test_delete_snapshot_all_params()
- # Disable retries and run test_delete_security_group_all_params.
+ # Disable retries and run test_delete_snapshot_all_params.
_service.disable_retries()
- self.test_delete_security_group_all_params()
+ self.test_delete_snapshot_all_params()
@responses.activate
- def test_delete_security_group_value_error(self):
+ def test_delete_snapshot_required_params(self):
"""
- test_delete_security_group_value_error()
+ test_delete_snapshot_required_params()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString')
+ url = preprocess_url('/snapshots/testString')
responses.add(
responses.DELETE,
url,
- status=204,
+ status=202,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_snapshot(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
+
+ def test_delete_snapshot_required_params_with_retries(self):
+ # Enable retries and run test_delete_snapshot_required_params.
+ _service.enable_retries()
+ self.test_delete_snapshot_required_params()
+
+ # Disable retries and run test_delete_snapshot_required_params.
+ _service.disable_retries()
+ self.test_delete_snapshot_required_params()
+
+ @responses.activate
+ def test_delete_snapshot_value_error(self):
+ """
+ test_delete_snapshot_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/snapshots/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=202,
)
# Set up parameter values
@@ -40480,31 +40783,31 @@ 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.delete_snapshot(**req_copy)
- def test_delete_security_group_value_error_with_retries(self):
- # Enable retries and run test_delete_security_group_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_delete_security_group_value_error()
+ self.test_delete_snapshot_value_error()
- # Disable retries and run test_delete_security_group_value_error.
+ # Disable retries and run test_delete_snapshot_value_error.
_service.disable_retries()
- self.test_delete_security_group_value_error()
+ self.test_delete_snapshot_value_error()
-class TestGetSecurityGroup:
+class TestGetSnapshot:
"""
- Test Class for get_security_group
+ Test Class for get_snapshot
"""
@responses.activate
- def test_get_security_group_all_params(self):
+ def test_get_snapshot_all_params(self):
"""
- get_security_group()
+ get_snapshot()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/snapshots/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
responses.add(
responses.GET,
url,
@@ -40517,7 +40820,7 @@ def test_get_security_group_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_security_group(
+ response = _service.get_snapshot(
id,
headers={},
)
@@ -40526,23 +40829,23 @@ def test_get_security_group_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_security_group_all_params_with_retries(self):
- # Enable retries and run test_get_security_group_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_get_security_group_all_params()
+ self.test_get_snapshot_all_params()
- # Disable retries and run test_get_security_group_all_params.
+ # Disable retries and run test_get_snapshot_all_params.
_service.disable_retries()
- self.test_get_security_group_all_params()
+ self.test_get_snapshot_all_params()
@responses.activate
- def test_get_security_group_value_error(self):
+ def test_get_snapshot_value_error(self):
"""
- test_get_security_group_value_error()
+ test_get_snapshot_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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/snapshots/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
responses.add(
responses.GET,
url,
@@ -40561,31 +40864,31 @@ def test_get_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.get_security_group(**req_copy)
+ _service.get_snapshot(**req_copy)
- def test_get_security_group_value_error_with_retries(self):
- # Enable retries and run test_get_security_group_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_get_security_group_value_error()
+ self.test_get_snapshot_value_error()
- # Disable retries and run test_get_security_group_value_error.
+ # Disable retries and run test_get_snapshot_value_error.
_service.disable_retries()
- self.test_get_security_group_value_error()
+ self.test_get_snapshot_value_error()
-class TestUpdateSecurityGroup:
+class TestUpdateSnapshot:
"""
- Test Class for update_security_group
+ Test Class for update_snapshot
"""
@responses.activate
- def test_update_security_group_all_params(self):
+ def test_update_snapshot_all_params(self):
"""
- update_security_group()
+ update_snapshot()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/snapshots/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
responses.add(
responses.PATCH,
url,
@@ -40594,18 +40897,28 @@ def test_update_security_group_all_params(self):
status=200,
)
- # Construct a dict representation of a SecurityGroupPatch model
- security_group_patch_model = {}
- security_group_patch_model['name'] = 'my-security-group'
+ # Construct a dict representation of a SnapshotAllowedUsePatch model
+ snapshot_allowed_use_patch_model = {}
+ snapshot_allowed_use_patch_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a dict representation of a SnapshotPatch model
+ snapshot_patch_model = {}
+ snapshot_patch_model['allowed_use'] = snapshot_allowed_use_patch_model
+ snapshot_patch_model['name'] = 'my-snapshot-updated'
+ snapshot_patch_model['user_tags'] = ['testString']
# Set up parameter values
id = 'testString'
- security_group_patch = security_group_patch_model
+ snapshot_patch = snapshot_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_security_group(
+ response = _service.update_snapshot(
id,
- security_group_patch,
+ snapshot_patch,
+ if_match=if_match,
headers={},
)
@@ -40614,25 +40927,25 @@ def test_update_security_group_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 == security_group_patch
+ assert req_body == snapshot_patch
- def test_update_security_group_all_params_with_retries(self):
- # Enable retries and run test_update_security_group_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_update_security_group_all_params()
+ self.test_update_snapshot_all_params()
- # Disable retries and run test_update_security_group_all_params.
+ # Disable retries and run test_update_snapshot_all_params.
_service.disable_retries()
- self.test_update_security_group_all_params()
+ self.test_update_snapshot_all_params()
@responses.activate
- def test_update_security_group_value_error(self):
+ def test_update_snapshot_required_params(self):
"""
- test_update_security_group_value_error()
+ test_update_snapshot_required_params()
"""
# 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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/snapshots/testString')
+ mock_response = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
responses.add(
responses.PATCH,
url,
@@ -40641,47 +40954,110 @@ def test_update_security_group_value_error(self):
status=200,
)
- # Construct a dict representation of a SecurityGroupPatch model
- security_group_patch_model = {}
- security_group_patch_model['name'] = 'my-security-group'
+ # Construct a dict representation of a SnapshotAllowedUsePatch model
+ snapshot_allowed_use_patch_model = {}
+ snapshot_allowed_use_patch_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a dict representation of a SnapshotPatch model
+ snapshot_patch_model = {}
+ snapshot_patch_model['allowed_use'] = snapshot_allowed_use_patch_model
+ snapshot_patch_model['name'] = 'my-snapshot-updated'
+ snapshot_patch_model['user_tags'] = ['testString']
# Set up parameter values
id = 'testString'
- security_group_patch = security_group_patch_model
+ 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 = '{"allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "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/r006-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r006-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "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, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r006-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-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/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "storage_generation": 1, "user_tags": ["user_tags"]}'
+ responses.add(
+ responses.PATCH,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Construct a dict representation of a SnapshotAllowedUsePatch model
+ snapshot_allowed_use_patch_model = {}
+ snapshot_allowed_use_patch_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a dict representation of a SnapshotPatch model
+ snapshot_patch_model = {}
+ snapshot_patch_model['allowed_use'] = snapshot_allowed_use_patch_model
+ snapshot_patch_model['name'] = 'my-snapshot-updated'
+ 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,
- "security_group_patch": security_group_patch,
+ "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.update_security_group(**req_copy)
+ _service.update_snapshot(**req_copy)
- def test_update_security_group_value_error_with_retries(self):
- # Enable retries and run test_update_security_group_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_update_security_group_value_error()
+ self.test_update_snapshot_value_error()
- # Disable retries and run test_update_security_group_value_error.
+ # Disable retries and run test_update_snapshot_value_error.
_service.disable_retries()
- self.test_update_security_group_value_error()
+ self.test_update_snapshot_value_error()
-class TestListSecurityGroupRules:
+class TestListSnapshotClones:
"""
- Test Class for list_security_group_rules
+ Test Class for list_snapshot_clones
"""
@responses.activate
- def test_list_security_group_rules_all_params(self):
+ def test_list_snapshot_clones_all_params(self):
"""
- list_security_group_rules()
+ list_snapshot_clones()
"""
# 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}'
+ url = preprocess_url('/snapshots/testString/clones')
+ mock_response = '{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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,
@@ -40691,11 +41067,11 @@ def test_list_security_group_rules_all_params(self):
)
# Set up parameter values
- security_group_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_security_group_rules(
- security_group_id,
+ response = _service.list_snapshot_clones(
+ id,
headers={},
)
@@ -40703,23 +41079,23 @@ def test_list_security_group_rules_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- 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_snapshot_clones_all_params_with_retries(self):
+ # Enable retries and run test_list_snapshot_clones_all_params.
_service.enable_retries()
- self.test_list_security_group_rules_all_params()
+ self.test_list_snapshot_clones_all_params()
- # Disable retries and run test_list_security_group_rules_all_params.
+ # Disable retries and run test_list_snapshot_clones_all_params.
_service.disable_retries()
- self.test_list_security_group_rules_all_params()
+ self.test_list_snapshot_clones_all_params()
@responses.activate
- def test_list_security_group_rules_value_error(self):
+ def test_list_snapshot_clones_value_error(self):
"""
- test_list_security_group_rules_value_error()
+ test_list_snapshot_clones_value_error()
"""
# 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}'
+ url = preprocess_url('/snapshots/testString/clones')
+ mock_response = '{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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,
@@ -40729,241 +41105,206 @@ def test_list_security_group_rules_value_error(self):
)
# 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.list_security_group_rules(**req_copy)
+ _service.list_snapshot_clones(**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_snapshot_clones_value_error_with_retries(self):
+ # Enable retries and run test_list_snapshot_clones_value_error.
_service.enable_retries()
- self.test_list_security_group_rules_value_error()
+ self.test_list_snapshot_clones_value_error()
- # Disable retries and run test_list_security_group_rules_value_error.
+ # Disable retries and run test_list_snapshot_clones_value_error.
_service.disable_retries()
- self.test_list_security_group_rules_value_error()
+ self.test_list_snapshot_clones_value_error()
-class TestCreateSecurityGroupRule:
+class TestDeleteSnapshotClone:
"""
- Test Class for create_security_group_rule
+ Test Class for delete_snapshot_clone
"""
@responses.activate
- def test_create_security_group_rule_all_params(self):
+ def test_delete_snapshot_clone_all_params(self):
"""
- create_security_group_rule()
+ delete_snapshot_clone()
"""
# 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ url = preprocess_url('/snapshots/testString/clones/us-south-1')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=202,
)
- # Construct a dict representation of a SecurityGroupRuleLocalPrototypeIP model
- security_group_rule_local_prototype_model = {}
- security_group_rule_local_prototype_model['address'] = '192.168.3.4'
-
- # 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 SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
- security_group_rule_prototype_model = {}
- security_group_rule_prototype_model['direction'] = 'inbound'
- security_group_rule_prototype_model['ip_version'] = 'ipv4'
- security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
- security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
- security_group_rule_prototype_model['protocol'] = 'all'
-
# Set up parameter values
- security_group_id = 'testString'
- security_group_rule_prototype = security_group_rule_prototype_model
+ id = 'testString'
+ zone_name = 'us-south-1'
# Invoke method
- response = _service.create_security_group_rule(
- security_group_id,
- security_group_rule_prototype,
+ response = _service.delete_snapshot_clone(
+ id,
+ zone_name,
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 == security_group_rule_prototype
+ assert response.status_code == 202
- def test_create_security_group_rule_all_params_with_retries(self):
- # Enable retries and run test_create_security_group_rule_all_params.
+ def test_delete_snapshot_clone_all_params_with_retries(self):
+ # Enable retries and run test_delete_snapshot_clone_all_params.
_service.enable_retries()
- self.test_create_security_group_rule_all_params()
+ self.test_delete_snapshot_clone_all_params()
- # Disable retries and run test_create_security_group_rule_all_params.
+ # Disable retries and run test_delete_snapshot_clone_all_params.
_service.disable_retries()
- self.test_create_security_group_rule_all_params()
+ self.test_delete_snapshot_clone_all_params()
@responses.activate
- def test_create_security_group_rule_value_error(self):
+ def test_delete_snapshot_clone_value_error(self):
"""
- test_create_security_group_rule_value_error()
+ test_delete_snapshot_clone_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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ url = preprocess_url('/snapshots/testString/clones/us-south-1')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=202,
)
- # Construct a dict representation of a SecurityGroupRuleLocalPrototypeIP model
- security_group_rule_local_prototype_model = {}
- security_group_rule_local_prototype_model['address'] = '192.168.3.4'
-
- # 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 SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model
- security_group_rule_prototype_model = {}
- security_group_rule_prototype_model['direction'] = 'inbound'
- security_group_rule_prototype_model['ip_version'] = 'ipv4'
- security_group_rule_prototype_model['local'] = security_group_rule_local_prototype_model
- security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model
- security_group_rule_prototype_model['protocol'] = 'all'
-
# Set up parameter values
- security_group_id = 'testString'
- security_group_rule_prototype = security_group_rule_prototype_model
+ id = 'testString'
+ zone_name = 'us-south-1'
# 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,
+ "id": id,
+ "zone_name": zone_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.create_security_group_rule(**req_copy)
+ _service.delete_snapshot_clone(**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_delete_snapshot_clone_value_error_with_retries(self):
+ # Enable retries and run test_delete_snapshot_clone_value_error.
_service.enable_retries()
- self.test_create_security_group_rule_value_error()
+ self.test_delete_snapshot_clone_value_error()
- # Disable retries and run test_create_security_group_rule_value_error.
+ # Disable retries and run test_delete_snapshot_clone_value_error.
_service.disable_retries()
- self.test_create_security_group_rule_value_error()
+ self.test_delete_snapshot_clone_value_error()
-class TestDeleteSecurityGroupRule:
+class TestGetSnapshotClone:
"""
- Test Class for delete_security_group_rule
+ Test Class for get_snapshot_clone
"""
@responses.activate
- def test_delete_security_group_rule_all_params(self):
+ def test_get_snapshot_clone_all_params(self):
"""
- delete_security_group_rule()
+ get_snapshot_clone()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/rules/testString')
+ url = preprocess_url('/snapshots/testString/clones/us-south-1')
+ mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- security_group_id = 'testString'
id = 'testString'
+ zone_name = 'us-south-1'
# Invoke method
- response = _service.delete_security_group_rule(
- security_group_id,
+ response = _service.get_snapshot_clone(
id,
+ zone_name,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_security_group_rule_all_params_with_retries(self):
- # Enable retries and run test_delete_security_group_rule_all_params.
+ def test_get_snapshot_clone_all_params_with_retries(self):
+ # Enable retries and run test_get_snapshot_clone_all_params.
_service.enable_retries()
- self.test_delete_security_group_rule_all_params()
+ self.test_get_snapshot_clone_all_params()
- # Disable retries and run test_delete_security_group_rule_all_params.
+ # Disable retries and run test_get_snapshot_clone_all_params.
_service.disable_retries()
- self.test_delete_security_group_rule_all_params()
+ self.test_get_snapshot_clone_all_params()
@responses.activate
- def test_delete_security_group_rule_value_error(self):
+ def test_get_snapshot_clone_value_error(self):
"""
- test_delete_security_group_rule_value_error()
+ test_get_snapshot_clone_value_error()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/rules/testString')
+ url = preprocess_url('/snapshots/testString/clones/us-south-1')
+ mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- security_group_id = 'testString'
id = 'testString'
+ zone_name = 'us-south-1'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "security_group_id": security_group_id,
"id": id,
+ "zone_name": zone_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.delete_security_group_rule(**req_copy)
+ _service.get_snapshot_clone(**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_get_snapshot_clone_value_error_with_retries(self):
+ # Enable retries and run test_get_snapshot_clone_value_error.
_service.enable_retries()
- self.test_delete_security_group_rule_value_error()
+ self.test_get_snapshot_clone_value_error()
- # Disable retries and run test_delete_security_group_rule_value_error.
+ # Disable retries and run test_get_snapshot_clone_value_error.
_service.disable_retries()
- self.test_delete_security_group_rule_value_error()
+ self.test_get_snapshot_clone_value_error()
-class TestGetSecurityGroupRule:
+class TestCreateSnapshotClone:
"""
- Test Class for get_security_group_rule
+ Test Class for create_snapshot_clone
"""
@responses.activate
- def test_get_security_group_rule_all_params(self):
+ def test_create_snapshot_clone_all_params(self):
"""
- get_security_group_rule()
+ create_snapshot_clone()
"""
# 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ url = preprocess_url('/snapshots/testString/clones/us-south-1')
+ mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
@@ -40971,13 +41312,13 @@ def test_get_security_group_rule_all_params(self):
)
# Set up parameter values
- security_group_id = 'testString'
id = 'testString'
+ zone_name = 'us-south-1'
# Invoke method
- response = _service.get_security_group_rule(
- security_group_id,
+ response = _service.create_snapshot_clone(
id,
+ zone_name,
headers={},
)
@@ -40985,25 +41326,25 @@ 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_create_snapshot_clone_all_params_with_retries(self):
+ # Enable retries and run test_create_snapshot_clone_all_params.
_service.enable_retries()
- self.test_get_security_group_rule_all_params()
+ self.test_create_snapshot_clone_all_params()
- # Disable retries and run test_get_security_group_rule_all_params.
+ # Disable retries and run test_create_snapshot_clone_all_params.
_service.disable_retries()
- self.test_get_security_group_rule_all_params()
+ self.test_create_snapshot_clone_all_params()
@responses.activate
- def test_get_security_group_rule_value_error(self):
+ def test_create_snapshot_clone_value_error(self):
"""
- test_get_security_group_rule_value_error()
+ test_create_snapshot_clone_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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ url = preprocess_url('/snapshots/testString/clones/us-south-1')
+ mock_response = '{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
@@ -41011,172 +41352,298 @@ def test_get_security_group_rule_value_error(self):
)
# Set up parameter values
- security_group_id = 'testString'
id = 'testString'
+ zone_name = 'us-south-1'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "security_group_id": security_group_id,
"id": id,
+ "zone_name": zone_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_security_group_rule(**req_copy)
+ _service.create_snapshot_clone(**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_create_snapshot_clone_value_error_with_retries(self):
+ # Enable retries and run test_create_snapshot_clone_value_error.
_service.enable_retries()
- self.test_get_security_group_rule_value_error()
+ self.test_create_snapshot_clone_value_error()
- # Disable retries and run test_get_security_group_rule_value_error.
+ # Disable retries and run test_create_snapshot_clone_value_error.
_service.disable_retries()
- self.test_get_security_group_rule_value_error()
+ self.test_create_snapshot_clone_value_error()
-class TestUpdateSecurityGroupRule:
+class TestListSnapshotInstanceProfiles:
"""
- Test Class for update_security_group_rule
+ Test Class for list_snapshot_instance_profiles
"""
@responses.activate
- def test_update_security_group_rule_all_params(self):
+ def test_list_snapshot_instance_profiles_all_params(self):
"""
- update_security_group_rule()
+ list_snapshot_instance_profiles()
"""
# 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ url = preprocess_url('/snapshots/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a SecurityGroupRuleLocalPatchIP model
- security_group_rule_local_patch_model = {}
- security_group_rule_local_patch_model['address'] = '192.168.3.4'
-
- # Construct a dict representation of a SecurityGroupRuleRemotePatchCIDR model
- security_group_rule_remote_patch_model = {}
- security_group_rule_remote_patch_model['cidr_block'] = '10.0.0.0/8'
-
- # 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['local'] = security_group_rule_local_patch_model
- 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
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.update_security_group_rule(
- security_group_id,
+ response = _service.list_snapshot_instance_profiles(
id,
- security_group_rule_patch,
+ start=start,
+ limit=limit,
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
+ # 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_update_security_group_rule_all_params_with_retries(self):
- # Enable retries and run test_update_security_group_rule_all_params.
+ def test_list_snapshot_instance_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_snapshot_instance_profiles_all_params.
_service.enable_retries()
- self.test_update_security_group_rule_all_params()
+ self.test_list_snapshot_instance_profiles_all_params()
- # Disable retries and run test_update_security_group_rule_all_params.
+ # Disable retries and run test_list_snapshot_instance_profiles_all_params.
_service.disable_retries()
- self.test_update_security_group_rule_all_params()
+ self.test_list_snapshot_instance_profiles_all_params()
@responses.activate
- def test_update_security_group_rule_value_error(self):
+ def test_list_snapshot_instance_profiles_required_params(self):
"""
- test_update_security_group_rule_value_error()
+ test_list_snapshot_instance_profiles_required_params()
"""
# 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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}'
+ url = preprocess_url('/snapshots/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a SecurityGroupRuleLocalPatchIP model
- security_group_rule_local_patch_model = {}
- security_group_rule_local_patch_model['address'] = '192.168.3.4'
+ # Set up parameter values
+ id = 'testString'
- # Construct a dict representation of a SecurityGroupRuleRemotePatchCIDR model
- security_group_rule_remote_patch_model = {}
- security_group_rule_remote_patch_model['cidr_block'] = '10.0.0.0/8'
+ # Invoke method
+ response = _service.list_snapshot_instance_profiles(
+ id,
+ headers={},
+ )
- # 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['local'] = security_group_rule_local_patch_model
- 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
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_snapshot_instance_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_snapshot_instance_profiles_required_params.
+ _service.enable_retries()
+ self.test_list_snapshot_instance_profiles_required_params()
+
+ # Disable retries and run test_list_snapshot_instance_profiles_required_params.
+ _service.disable_retries()
+ self.test_list_snapshot_instance_profiles_required_params()
+
+ @responses.activate
+ def test_list_snapshot_instance_profiles_value_error(self):
+ """
+ test_list_snapshot_instance_profiles_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/snapshots/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "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'
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_snapshot_instance_profiles(**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_snapshot_instance_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_snapshot_instance_profiles_value_error.
_service.enable_retries()
- self.test_update_security_group_rule_value_error()
+ self.test_list_snapshot_instance_profiles_value_error()
- # Disable retries and run test_update_security_group_rule_value_error.
+ # Disable retries and run test_list_snapshot_instance_profiles_value_error.
_service.disable_retries()
- self.test_update_security_group_rule_value_error()
+ self.test_list_snapshot_instance_profiles_value_error()
+
+ @responses.activate
+ def test_list_snapshot_instance_profiles_with_pager_get_next(self):
+ """
+ test_list_snapshot_instance_profiles_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/snapshots/testString/instance_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = SnapshotInstanceProfilesPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestListSecurityGroupTargets:
+ @responses.activate
+ def test_list_snapshot_instance_profiles_with_pager_get_all(self):
+ """
+ test_list_snapshot_instance_profiles_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/snapshots/testString/instance_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = SnapshotInstanceProfilesPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+# endregion
+##############################################################################
+# End of Service: Snapshots
+##############################################################################
+
+##############################################################################
+# Start of Service: Subnets
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_security_group_targets
+ 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 TestListSubnets:
+ """
+ Test Class for list_subnets
"""
@responses.activate
- def test_list_security_group_targets_all_params(self):
+ def test_list_subnets_all_params(self):
"""
- list_security_group_targets()
+ list_subnets()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/targets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "total_count": 132}'
+ url = preprocess_url('/subnets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -41186,15 +41653,27 @@ def test_list_security_group_targets_all_params(self):
)
# Set up parameter values
- security_group_id = 'testString'
start = 'testString'
limit = 50
+ resource_group_id = 'testString'
+ zone_name = 'us-south-1'
+ vpc_id = 'testString'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
+ routing_table_id = 'testString'
+ routing_table_name = 'my-routing-table'
# Invoke method
- response = _service.list_security_group_targets(
- security_group_id,
+ response = _service.list_subnets(
start=start,
limit=limit,
+ resource_group_id=resource_group_id,
+ zone_name=zone_name,
+ vpc_id=vpc_id,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
+ routing_table_id=routing_table_id,
+ routing_table_name=routing_table_name,
headers={},
)
@@ -41206,24 +41685,31 @@ 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 'zone.name={}'.format(zone_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 'routing_table.id={}'.format(routing_table_id) in query_string
+ assert 'routing_table.name={}'.format(routing_table_name) 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_subnets_all_params_with_retries(self):
+ # Enable retries and run test_list_subnets_all_params.
_service.enable_retries()
- self.test_list_security_group_targets_all_params()
+ self.test_list_subnets_all_params()
- # Disable retries and run test_list_security_group_targets_all_params.
+ # Disable retries and run test_list_subnets_all_params.
_service.disable_retries()
- self.test_list_security_group_targets_all_params()
+ self.test_list_subnets_all_params()
@responses.activate
- def test_list_security_group_targets_required_params(self):
+ def test_list_subnets_required_params(self):
"""
- test_list_security_group_targets_required_params()
+ test_list_subnets_required_params()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/targets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "total_count": 132}'
+ url = preprocess_url('/subnets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -41232,36 +41718,30 @@ def test_list_security_group_targets_required_params(self):
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_subnets()
# 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_subnets_required_params_with_retries(self):
+ # Enable retries and run test_list_subnets_required_params.
_service.enable_retries()
- self.test_list_security_group_targets_required_params()
+ self.test_list_subnets_required_params()
- # Disable retries and run test_list_security_group_targets_required_params.
+ # Disable retries and run test_list_subnets_required_params.
_service.disable_retries()
- self.test_list_security_group_targets_required_params()
+ self.test_list_subnets_required_params()
@responses.activate
- def test_list_security_group_targets_value_error(self):
+ def test_list_subnets_value_error(self):
"""
- test_list_security_group_targets_value_error()
+ test_list_subnets_value_error()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/targets')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "total_count": 132}'
+ url = preprocess_url('/subnets')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -41270,36 +41750,32 @@ def test_list_security_group_targets_value_error(self):
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_subnets(**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_subnets_value_error_with_retries(self):
+ # Enable retries and run test_list_subnets_value_error.
_service.enable_retries()
- self.test_list_security_group_targets_value_error()
+ self.test_list_subnets_value_error()
- # Disable retries and run test_list_security_group_targets_value_error.
+ # Disable retries and run test_list_subnets_value_error.
_service.disable_retries()
- self.test_list_security_group_targets_value_error()
+ self.test_list_subnets_value_error()
@responses.activate
- def test_list_security_group_targets_with_pager_get_next(self):
+ def test_list_subnets_with_pager_get_next(self):
"""
- test_list_security_group_targets_with_pager_get_next()
+ test_list_subnets_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/security_groups/testString/targets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
+ url = preprocess_url('/subnets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -41317,10 +41793,16 @@ def test_list_security_group_targets_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = SecurityGroupTargetsPager(
+ pager = SubnetsPager(
client=_service,
- security_group_id='testString',
limit=10,
+ resource_group_id='testString',
+ zone_name='us-south-1',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ routing_table_id='testString',
+ routing_table_name='my-routing-table',
)
while pager.has_next():
next_page = pager.get_next()
@@ -41329,14 +41811,14 @@ def test_list_security_group_targets_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_security_group_targets_with_pager_get_all(self):
+ def test_list_subnets_with_pager_get_all(self):
"""
- test_list_security_group_targets_with_pager_get_all()
+ test_list_subnets_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/security_groups/testString/targets')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","resource_type":"network_interface"}]}'
+ url = preprocess_url('/subnets')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","name":"my-subnet","network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"r006-dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_type":"public_gateway"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"subnet","routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"status":"available","total_ipv4_address_count":256,"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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,
@@ -41353,195 +41835,268 @@ def test_list_security_group_targets_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = SecurityGroupTargetsPager(
+ pager = SubnetsPager(
client=_service,
- security_group_id='testString',
limit=10,
+ resource_group_id='testString',
+ zone_name='us-south-1',
+ vpc_id='testString',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ routing_table_id='testString',
+ routing_table_name='my-routing-table',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestDeleteSecurityGroupTargetBinding:
+class TestCreateSubnet:
"""
- Test Class for delete_security_group_target_binding
+ Test Class for create_subnet
"""
@responses.activate
- def test_delete_security_group_target_binding_all_params(self):
+ def test_create_subnet_all_params(self):
"""
- delete_security_group_target_binding()
+ create_subnet()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/targets/testString')
+ url = preprocess_url('/subnets')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a NetworkACLIdentityById model
+ network_acl_identity_model = {}
+ network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
+
+ # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
+ public_gateway_identity_model = {}
+ public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Construct a dict representation of a RoutingTableIdentityByCRN model
+ routing_table_identity_model = {}
+ routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 SubnetPrototypeSubnetByTotalCount model
+ subnet_prototype_model = {}
+ subnet_prototype_model['ip_version'] = 'ipv4'
+ subnet_prototype_model['name'] = 'my-subnet'
+ subnet_prototype_model['network_acl'] = network_acl_identity_model
+ subnet_prototype_model['public_gateway'] = public_gateway_identity_model
+ subnet_prototype_model['resource_group'] = resource_group_identity_model
+ subnet_prototype_model['routing_table'] = routing_table_identity_model
+ subnet_prototype_model['vpc'] = vpc_identity_model
+ subnet_prototype_model['total_ipv4_address_count'] = 256
+ subnet_prototype_model['zone'] = zone_identity_model
+
# Set up parameter values
- security_group_id = 'testString'
- id = 'testString'
+ subnet_prototype = subnet_prototype_model
# Invoke method
- response = _service.delete_security_group_target_binding(
- security_group_id,
- id,
+ response = _service.create_subnet(
+ subnet_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 == subnet_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_subnet_all_params_with_retries(self):
+ # Enable retries and run test_create_subnet_all_params.
_service.enable_retries()
- self.test_delete_security_group_target_binding_all_params()
+ self.test_create_subnet_all_params()
- # Disable retries and run test_delete_security_group_target_binding_all_params.
+ # Disable retries and run test_create_subnet_all_params.
_service.disable_retries()
- self.test_delete_security_group_target_binding_all_params()
+ self.test_create_subnet_all_params()
@responses.activate
- def test_delete_security_group_target_binding_value_error(self):
+ def test_create_subnet_value_error(self):
"""
- test_delete_security_group_target_binding_value_error()
+ test_create_subnet_value_error()
"""
# Set up mock
- url = preprocess_url('/security_groups/testString/targets/testString')
+ url = preprocess_url('/subnets')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
+ responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
+ # Construct a dict representation of a NetworkACLIdentityById model
+ network_acl_identity_model = {}
+ network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
+
+ # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
+ public_gateway_identity_model = {}
+ public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Construct a dict representation of a RoutingTableIdentityByCRN model
+ routing_table_identity_model = {}
+ routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-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 SubnetPrototypeSubnetByTotalCount model
+ subnet_prototype_model = {}
+ subnet_prototype_model['ip_version'] = 'ipv4'
+ subnet_prototype_model['name'] = 'my-subnet'
+ subnet_prototype_model['network_acl'] = network_acl_identity_model
+ subnet_prototype_model['public_gateway'] = public_gateway_identity_model
+ subnet_prototype_model['resource_group'] = resource_group_identity_model
+ subnet_prototype_model['routing_table'] = routing_table_identity_model
+ subnet_prototype_model['vpc'] = vpc_identity_model
+ subnet_prototype_model['total_ipv4_address_count'] = 256
+ subnet_prototype_model['zone'] = zone_identity_model
+
# Set up parameter values
- security_group_id = 'testString'
- id = 'testString'
+ subnet_prototype = subnet_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,
+ "subnet_prototype": subnet_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_subnet(**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_subnet_value_error_with_retries(self):
+ # Enable retries and run test_create_subnet_value_error.
_service.enable_retries()
- self.test_delete_security_group_target_binding_value_error()
+ self.test_create_subnet_value_error()
- # Disable retries and run test_delete_security_group_target_binding_value_error.
+ # Disable retries and run test_create_subnet_value_error.
_service.disable_retries()
- self.test_delete_security_group_target_binding_value_error()
+ self.test_create_subnet_value_error()
-class TestGetSecurityGroupTarget:
+class TestDeleteSubnet:
"""
- Test Class for get_security_group_target
+ Test Class for delete_subnet
"""
@responses.activate
- def test_get_security_group_target_all_params(self):
+ def test_delete_subnet_all_params(self):
"""
- get_security_group_target()
+ delete_subnet()
"""
# 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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
+ url = preprocess_url('/subnets/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- security_group_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_security_group_target(
- security_group_id,
+ response = _service.delete_subnet(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- 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_subnet_all_params_with_retries(self):
+ # Enable retries and run test_delete_subnet_all_params.
_service.enable_retries()
- self.test_get_security_group_target_all_params()
+ self.test_delete_subnet_all_params()
- # Disable retries and run test_get_security_group_target_all_params.
+ # Disable retries and run test_delete_subnet_all_params.
_service.disable_retries()
- self.test_get_security_group_target_all_params()
+ self.test_delete_subnet_all_params()
@responses.activate
- def test_get_security_group_target_value_error(self):
+ def test_delete_subnet_value_error(self):
"""
- test_get_security_group_target_value_error()
+ test_delete_subnet_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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
+ url = preprocess_url('/subnets/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ 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.get_security_group_target(**req_copy)
+ _service.delete_subnet(**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_subnet_value_error_with_retries(self):
+ # Enable retries and run test_delete_subnet_value_error.
_service.enable_retries()
- self.test_get_security_group_target_value_error()
+ self.test_delete_subnet_value_error()
- # Disable retries and run test_get_security_group_target_value_error.
+ # Disable retries and run test_delete_subnet_value_error.
_service.disable_retries()
- self.test_get_security_group_target_value_error()
+ self.test_delete_subnet_value_error()
-class TestCreateSecurityGroupTargetBinding:
+class TestGetSubnet:
"""
- Test Class for create_security_group_target_binding
+ Test Class for get_subnet
"""
@responses.activate
- def test_create_security_group_target_binding_all_params(self):
+ def test_get_subnet_all_params(self):
"""
- create_security_group_target_binding()
+ get_subnet()
"""
# 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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
+ url = preprocess_url('/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.PUT,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
@@ -41549,12 +42104,10 @@ def test_create_security_group_target_binding_all_params(self):
)
# 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_subnet(
id,
headers={},
)
@@ -41563,25 +42116,25 @@ 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_subnet_all_params_with_retries(self):
+ # Enable retries and run test_get_subnet_all_params.
_service.enable_retries()
- self.test_create_security_group_target_binding_all_params()
+ self.test_get_subnet_all_params()
- # Disable retries and run test_create_security_group_target_binding_all_params.
+ # Disable retries and run test_get_subnet_all_params.
_service.disable_retries()
- self.test_create_security_group_target_binding_all_params()
+ self.test_get_subnet_all_params()
@responses.activate
- def test_create_security_group_target_binding_value_error(self):
+ def test_get_subnet_value_error(self):
"""
- test_create_security_group_target_binding_value_error()
+ test_get_subnet_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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}'
+ url = preprocess_url('/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.PUT,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
@@ -41589,314 +42142,267 @@ def test_create_security_group_target_binding_value_error(self):
)
# 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_subnet(**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_subnet_value_error_with_retries(self):
+ # Enable retries and run test_get_subnet_value_error.
_service.enable_retries()
- self.test_create_security_group_target_binding_value_error()
+ self.test_get_subnet_value_error()
- # Disable retries and run test_create_security_group_target_binding_value_error.
+ # Disable retries and run test_get_subnet_value_error.
_service.disable_retries()
- self.test_create_security_group_target_binding_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: SecurityGroups
-##############################################################################
-
-##############################################################################
-# Start of Service: VPNGateways
-##############################################################################
-# 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,
- )
+ self.test_get_subnet_value_error()
-class TestListIkePolicies:
+class TestUpdateSubnet:
"""
- Test Class for list_ike_policies
+ Test Class for update_subnet
"""
@responses.activate
- def test_list_ike_policies_all_params(self):
+ def test_update_subnet_all_params(self):
"""
- list_ike_policies()
+ update_subnet()
"""
# Set up mock
- url = preprocess_url('/ike_policies')
- mock_response = '{"first": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a NetworkACLIdentityById model
+ network_acl_identity_model = {}
+ network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
+
+ # Construct a dict representation of a SubnetPublicGatewayPatchPublicGatewayIdentityById model
+ subnet_public_gateway_patch_model = {}
+ subnet_public_gateway_patch_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
+
+ # Construct a dict representation of a RoutingTableIdentityByCRN model
+ routing_table_identity_model = {}
+ routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+
+ # Construct a dict representation of a SubnetPatch model
+ subnet_patch_model = {}
+ subnet_patch_model['name'] = 'my-subnet'
+ subnet_patch_model['network_acl'] = network_acl_identity_model
+ subnet_patch_model['public_gateway'] = subnet_public_gateway_patch_model
+ subnet_patch_model['routing_table'] = routing_table_identity_model
+
# Set up parameter values
- start = 'testString'
- limit = 50
+ id = 'testString'
+ subnet_patch = subnet_patch_model
# Invoke method
- response = _service.list_ike_policies(
- start=start,
- limit=limit,
+ response = _service.update_subnet(
+ id,
+ subnet_patch,
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
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body == subnet_patch
- def test_list_ike_policies_all_params_with_retries(self):
- # Enable retries and run test_list_ike_policies_all_params.
+ def test_update_subnet_all_params_with_retries(self):
+ # Enable retries and run test_update_subnet_all_params.
_service.enable_retries()
- self.test_list_ike_policies_all_params()
+ self.test_update_subnet_all_params()
- # Disable retries and run test_list_ike_policies_all_params.
+ # Disable retries and run test_update_subnet_all_params.
_service.disable_retries()
- self.test_list_ike_policies_all_params()
+ self.test_update_subnet_all_params()
@responses.activate
- def test_list_ike_policies_required_params(self):
+ def test_update_subnet_value_error(self):
"""
- test_list_ike_policies_required_params()
+ test_update_subnet_value_error()
"""
# Set up mock
- url = preprocess_url('/ike_policies')
- mock_response = '{"first": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString')
+ mock_response = '{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Invoke method
- response = _service.list_ike_policies()
+ # Construct a dict representation of a NetworkACLIdentityById model
+ network_acl_identity_model = {}
+ network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
+ # Construct a dict representation of a SubnetPublicGatewayPatchPublicGatewayIdentityById model
+ subnet_public_gateway_patch_model = {}
+ subnet_public_gateway_patch_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
- 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_ike_policies_required_params()
+ # Construct a dict representation of a RoutingTableIdentityByCRN model
+ routing_table_identity_model = {}
+ routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
- # Disable retries and run test_list_ike_policies_required_params.
- _service.disable_retries()
- self.test_list_ike_policies_required_params()
+ # Construct a dict representation of a SubnetPatch model
+ subnet_patch_model = {}
+ subnet_patch_model['name'] = 'my-subnet'
+ subnet_patch_model['network_acl'] = network_acl_identity_model
+ subnet_patch_model['public_gateway'] = subnet_public_gateway_patch_model
+ subnet_patch_model['routing_table'] = routing_table_identity_model
- @responses.activate
- def test_list_ike_policies_value_error(self):
- """
- test_list_ike_policies_value_error()
- """
- # Set up mock
- url = preprocess_url('/ike_policies')
- mock_response = '{"first": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Set up parameter values
+ id = 'testString'
+ subnet_patch = subnet_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "id": id,
+ "subnet_patch": subnet_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_ike_policies(**req_copy)
+ _service.update_subnet(**req_copy)
- def test_list_ike_policies_value_error_with_retries(self):
- # Enable retries and run test_list_ike_policies_value_error.
+ def test_update_subnet_value_error_with_retries(self):
+ # Enable retries and run test_update_subnet_value_error.
_service.enable_retries()
- self.test_list_ike_policies_value_error()
+ self.test_update_subnet_value_error()
- # Disable retries and run test_list_ike_policies_value_error.
+ # Disable retries and run test_update_subnet_value_error.
_service.disable_retries()
- self.test_list_ike_policies_value_error()
+ self.test_update_subnet_value_error()
- @responses.activate
- def test_list_ike_policies_with_pager_get_next(self):
- """
- test_list_ike_policies_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/ike_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
- mock_response2 = '{"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
- # Exercise the pager class for this operation
- all_results = []
- pager = IkePoliciesPager(
- client=_service,
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+class TestGetSubnetNetworkAcl:
+ """
+ Test Class for get_subnet_network_acl
+ """
@responses.activate
- def test_list_ike_policies_with_pager_get_all(self):
+ def test_get_subnet_network_acl_all_params(self):
"""
- test_list_ike_policies_with_pager_get_all()
+ get_subnet_network_acl()
"""
- # Set up a two-page mock response
- url = preprocess_url('/ike_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
- mock_response2 = '{"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
+ # Set up mock
+ url = preprocess_url('/subnets/testString/network_acl')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
- body=mock_response1,
+ body=mock_response,
content_type='application/json',
status=200,
)
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.get_subnet_network_acl(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_get_subnet_network_acl_all_params_with_retries(self):
+ # Enable retries and run test_get_subnet_network_acl_all_params.
+ _service.enable_retries()
+ self.test_get_subnet_network_acl_all_params()
+
+ # Disable retries and run test_get_subnet_network_acl_all_params.
+ _service.disable_retries()
+ self.test_get_subnet_network_acl_all_params()
+
+ @responses.activate
+ def test_get_subnet_network_acl_value_error(self):
+ """
+ test_get_subnet_network_acl_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/subnets/testString/network_acl')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
responses.GET,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- pager = IkePoliciesPager(
- client=_service,
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # 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_subnet_network_acl(**req_copy)
+
+ def test_get_subnet_network_acl_value_error_with_retries(self):
+ # Enable retries and run test_get_subnet_network_acl_value_error.
+ _service.enable_retries()
+ self.test_get_subnet_network_acl_value_error()
+ # Disable retries and run test_get_subnet_network_acl_value_error.
+ _service.disable_retries()
+ self.test_get_subnet_network_acl_value_error()
-class TestCreateIkePolicy:
+
+class TestReplaceSubnetNetworkAcl:
"""
- Test Class for create_ike_policy
+ Test Class for replace_subnet_network_acl
"""
@responses.activate
- def test_create_ike_policy_all_params(self):
+ def test_replace_subnet_network_acl_all_params(self):
"""
- create_ike_policy()
+ replace_subnet_network_acl()
"""
# 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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('/subnets/testString/network_acl')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.POST,
+ 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'
+ # Construct a dict representation of a NetworkACLIdentityById model
+ network_acl_identity_model = {}
+ network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
# Set up parameter values
- authentication_algorithm = 'sha256'
- dh_group = 14
- encryption_algorithm = 'aes128'
- ike_version = 1
- key_lifetime = 28800
- name = 'my-ike-policy'
- resource_group = resource_group_identity_model
+ id = 'testString'
+ network_acl_identity = network_acl_identity_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.replace_subnet_network_acl(
+ id,
+ network_acl_identity,
headers={},
)
@@ -41905,86 +42411,73 @@ 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'] == 'sha256'
- 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 == network_acl_identity
- def test_create_ike_policy_all_params_with_retries(self):
- # Enable retries and run test_create_ike_policy_all_params.
+ def test_replace_subnet_network_acl_all_params_with_retries(self):
+ # Enable retries and run test_replace_subnet_network_acl_all_params.
_service.enable_retries()
- self.test_create_ike_policy_all_params()
+ self.test_replace_subnet_network_acl_all_params()
- # Disable retries and run test_create_ike_policy_all_params.
+ # Disable retries and run test_replace_subnet_network_acl_all_params.
_service.disable_retries()
- self.test_create_ike_policy_all_params()
+ self.test_replace_subnet_network_acl_all_params()
@responses.activate
- def test_create_ike_policy_value_error(self):
+ def test_replace_subnet_network_acl_value_error(self):
"""
- test_create_ike_policy_value_error()
+ test_replace_subnet_network_acl_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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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('/subnets/testString/network_acl')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.POST,
+ 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'
+ # Construct a dict representation of a NetworkACLIdentityById model
+ network_acl_identity_model = {}
+ network_acl_identity_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
# Set up parameter values
- authentication_algorithm = 'sha256'
- dh_group = 14
- encryption_algorithm = 'aes128'
- ike_version = 1
- key_lifetime = 28800
- name = 'my-ike-policy'
- resource_group = resource_group_identity_model
+ id = 'testString'
+ network_acl_identity = network_acl_identity_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,
+ "id": id,
+ "network_acl_identity": network_acl_identity,
}
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.replace_subnet_network_acl(**req_copy)
- def test_create_ike_policy_value_error_with_retries(self):
- # Enable retries and run test_create_ike_policy_value_error.
+ def test_replace_subnet_network_acl_value_error_with_retries(self):
+ # Enable retries and run test_replace_subnet_network_acl_value_error.
_service.enable_retries()
- self.test_create_ike_policy_value_error()
+ self.test_replace_subnet_network_acl_value_error()
- # Disable retries and run test_create_ike_policy_value_error.
+ # Disable retries and run test_replace_subnet_network_acl_value_error.
_service.disable_retries()
- self.test_create_ike_policy_value_error()
+ self.test_replace_subnet_network_acl_value_error()
-class TestDeleteIkePolicy:
+class TestUnsetSubnetPublicGateway:
"""
- Test Class for delete_ike_policy
+ Test Class for unset_subnet_public_gateway
"""
@responses.activate
- def test_delete_ike_policy_all_params(self):
+ def test_unset_subnet_public_gateway_all_params(self):
"""
- delete_ike_policy()
+ unset_subnet_public_gateway()
"""
# Set up mock
- url = preprocess_url('/ike_policies/testString')
+ url = preprocess_url('/subnets/testString/public_gateway')
responses.add(
responses.DELETE,
url,
@@ -41995,7 +42488,7 @@ def test_delete_ike_policy_all_params(self):
id = 'testString'
# Invoke method
- response = _service.delete_ike_policy(
+ response = _service.unset_subnet_public_gateway(
id,
headers={},
)
@@ -42004,22 +42497,22 @@ def test_delete_ike_policy_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_ike_policy_all_params_with_retries(self):
- # Enable retries and run test_delete_ike_policy_all_params.
+ def test_unset_subnet_public_gateway_all_params_with_retries(self):
+ # Enable retries and run test_unset_subnet_public_gateway_all_params.
_service.enable_retries()
- self.test_delete_ike_policy_all_params()
+ self.test_unset_subnet_public_gateway_all_params()
- # Disable retries and run test_delete_ike_policy_all_params.
+ # Disable retries and run test_unset_subnet_public_gateway_all_params.
_service.disable_retries()
- self.test_delete_ike_policy_all_params()
+ self.test_unset_subnet_public_gateway_all_params()
@responses.activate
- def test_delete_ike_policy_value_error(self):
+ def test_unset_subnet_public_gateway_value_error(self):
"""
- test_delete_ike_policy_value_error()
+ test_unset_subnet_public_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/ike_policies/testString')
+ url = preprocess_url('/subnets/testString/public_gateway')
responses.add(
responses.DELETE,
url,
@@ -42036,31 +42529,31 @@ def test_delete_ike_policy_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_ike_policy(**req_copy)
+ _service.unset_subnet_public_gateway(**req_copy)
- def test_delete_ike_policy_value_error_with_retries(self):
- # Enable retries and run test_delete_ike_policy_value_error.
+ def test_unset_subnet_public_gateway_value_error_with_retries(self):
+ # Enable retries and run test_unset_subnet_public_gateway_value_error.
_service.enable_retries()
- self.test_delete_ike_policy_value_error()
+ self.test_unset_subnet_public_gateway_value_error()
- # Disable retries and run test_delete_ike_policy_value_error.
+ # Disable retries and run test_unset_subnet_public_gateway_value_error.
_service.disable_retries()
- self.test_delete_ike_policy_value_error()
+ self.test_unset_subnet_public_gateway_value_error()
-class TestGetIkePolicy:
+class TestGetSubnetPublicGateway:
"""
- Test Class for get_ike_policy
+ Test Class for get_subnet_public_gateway
"""
@responses.activate
- def test_get_ike_policy_all_params(self):
+ def test_get_subnet_public_gateway_all_params(self):
"""
- get_ike_policy()
+ get_subnet_public_gateway()
"""
# 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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('/subnets/testString/public_gateway')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -42073,7 +42566,7 @@ def test_get_ike_policy_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_ike_policy(
+ response = _service.get_subnet_public_gateway(
id,
headers={},
)
@@ -42082,23 +42575,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_subnet_public_gateway_all_params_with_retries(self):
+ # Enable retries and run test_get_subnet_public_gateway_all_params.
_service.enable_retries()
- self.test_get_ike_policy_all_params()
+ self.test_get_subnet_public_gateway_all_params()
- # Disable retries and run test_get_ike_policy_all_params.
+ # Disable retries and run test_get_subnet_public_gateway_all_params.
_service.disable_retries()
- self.test_get_ike_policy_all_params()
+ self.test_get_subnet_public_gateway_all_params()
@responses.activate
- def test_get_ike_policy_value_error(self):
+ def test_get_subnet_public_gateway_value_error(self):
"""
- test_get_ike_policy_value_error()
+ test_get_subnet_public_gateway_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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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('/subnets/testString/public_gateway')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -42117,137 +42610,127 @@ def test_get_ike_policy_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_ike_policy(**req_copy)
+ _service.get_subnet_public_gateway(**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_subnet_public_gateway_value_error_with_retries(self):
+ # Enable retries and run test_get_subnet_public_gateway_value_error.
_service.enable_retries()
- self.test_get_ike_policy_value_error()
+ self.test_get_subnet_public_gateway_value_error()
- # Disable retries and run test_get_ike_policy_value_error.
+ # Disable retries and run test_get_subnet_public_gateway_value_error.
_service.disable_retries()
- self.test_get_ike_policy_value_error()
+ self.test_get_subnet_public_gateway_value_error()
-class TestUpdateIkePolicy:
+class TestSetSubnetPublicGateway:
"""
- Test Class for update_ike_policy
+ Test Class for set_subnet_public_gateway
"""
@responses.activate
- def test_update_ike_policy_all_params(self):
+ def test_set_subnet_public_gateway_all_params(self):
"""
- update_ike_policy()
+ set_subnet_public_gateway()
"""
# 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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('/subnets/testString/public_gateway')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a IKEPolicyPatch model
- ike_policy_patch_model = {}
- ike_policy_patch_model['authentication_algorithm'] = 'sha256'
- 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'] = 86400
- ike_policy_patch_model['name'] = 'my-ike-policy'
+ # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
+ public_gateway_identity_model = {}
+ public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
# Set up parameter values
id = 'testString'
- ike_policy_patch = ike_policy_patch_model
+ public_gateway_identity = public_gateway_identity_model
# Invoke method
- response = _service.update_ike_policy(
+ response = _service.set_subnet_public_gateway(
id,
- ike_policy_patch,
+ public_gateway_identity,
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 == ike_policy_patch
+ assert req_body == public_gateway_identity
- def test_update_ike_policy_all_params_with_retries(self):
- # Enable retries and run test_update_ike_policy_all_params.
+ def test_set_subnet_public_gateway_all_params_with_retries(self):
+ # Enable retries and run test_set_subnet_public_gateway_all_params.
_service.enable_retries()
- self.test_update_ike_policy_all_params()
+ self.test_set_subnet_public_gateway_all_params()
- # Disable retries and run test_update_ike_policy_all_params.
+ # Disable retries and run test_set_subnet_public_gateway_all_params.
_service.disable_retries()
- self.test_update_ike_policy_all_params()
+ self.test_set_subnet_public_gateway_all_params()
@responses.activate
- def test_update_ike_policy_value_error(self):
+ def test_set_subnet_public_gateway_value_error(self):
"""
- test_update_ike_policy_value_error()
+ test_set_subnet_public_gateway_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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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('/subnets/testString/public_gateway')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/r006-dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "r006-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/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a IKEPolicyPatch model
- ike_policy_patch_model = {}
- ike_policy_patch_model['authentication_algorithm'] = 'sha256'
- 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'] = 86400
- ike_policy_patch_model['name'] = 'my-ike-policy'
+ # Construct a dict representation of a PublicGatewayIdentityPublicGatewayIdentityById model
+ public_gateway_identity_model = {}
+ public_gateway_identity_model['id'] = 'r006-dc5431ef-1fc6-4861-adc9-a59d077d1241'
# Set up parameter values
id = 'testString'
- ike_policy_patch = ike_policy_patch_model
+ public_gateway_identity = public_gateway_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "ike_policy_patch": ike_policy_patch,
+ "public_gateway_identity": public_gateway_identity,
}
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.set_subnet_public_gateway(**req_copy)
- def test_update_ike_policy_value_error_with_retries(self):
- # Enable retries and run test_update_ike_policy_value_error.
+ def test_set_subnet_public_gateway_value_error_with_retries(self):
+ # Enable retries and run test_set_subnet_public_gateway_value_error.
_service.enable_retries()
- self.test_update_ike_policy_value_error()
+ self.test_set_subnet_public_gateway_value_error()
- # Disable retries and run test_update_ike_policy_value_error.
+ # Disable retries and run test_set_subnet_public_gateway_value_error.
_service.disable_retries()
- self.test_update_ike_policy_value_error()
+ self.test_set_subnet_public_gateway_value_error()
-class TestListIkePolicyConnections:
+class TestGetSubnetRoutingTable:
"""
- Test Class for list_ike_policy_connections
+ Test Class for get_subnet_routing_table
"""
@responses.activate
- def test_list_ike_policy_connections_all_params(self):
+ def test_get_subnet_routing_table_all_params(self):
"""
- list_ike_policy_connections()
+ get_subnet_routing_table()
"""
# 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/routing_table')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
responses.GET,
url,
@@ -42258,43 +42741,34 @@ def test_list_ike_policy_connections_all_params(self):
# Set up parameter values
id = 'testString'
- start = 'testString'
- limit = 50
# Invoke method
- response = _service.list_ike_policy_connections(
+ response = _service.get_subnet_routing_table(
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_ike_policy_connections_all_params_with_retries(self):
- # Enable retries and run test_list_ike_policy_connections_all_params.
+ def test_get_subnet_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_get_subnet_routing_table_all_params.
_service.enable_retries()
- self.test_list_ike_policy_connections_all_params()
+ self.test_get_subnet_routing_table_all_params()
- # Disable retries and run test_list_ike_policy_connections_all_params.
+ # Disable retries and run test_get_subnet_routing_table_all_params.
_service.disable_retries()
- self.test_list_ike_policy_connections_all_params()
+ self.test_get_subnet_routing_table_all_params()
@responses.activate
- def test_list_ike_policy_connections_required_params(self):
+ def test_get_subnet_routing_table_value_error(self):
"""
- test_list_ike_policy_connections_required_params()
+ test_get_subnet_routing_table_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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/routing_table')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
responses.GET,
url,
@@ -42306,147 +42780,134 @@ def test_list_ike_policy_connections_required_params(self):
# Set up parameter values
id = 'testString'
- # Invoke method
- response = _service.list_ike_policy_connections(
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
+ # 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_subnet_routing_table(**req_copy)
- def test_list_ike_policy_connections_required_params_with_retries(self):
- # Enable retries and run test_list_ike_policy_connections_required_params.
+ def test_get_subnet_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_get_subnet_routing_table_value_error.
_service.enable_retries()
- self.test_list_ike_policy_connections_required_params()
+ self.test_get_subnet_routing_table_value_error()
- # Disable retries and run test_list_ike_policy_connections_required_params.
+ # Disable retries and run test_get_subnet_routing_table_value_error.
_service.disable_retries()
- self.test_list_ike_policy_connections_required_params()
+ self.test_get_subnet_routing_table_value_error()
+
+
+class TestReplaceSubnetRoutingTable:
+ """
+ Test Class for replace_subnet_routing_table
+ """
@responses.activate
- def test_list_ike_policy_connections_value_error(self):
+ def test_replace_subnet_routing_table_all_params(self):
"""
- test_list_ike_policy_connections_value_error()
+ replace_subnet_routing_table()
"""
# 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/routing_table')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.GET,
+ responses.PUT,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a RoutingTableIdentityByCRN model
+ routing_table_identity_model = {}
+ routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+
# Set up parameter values
id = 'testString'
+ routing_table_identity = routing_table_identity_model
- # 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.list_ike_policy_connections(**req_copy)
+ # Invoke method
+ response = _service.replace_subnet_routing_table(
+ id,
+ routing_table_identity,
+ headers={},
+ )
- def test_list_ike_policy_connections_value_error_with_retries(self):
- # Enable retries and run test_list_ike_policy_connections_value_error.
+ # 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 == routing_table_identity
+
+ def test_replace_subnet_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_replace_subnet_routing_table_all_params.
_service.enable_retries()
- self.test_list_ike_policy_connections_value_error()
+ self.test_replace_subnet_routing_table_all_params()
- # Disable retries and run test_list_ike_policy_connections_value_error.
+ # Disable retries and run test_replace_subnet_routing_table_all_params.
_service.disable_retries()
- self.test_list_ike_policy_connections_value_error()
-
- @responses.activate
- def test_list_ike_policy_connections_with_pager_get_next(self):
- """
- test_list_ike_policy_connections_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/ike_policies/testString/connections')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = IkePolicyConnectionsPager(
- client=_service,
- id='testString',
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+ self.test_replace_subnet_routing_table_all_params()
@responses.activate
- def test_list_ike_policy_connections_with_pager_get_all(self):
+ def test_replace_subnet_routing_table_value_error(self):
"""
- test_list_ike_policy_connections_with_pager_get_all()
+ test_replace_subnet_routing_table_value_error()
"""
- # Set up a two-page mock response
- url = preprocess_url('/ike_policies/testString/connections')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/subnets/testString/routing_table')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.GET,
+ responses.PUT,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
- # Exercise the pager class for this operation
- pager = IkePolicyConnectionsPager(
- client=_service,
- id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Construct a dict representation of a RoutingTableIdentityByCRN model
+ routing_table_identity_model = {}
+ routing_table_identity_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+ # Set up parameter values
+ id = 'testString'
+ routing_table_identity = routing_table_identity_model
-class TestListIpsecPolicies:
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "id": id,
+ "routing_table_identity": routing_table_identity,
+ }
+ 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.replace_subnet_routing_table(**req_copy)
+
+ def test_replace_subnet_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_replace_subnet_routing_table_value_error.
+ _service.enable_retries()
+ self.test_replace_subnet_routing_table_value_error()
+
+ # Disable retries and run test_replace_subnet_routing_table_value_error.
+ _service.disable_retries()
+ self.test_replace_subnet_routing_table_value_error()
+
+
+class TestListSubnetReservedIps:
"""
- Test Class for list_ipsec_policies
+ Test Class for list_subnet_reserved_ips
"""
@responses.activate
- def test_list_ipsec_policies_all_params(self):
+ def test_list_subnet_reserved_ips_all_params(self):
"""
- list_ipsec_policies()
+ list_subnet_reserved_ips()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies')
- mock_response = '{"first": {"href": "href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -42456,13 +42917,25 @@ def test_list_ipsec_policies_all_params(self):
)
# Set up parameter values
+ subnet_id = 'testString'
start = 'testString'
limit = 50
+ sort = 'name'
+ target_id = 'testString'
+ target_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
+ target_name = 'my-resource'
+ target_resource_type = 'testString'
# Invoke method
- response = _service.list_ipsec_policies(
+ response = _service.list_subnet_reserved_ips(
+ subnet_id,
start=start,
limit=limit,
+ sort=sort,
+ target_id=target_id,
+ target_crn=target_crn,
+ target_name=target_name,
+ target_resource_type=target_resource_type,
headers={},
)
@@ -42474,24 +42947,29 @@ def test_list_ipsec_policies_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 'sort={}'.format(sort) in query_string
+ assert 'target.id={}'.format(target_id) in query_string
+ assert 'target.crn={}'.format(target_crn) in query_string
+ assert 'target.name={}'.format(target_name) in query_string
+ assert 'target.resource_type={}'.format(target_resource_type) in query_string
- def test_list_ipsec_policies_all_params_with_retries(self):
- # Enable retries and run test_list_ipsec_policies_all_params.
+ def test_list_subnet_reserved_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_subnet_reserved_ips_all_params.
_service.enable_retries()
- self.test_list_ipsec_policies_all_params()
+ self.test_list_subnet_reserved_ips_all_params()
- # Disable retries and run test_list_ipsec_policies_all_params.
+ # Disable retries and run test_list_subnet_reserved_ips_all_params.
_service.disable_retries()
- self.test_list_ipsec_policies_all_params()
+ self.test_list_subnet_reserved_ips_all_params()
@responses.activate
- def test_list_ipsec_policies_required_params(self):
+ def test_list_subnet_reserved_ips_required_params(self):
"""
- test_list_ipsec_policies_required_params()
+ test_list_subnet_reserved_ips_required_params()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies')
- mock_response = '{"first": {"href": "href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -42500,30 +42978,36 @@ def test_list_ipsec_policies_required_params(self):
status=200,
)
+ # Set up parameter values
+ subnet_id = 'testString'
+
# Invoke method
- response = _service.list_ipsec_policies()
+ response = _service.list_subnet_reserved_ips(
+ subnet_id,
+ headers={},
+ )
# 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.
+ def test_list_subnet_reserved_ips_required_params_with_retries(self):
+ # Enable retries and run test_list_subnet_reserved_ips_required_params.
_service.enable_retries()
- self.test_list_ipsec_policies_required_params()
+ self.test_list_subnet_reserved_ips_required_params()
- # Disable retries and run test_list_ipsec_policies_required_params.
+ # Disable retries and run test_list_subnet_reserved_ips_required_params.
_service.disable_retries()
- self.test_list_ipsec_policies_required_params()
+ self.test_list_subnet_reserved_ips_required_params()
@responses.activate
- def test_list_ipsec_policies_value_error(self):
+ def test_list_subnet_reserved_ips_value_error(self):
"""
- test_list_ipsec_policies_value_error()
+ test_list_subnet_reserved_ips_value_error()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies')
- mock_response = '{"first": {"href": "href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -42532,32 +43016,36 @@ def test_list_ipsec_policies_value_error(self):
status=200,
)
+ # Set up parameter values
+ subnet_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "subnet_id": subnet_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_ipsec_policies(**req_copy)
+ _service.list_subnet_reserved_ips(**req_copy)
- def test_list_ipsec_policies_value_error_with_retries(self):
- # Enable retries and run test_list_ipsec_policies_value_error.
+ def test_list_subnet_reserved_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_subnet_reserved_ips_value_error.
_service.enable_retries()
- self.test_list_ipsec_policies_value_error()
+ self.test_list_subnet_reserved_ips_value_error()
- # Disable retries and run test_list_ipsec_policies_value_error.
+ # Disable retries and run test_list_subnet_reserved_ips_value_error.
_service.disable_retries()
- self.test_list_ipsec_policies_value_error()
+ self.test_list_subnet_reserved_ips_value_error()
@responses.activate
- def test_list_ipsec_policies_with_pager_get_next(self):
+ def test_list_subnet_reserved_ips_with_pager_get_next(self):
"""
- test_list_ipsec_policies_with_pager_get_next()
+ test_list_subnet_reserved_ips_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/ipsec_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
- mock_response2 = '{"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -42575,9 +43063,15 @@ def test_list_ipsec_policies_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = IpsecPoliciesPager(
+ pager = SubnetReservedIpsPager(
client=_service,
+ subnet_id='testString',
limit=10,
+ sort='name',
+ target_id='testString',
+ target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
+ target_name='my-resource',
+ target_resource_type='testString',
)
while pager.has_next():
next_page = pager.get_next()
@@ -42586,14 +43080,14 @@ def test_list_ipsec_policies_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_ipsec_policies_with_pager_get_all(self):
+ def test_list_subnet_reserved_ips_with_pager_get_all(self):
"""
- test_list_ipsec_policies_with_pager_get_all()
+ test_list_subnet_reserved_ips_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/ipsec_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
- mock_response2 = '{"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -42610,28 +43104,34 @@ def test_list_ipsec_policies_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = IpsecPoliciesPager(
+ pager = SubnetReservedIpsPager(
client=_service,
+ subnet_id='testString',
limit=10,
+ sort='name',
+ target_id='testString',
+ target_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727',
+ target_name='my-resource',
+ target_resource_type='testString',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateIpsecPolicy:
+class TestCreateSubnetReservedIp:
"""
- Test Class for create_ipsec_policy
+ Test Class for create_subnet_reserved_ip
"""
@responses.activate
- def test_create_ipsec_policy_all_params(self):
+ def test_create_subnet_reserved_ip_all_params(self):
"""
- create_ipsec_policy()
+ create_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies')
- mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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"}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ 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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
responses.POST,
url,
@@ -42640,26 +43140,24 @@ def test_create_ipsec_policy_all_params(self):
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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityById model
+ reserved_ip_target_prototype_model = {}
+ reserved_ip_target_prototype_model['id'] = 'r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0'
# Set up parameter values
- authentication_algorithm = 'disabled'
- encryption_algorithm = 'aes128'
- pfs = 'disabled'
- key_lifetime = 3600
- name = 'my-ipsec-policy'
- resource_group = resource_group_identity_model
+ subnet_id = 'testString'
+ address = '192.168.3.4'
+ auto_delete = False
+ name = 'my-reserved-ip'
+ target = reserved_ip_target_prototype_model
# Invoke method
- response = _service.create_ipsec_policy(
- authentication_algorithm,
- encryption_algorithm,
- pfs,
- key_lifetime=key_lifetime,
+ response = _service.create_subnet_reserved_ip(
+ subnet_id,
+ address=address,
+ auto_delete=auto_delete,
name=name,
- resource_group=resource_group,
+ target=target,
headers={},
)
@@ -42668,30 +43166,28 @@ def test_create_ipsec_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'] == 'disabled'
- 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 req_body['address'] == '192.168.3.4'
+ assert req_body['auto_delete'] == False
+ assert req_body['name'] == 'my-reserved-ip'
+ assert req_body['target'] == reserved_ip_target_prototype_model
- def test_create_ipsec_policy_all_params_with_retries(self):
- # Enable retries and run test_create_ipsec_policy_all_params.
+ def test_create_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_create_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_create_ipsec_policy_all_params()
+ self.test_create_subnet_reserved_ip_all_params()
- # Disable retries and run test_create_ipsec_policy_all_params.
+ # Disable retries and run test_create_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_create_ipsec_policy_all_params()
+ self.test_create_subnet_reserved_ip_all_params()
@responses.activate
- def test_create_ipsec_policy_value_error(self):
+ def test_create_subnet_reserved_ip_value_error(self):
"""
- test_create_ipsec_policy_value_error()
+ test_create_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies')
- mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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"}'
+ url = preprocess_url('/subnets/testString/reserved_ips')
+ 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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
responses.POST,
url,
@@ -42700,51 +43196,48 @@ def test_create_ipsec_policy_value_error(self):
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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityById model
+ reserved_ip_target_prototype_model = {}
+ reserved_ip_target_prototype_model['id'] = 'r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0'
# Set up parameter values
- authentication_algorithm = 'disabled'
- encryption_algorithm = 'aes128'
- pfs = 'disabled'
- key_lifetime = 3600
- name = 'my-ipsec-policy'
- resource_group = resource_group_identity_model
+ subnet_id = 'testString'
+ address = '192.168.3.4'
+ auto_delete = False
+ name = 'my-reserved-ip'
+ target = reserved_ip_target_prototype_model
# 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,
+ "subnet_id": subnet_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_ipsec_policy(**req_copy)
+ _service.create_subnet_reserved_ip(**req_copy)
- def test_create_ipsec_policy_value_error_with_retries(self):
- # Enable retries and run test_create_ipsec_policy_value_error.
+ def test_create_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_create_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_create_ipsec_policy_value_error()
+ self.test_create_subnet_reserved_ip_value_error()
- # Disable retries and run test_create_ipsec_policy_value_error.
+ # Disable retries and run test_create_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_create_ipsec_policy_value_error()
+ self.test_create_subnet_reserved_ip_value_error()
-class TestDeleteIpsecPolicy:
+class TestDeleteSubnetReservedIp:
"""
- Test Class for delete_ipsec_policy
+ Test Class for delete_subnet_reserved_ip
"""
@responses.activate
- def test_delete_ipsec_policy_all_params(self):
+ def test_delete_subnet_reserved_ip_all_params(self):
"""
- delete_ipsec_policy()
+ delete_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies/testString')
+ url = preprocess_url('/subnets/testString/reserved_ips/testString')
responses.add(
responses.DELETE,
url,
@@ -42752,10 +43245,12 @@ def test_delete_ipsec_policy_all_params(self):
)
# Set up parameter values
+ subnet_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_ipsec_policy(
+ response = _service.delete_subnet_reserved_ip(
+ subnet_id,
id,
headers={},
)
@@ -42764,22 +43259,22 @@ def test_delete_ipsec_policy_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_ipsec_policy_all_params_with_retries(self):
- # Enable retries and run test_delete_ipsec_policy_all_params.
+ def test_delete_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_delete_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_delete_ipsec_policy_all_params()
+ self.test_delete_subnet_reserved_ip_all_params()
- # Disable retries and run test_delete_ipsec_policy_all_params.
+ # Disable retries and run test_delete_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_delete_ipsec_policy_all_params()
+ self.test_delete_subnet_reserved_ip_all_params()
@responses.activate
- def test_delete_ipsec_policy_value_error(self):
+ def test_delete_subnet_reserved_ip_value_error(self):
"""
- test_delete_ipsec_policy_value_error()
+ test_delete_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies/testString')
+ url = preprocess_url('/subnets/testString/reserved_ips/testString')
responses.add(
responses.DELETE,
url,
@@ -42787,40 +43282,42 @@ def test_delete_ipsec_policy_value_error(self):
)
# Set up parameter values
+ subnet_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "subnet_id": subnet_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.delete_subnet_reserved_ip(**req_copy)
- def test_delete_ipsec_policy_value_error_with_retries(self):
- # Enable retries and run test_delete_ipsec_policy_value_error.
+ def test_delete_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_delete_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_delete_ipsec_policy_value_error()
+ self.test_delete_subnet_reserved_ip_value_error()
- # Disable retries and run test_delete_ipsec_policy_value_error.
+ # Disable retries and run test_delete_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_delete_ipsec_policy_value_error()
+ self.test_delete_subnet_reserved_ip_value_error()
-class TestGetIpsecPolicy:
+class TestGetSubnetReservedIp:
"""
- Test Class for get_ipsec_policy
+ Test Class for get_subnet_reserved_ip
"""
@responses.activate
- def test_get_ipsec_policy_all_params(self):
+ def test_get_subnet_reserved_ip_all_params(self):
"""
- get_ipsec_policy()
+ get_subnet_reserved_ip()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies/testString')
- mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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"}'
+ url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
responses.GET,
url,
@@ -42830,10 +43327,12 @@ def test_get_ipsec_policy_all_params(self):
)
# Set up parameter values
+ subnet_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_ipsec_policy(
+ response = _service.get_subnet_reserved_ip(
+ subnet_id,
id,
headers={},
)
@@ -42842,23 +43341,23 @@ def test_get_ipsec_policy_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_ipsec_policy_all_params_with_retries(self):
- # Enable retries and run test_get_ipsec_policy_all_params.
+ def test_get_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_get_ipsec_policy_all_params()
+ self.test_get_subnet_reserved_ip_all_params()
- # Disable retries and run test_get_ipsec_policy_all_params.
+ # Disable retries and run test_get_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_get_ipsec_policy_all_params()
+ self.test_get_subnet_reserved_ip_all_params()
@responses.activate
- def test_get_ipsec_policy_value_error(self):
+ def test_get_subnet_reserved_ip_value_error(self):
"""
- test_get_ipsec_policy_value_error()
+ test_get_subnet_reserved_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/ipsec_policies/testString')
- mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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"}'
+ url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
responses.GET,
url,
@@ -42868,343 +43367,201 @@ def test_get_ipsec_policy_value_error(self):
)
# Set up parameter values
+ subnet_id = 'testString'
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": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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'] = 'disabled'
- 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_update_ipsec_policy_all_params()
-
- @responses.activate
- def test_update_ipsec_policy_value_error(self):
- """
- test_update_ipsec_policy_value_error()
- """
- # Set up mock
- url = preprocess_url('/ipsec_policies/testString')
- mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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'] = 'disabled'
- 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
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "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.update_ipsec_policy(**req_copy)
-
- 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_update_ipsec_policy_value_error()
-
- # Disable retries and run test_update_ipsec_policy_value_error.
- _service.disable_retries()
- self.test_update_ipsec_policy_value_error()
-
-
-class TestListIpsecPolicyConnections:
- """
- Test Class for list_ipsec_policy_connections
- """
-
- @responses.activate
- def test_list_ipsec_policy_connections_all_params(self):
- """
- list_ipsec_policy_connections()
- """
- # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- id = 'testString'
- start = 'testString'
- limit = 50
-
- # Invoke method
- response = _service.list_ipsec_policy_connections(
- 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
+ req_param_dict = {
+ "subnet_id": subnet_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_subnet_reserved_ip(**req_copy)
- def test_list_ipsec_policy_connections_all_params_with_retries(self):
- # Enable retries and run test_list_ipsec_policy_connections_all_params.
+ def test_get_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_list_ipsec_policy_connections_all_params()
+ self.test_get_subnet_reserved_ip_value_error()
- # Disable retries and run test_list_ipsec_policy_connections_all_params.
+ # Disable retries and run test_get_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_list_ipsec_policy_connections_all_params()
+ self.test_get_subnet_reserved_ip_value_error()
+
+
+class TestUpdateSubnetReservedIp:
+ """
+ Test Class for update_subnet_reserved_ip
+ """
@responses.activate
- def test_list_ipsec_policy_connections_required_params(self):
+ def test_update_subnet_reserved_ip_all_params(self):
"""
- test_list_ipsec_policy_connections_required_params()
+ update_subnet_reserved_ip()
"""
# 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ReservedIPPatch model
+ reserved_ip_patch_model = {}
+ reserved_ip_patch_model['auto_delete'] = False
+ reserved_ip_patch_model['name'] = 'my-reserved-ip-updated'
+
# Set up parameter values
+ subnet_id = 'testString'
id = 'testString'
+ reserved_ip_patch = reserved_ip_patch_model
# Invoke method
- response = _service.list_ipsec_policy_connections(
+ response = _service.update_subnet_reserved_ip(
+ subnet_id,
id,
+ reserved_ip_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 == reserved_ip_patch
- def test_list_ipsec_policy_connections_required_params_with_retries(self):
- # Enable retries and run test_list_ipsec_policy_connections_required_params.
+ def test_update_subnet_reserved_ip_all_params_with_retries(self):
+ # Enable retries and run test_update_subnet_reserved_ip_all_params.
_service.enable_retries()
- self.test_list_ipsec_policy_connections_required_params()
+ self.test_update_subnet_reserved_ip_all_params()
- # Disable retries and run test_list_ipsec_policy_connections_required_params.
+ # Disable retries and run test_update_subnet_reserved_ip_all_params.
_service.disable_retries()
- self.test_list_ipsec_policy_connections_required_params()
+ self.test_update_subnet_reserved_ip_all_params()
@responses.activate
- def test_list_ipsec_policy_connections_value_error(self):
+ def test_update_subnet_reserved_ip_value_error(self):
"""
- test_list_ipsec_policy_connections_value_error()
+ test_update_subnet_reserved_ip_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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/subnets/testString/reserved_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ReservedIPPatch model
+ reserved_ip_patch_model = {}
+ reserved_ip_patch_model['auto_delete'] = False
+ reserved_ip_patch_model['name'] = 'my-reserved-ip-updated'
+
# Set up parameter values
+ subnet_id = 'testString'
id = 'testString'
+ reserved_ip_patch = reserved_ip_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "subnet_id": subnet_id,
"id": id,
+ "reserved_ip_patch": reserved_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.list_ipsec_policy_connections(**req_copy)
+ _service.update_subnet_reserved_ip(**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_update_subnet_reserved_ip_value_error_with_retries(self):
+ # Enable retries and run test_update_subnet_reserved_ip_value_error.
_service.enable_retries()
- self.test_list_ipsec_policy_connections_value_error()
+ self.test_update_subnet_reserved_ip_value_error()
- # Disable retries and run test_list_ipsec_policy_connections_value_error.
+ # Disable retries and run test_update_subnet_reserved_ip_value_error.
_service.disable_retries()
- self.test_list_ipsec_policy_connections_value_error()
+ self.test_update_subnet_reserved_ip_value_error()
- @responses.activate
- def test_list_ipsec_policy_connections_with_pager_get_next(self):
+
+# endregion
+##############################################################################
+# End of Service: Subnets
+##############################################################################
+
+##############################################################################
+# Start of Service: VirtualNetworkInterfaces
+##############################################################################
+# region
+
+
+class TestNewInstance:
+ """
+ Test Class for new_instance
+ """
+
+ def test_new_instance(self):
"""
- test_list_ipsec_policy_connections_with_pager_get_next()
+ new_instance()
"""
- # Set up a two-page mock response
- url = preprocess_url('/ipsec_policies/testString/connections')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
+ os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
- # Exercise the pager class for this operation
- all_results = []
- pager = IpsecPolicyConnectionsPager(
- client=_service,
- id='testString',
- limit=10,
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE',
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
- @responses.activate
- def test_list_ipsec_policy_connections_with_pager_get_all(self):
+ assert service is not None
+ assert isinstance(service, VpcV1)
+
+ def test_new_instance_without_authenticator(self):
"""
- test_list_ipsec_policy_connections_with_pager_get_all()
+ new_instance_without_authenticator()
"""
- # Set up a two-page mock response
- url = preprocess_url('/ipsec_policies/testString/connections')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
+ with pytest.raises(ValueError, match='authenticator must be provided'):
+ service = VpcV1.new_instance(
+ version=version,
+ service_name='TEST_SERVICE_NOT_FOUND',
+ )
- # Exercise the pager class for this operation
- pager = IpsecPolicyConnectionsPager(
- client=_service,
- id='testString',
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ 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 TestListVpnGateways:
+class TestListVirtualNetworkInterfaces:
"""
- Test Class for list_vpn_gateways
+ Test Class for list_virtual_network_interfaces
"""
@responses.activate
- def test_list_vpn_gateways_all_params(self):
+ def test_list_virtual_network_interfaces_all_params(self):
"""
- list_vpn_gateways()
+ list_virtual_network_interfaces()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}]}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43217,16 +43574,12 @@ def test_list_vpn_gateways_all_params(self):
start = 'testString'
limit = 50
resource_group_id = 'testString'
- sort = 'name'
- mode = 'policy'
# Invoke method
- response = _service.list_vpn_gateways(
+ response = _service.list_virtual_network_interfaces(
start=start,
limit=limit,
resource_group_id=resource_group_id,
- sort=sort,
- mode=mode,
headers={},
)
@@ -43239,26 +43592,24 @@ def test_list_vpn_gateways_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 'mode={}'.format(mode) 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_virtual_network_interfaces_all_params_with_retries(self):
+ # Enable retries and run test_list_virtual_network_interfaces_all_params.
_service.enable_retries()
- self.test_list_vpn_gateways_all_params()
+ self.test_list_virtual_network_interfaces_all_params()
- # Disable retries and run test_list_vpn_gateways_all_params.
+ # Disable retries and run test_list_virtual_network_interfaces_all_params.
_service.disable_retries()
- self.test_list_vpn_gateways_all_params()
+ self.test_list_virtual_network_interfaces_all_params()
@responses.activate
- def test_list_vpn_gateways_required_params(self):
+ def test_list_virtual_network_interfaces_required_params(self):
"""
- test_list_vpn_gateways_required_params()
+ test_list_virtual_network_interfaces_required_params()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}]}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43268,29 +43619,29 @@ def test_list_vpn_gateways_required_params(self):
)
# Invoke method
- response = _service.list_vpn_gateways()
+ response = _service.list_virtual_network_interfaces()
# 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_virtual_network_interfaces_required_params_with_retries(self):
+ # Enable retries and run test_list_virtual_network_interfaces_required_params.
_service.enable_retries()
- self.test_list_vpn_gateways_required_params()
+ self.test_list_virtual_network_interfaces_required_params()
- # Disable retries and run test_list_vpn_gateways_required_params.
+ # Disable retries and run test_list_virtual_network_interfaces_required_params.
_service.disable_retries()
- self.test_list_vpn_gateways_required_params()
+ self.test_list_virtual_network_interfaces_required_params()
@responses.activate
- def test_list_vpn_gateways_value_error(self):
+ def test_list_virtual_network_interfaces_value_error(self):
"""
- test_list_vpn_gateways_value_error()
+ test_list_virtual_network_interfaces_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}]}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43305,26 +43656,26 @@ 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_virtual_network_interfaces(**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_virtual_network_interfaces_value_error_with_retries(self):
+ # Enable retries and run test_list_virtual_network_interfaces_value_error.
_service.enable_retries()
- self.test_list_vpn_gateways_value_error()
+ self.test_list_virtual_network_interfaces_value_error()
- # Disable retries and run test_list_vpn_gateways_value_error.
+ # Disable retries and run test_list_virtual_network_interfaces_value_error.
_service.disable_retries()
- self.test_list_vpn_gateways_value_error()
+ self.test_list_virtual_network_interfaces_value_error()
@responses.activate
- def test_list_vpn_gateways_with_pager_get_next(self):
+ def test_list_virtual_network_interfaces_with_pager_get_next(self):
"""
- test_list_vpn_gateways_with_pager_get_next()
+ test_list_virtual_network_interfaces_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response1 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -43342,12 +43693,10 @@ def test_list_vpn_gateways_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpnGatewaysPager(
+ pager = VirtualNetworkInterfacesPager(
client=_service,
limit=10,
resource_group_id='testString',
- sort='name',
- mode='policy',
)
while pager.has_next():
next_page = pager.get_next()
@@ -43356,14 +43705,14 @@ def test_list_vpn_gateways_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpn_gateways_with_pager_get_all(self):
+ def test_list_virtual_network_interfaces_with_pager_get_all(self):
"""
- test_list_vpn_gateways_with_pager_get_all()
+ test_list_virtual_network_interfaces_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response1 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}'
+ mock_response2 = '{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","id":"r006-76083f29-e320-4c3f-a1ff-ec479f7249d1","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-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":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -43380,31 +43729,29 @@ def test_list_vpn_gateways_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpnGatewaysPager(
+ pager = VirtualNetworkInterfacesPager(
client=_service,
limit=10,
resource_group_id='testString',
- sort='name',
- mode='policy',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVpnGateway:
+class TestCreateVirtualNetworkInterface:
"""
- Test Class for create_vpn_gateway
+ Test Class for create_virtual_network_interface
"""
@responses.activate
- def test_create_vpn_gateway_all_params(self):
+ def test_create_virtual_network_interface_all_params(self):
"""
- create_vpn_gateway()
+ create_virtual_network_interface()
"""
# 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43413,27 +43760,50 @@ def test_create_vpn_gateway_all_params(self):
status=201,
)
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextById model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextById model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+
# 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
# Construct a dict representation of a SubnetIdentityById model
subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-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'
+ subnet_identity_model['id'] = '69e55145-cc7d-4d8e-9e1f-cc3fb60b1793'
# Set up parameter values
- vpn_gateway_prototype = vpn_gateway_prototype_model
+ allow_ip_spoofing = False
+ auto_delete = False
+ enable_infrastructure_nat = True
+ ips = [virtual_network_interface_ip_prototype_model]
+ name = 'my-virtual-network-interface'
+ primary_ip = virtual_network_interface_primary_ip_prototype_model
+ protocol_state_filtering_mode = 'auto'
+ resource_group = resource_group_identity_model
+ security_groups = [security_group_identity_model]
+ subnet = subnet_identity_model
# Invoke method
- response = _service.create_vpn_gateway(
- vpn_gateway_prototype,
+ response = _service.create_virtual_network_interface(
+ allow_ip_spoofing=allow_ip_spoofing,
+ auto_delete=auto_delete,
+ enable_infrastructure_nat=enable_infrastructure_nat,
+ ips=ips,
+ name=name,
+ primary_ip=primary_ip,
+ protocol_state_filtering_mode=protocol_state_filtering_mode,
+ resource_group=resource_group,
+ security_groups=security_groups,
+ subnet=subnet,
headers={},
)
@@ -43442,25 +43812,34 @@ 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['allow_ip_spoofing'] == False
+ assert req_body['auto_delete'] == False
+ assert req_body['enable_infrastructure_nat'] == True
+ assert req_body['ips'] == [virtual_network_interface_ip_prototype_model]
+ assert req_body['name'] == 'my-virtual-network-interface'
+ assert req_body['primary_ip'] == virtual_network_interface_primary_ip_prototype_model
+ assert req_body['protocol_state_filtering_mode'] == 'auto'
+ assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body['security_groups'] == [security_group_identity_model]
+ assert req_body['subnet'] == subnet_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_virtual_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_create_virtual_network_interface_all_params.
_service.enable_retries()
- self.test_create_vpn_gateway_all_params()
+ self.test_create_virtual_network_interface_all_params()
- # Disable retries and run test_create_vpn_gateway_all_params.
+ # Disable retries and run test_create_virtual_network_interface_all_params.
_service.disable_retries()
- self.test_create_vpn_gateway_all_params()
+ self.test_create_virtual_network_interface_all_params()
@responses.activate
- def test_create_vpn_gateway_value_error(self):
+ def test_create_virtual_network_interface_value_error(self):
"""
- test_create_vpn_gateway_value_error()
+ test_create_virtual_network_interface_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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
+ url = preprocess_url('/virtual_network_interfaces')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43469,58 +43848,74 @@ def test_create_vpn_gateway_value_error(self):
status=201,
)
+ # Construct a dict representation of a VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextById model
+ virtual_network_interface_ip_prototype_model = {}
+ virtual_network_interface_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+
+ # Construct a dict representation of a VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextById model
+ virtual_network_interface_primary_ip_prototype_model = {}
+ virtual_network_interface_primary_ip_prototype_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+
# 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
# Construct a dict representation of a SubnetIdentityById model
subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-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'
+ subnet_identity_model['id'] = '69e55145-cc7d-4d8e-9e1f-cc3fb60b1793'
# Set up parameter values
- vpn_gateway_prototype = vpn_gateway_prototype_model
+ allow_ip_spoofing = False
+ auto_delete = False
+ enable_infrastructure_nat = True
+ ips = [virtual_network_interface_ip_prototype_model]
+ name = 'my-virtual-network-interface'
+ primary_ip = virtual_network_interface_primary_ip_prototype_model
+ protocol_state_filtering_mode = 'auto'
+ resource_group = resource_group_identity_model
+ security_groups = [security_group_identity_model]
+ subnet = subnet_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.create_vpn_gateway(**req_copy)
+ _service.create_virtual_network_interface(**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_virtual_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_create_virtual_network_interface_value_error.
_service.enable_retries()
- self.test_create_vpn_gateway_value_error()
+ self.test_create_virtual_network_interface_value_error()
- # Disable retries and run test_create_vpn_gateway_value_error.
+ # Disable retries and run test_create_virtual_network_interface_value_error.
_service.disable_retries()
- self.test_create_vpn_gateway_value_error()
+ self.test_create_virtual_network_interface_value_error()
-class TestDeleteVpnGateway:
+class TestDeleteVirtualNetworkInterfaces:
"""
- Test Class for delete_vpn_gateway
+ Test Class for delete_virtual_network_interfaces
"""
@responses.activate
- def test_delete_vpn_gateway_all_params(self):
+ def test_delete_virtual_network_interfaces_all_params(self):
"""
- delete_vpn_gateway()
+ delete_virtual_network_interfaces()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString')
+ url = preprocess_url('/virtual_network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
url,
+ body=mock_response,
+ content_type='application/json',
status=202,
)
@@ -43528,7 +43923,7 @@ def test_delete_vpn_gateway_all_params(self):
id = 'testString'
# Invoke method
- response = _service.delete_vpn_gateway(
+ response = _service.delete_virtual_network_interfaces(
id,
headers={},
)
@@ -43537,25 +43932,28 @@ 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_virtual_network_interfaces_all_params_with_retries(self):
+ # Enable retries and run test_delete_virtual_network_interfaces_all_params.
_service.enable_retries()
- self.test_delete_vpn_gateway_all_params()
+ self.test_delete_virtual_network_interfaces_all_params()
- # Disable retries and run test_delete_vpn_gateway_all_params.
+ # Disable retries and run test_delete_virtual_network_interfaces_all_params.
_service.disable_retries()
- self.test_delete_vpn_gateway_all_params()
+ self.test_delete_virtual_network_interfaces_all_params()
@responses.activate
- def test_delete_vpn_gateway_value_error(self):
+ def test_delete_virtual_network_interfaces_value_error(self):
"""
- test_delete_vpn_gateway_value_error()
+ test_delete_virtual_network_interfaces_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString')
+ url = preprocess_url('/virtual_network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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.DELETE,
url,
+ body=mock_response,
+ content_type='application/json',
status=202,
)
@@ -43569,31 +43967,31 @@ def test_delete_vpn_gateway_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_vpn_gateway(**req_copy)
+ _service.delete_virtual_network_interfaces(**req_copy)
- def test_delete_vpn_gateway_value_error_with_retries(self):
- # Enable retries and run test_delete_vpn_gateway_value_error.
+ def test_delete_virtual_network_interfaces_value_error_with_retries(self):
+ # Enable retries and run test_delete_virtual_network_interfaces_value_error.
_service.enable_retries()
- self.test_delete_vpn_gateway_value_error()
+ self.test_delete_virtual_network_interfaces_value_error()
- # Disable retries and run test_delete_vpn_gateway_value_error.
+ # Disable retries and run test_delete_virtual_network_interfaces_value_error.
_service.disable_retries()
- self.test_delete_vpn_gateway_value_error()
+ self.test_delete_virtual_network_interfaces_value_error()
-class TestGetVpnGateway:
+class TestGetVirtualNetworkInterface:
"""
- Test Class for get_vpn_gateway
+ Test Class for get_virtual_network_interface
"""
@responses.activate
- def test_get_vpn_gateway_all_params(self):
+ def test_get_virtual_network_interface_all_params(self):
"""
- get_vpn_gateway()
+ get_virtual_network_interface()
"""
# 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
+ url = preprocess_url('/virtual_network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43606,7 +44004,7 @@ def test_get_vpn_gateway_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_vpn_gateway(
+ response = _service.get_virtual_network_interface(
id,
headers={},
)
@@ -43615,23 +44013,23 @@ def test_get_vpn_gateway_all_params(self):
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.
+ def test_get_virtual_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_get_virtual_network_interface_all_params.
_service.enable_retries()
- self.test_get_vpn_gateway_all_params()
+ self.test_get_virtual_network_interface_all_params()
- # Disable retries and run test_get_vpn_gateway_all_params.
+ # Disable retries and run test_get_virtual_network_interface_all_params.
_service.disable_retries()
- self.test_get_vpn_gateway_all_params()
+ self.test_get_virtual_network_interface_all_params()
@responses.activate
- def test_get_vpn_gateway_value_error(self):
+ def test_get_virtual_network_interface_value_error(self):
"""
- test_get_vpn_gateway_value_error()
+ test_get_virtual_network_interface_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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
+ url = preprocess_url('/virtual_network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43650,31 +44048,31 @@ def test_get_vpn_gateway_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_vpn_gateway(**req_copy)
+ _service.get_virtual_network_interface(**req_copy)
- def test_get_vpn_gateway_value_error_with_retries(self):
- # Enable retries and run test_get_vpn_gateway_value_error.
+ def test_get_virtual_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_get_virtual_network_interface_value_error.
_service.enable_retries()
- self.test_get_vpn_gateway_value_error()
+ self.test_get_virtual_network_interface_value_error()
- # Disable retries and run test_get_vpn_gateway_value_error.
+ # Disable retries and run test_get_virtual_network_interface_value_error.
_service.disable_retries()
- self.test_get_vpn_gateway_value_error()
+ self.test_get_virtual_network_interface_value_error()
-class TestUpdateVpnGateway:
+class TestUpdateVirtualNetworkInterface:
"""
- Test Class for update_vpn_gateway
+ Test Class for update_virtual_network_interface
"""
@responses.activate
- def test_update_vpn_gateway_all_params(self):
+ def test_update_virtual_network_interface_all_params(self):
"""
- update_vpn_gateway()
+ update_virtual_network_interface()
"""
# 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
+ url = preprocess_url('/virtual_network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43683,18 +44081,22 @@ def test_update_vpn_gateway_all_params(self):
status=200,
)
- # Construct a dict representation of a VPNGatewayPatch model
- vpn_gateway_patch_model = {}
- vpn_gateway_patch_model['name'] = 'my-vpn-gateway-updated'
+ # Construct a dict representation of a VirtualNetworkInterfacePatch model
+ virtual_network_interface_patch_model = {}
+ virtual_network_interface_patch_model['allow_ip_spoofing'] = True
+ virtual_network_interface_patch_model['auto_delete'] = False
+ virtual_network_interface_patch_model['enable_infrastructure_nat'] = True
+ virtual_network_interface_patch_model['name'] = 'my-virtual-network-interface'
+ virtual_network_interface_patch_model['protocol_state_filtering_mode'] = 'auto'
# Set up parameter values
id = 'testString'
- vpn_gateway_patch = vpn_gateway_patch_model
+ virtual_network_interface_patch = virtual_network_interface_patch_model
# Invoke method
- response = _service.update_vpn_gateway(
+ response = _service.update_virtual_network_interface(
id,
- vpn_gateway_patch,
+ virtual_network_interface_patch,
headers={},
)
@@ -43703,25 +44105,25 @@ def test_update_vpn_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 == vpn_gateway_patch
+ assert req_body == virtual_network_interface_patch
- def test_update_vpn_gateway_all_params_with_retries(self):
- # Enable retries and run test_update_vpn_gateway_all_params.
+ def test_update_virtual_network_interface_all_params_with_retries(self):
+ # Enable retries and run test_update_virtual_network_interface_all_params.
_service.enable_retries()
- self.test_update_vpn_gateway_all_params()
+ self.test_update_virtual_network_interface_all_params()
- # Disable retries and run test_update_vpn_gateway_all_params.
+ # Disable retries and run test_update_virtual_network_interface_all_params.
_service.disable_retries()
- self.test_update_vpn_gateway_all_params()
+ self.test_update_virtual_network_interface_all_params()
@responses.activate
- def test_update_vpn_gateway_value_error(self):
+ def test_update_virtual_network_interface_value_error(self):
"""
- test_update_vpn_gateway_value_error()
+ test_update_virtual_network_interface_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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
+ url = preprocess_url('/virtual_network_interfaces/testString')
+ mock_response = '{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "id": "r006-76083f29-e320-4c3f-a1ff-ec479f7249d1", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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,
@@ -43730,47 +44132,51 @@ def test_update_vpn_gateway_value_error(self):
status=200,
)
- # Construct a dict representation of a VPNGatewayPatch model
- vpn_gateway_patch_model = {}
- vpn_gateway_patch_model['name'] = 'my-vpn-gateway-updated'
+ # Construct a dict representation of a VirtualNetworkInterfacePatch model
+ virtual_network_interface_patch_model = {}
+ virtual_network_interface_patch_model['allow_ip_spoofing'] = True
+ virtual_network_interface_patch_model['auto_delete'] = False
+ virtual_network_interface_patch_model['enable_infrastructure_nat'] = True
+ virtual_network_interface_patch_model['name'] = 'my-virtual-network-interface'
+ virtual_network_interface_patch_model['protocol_state_filtering_mode'] = 'auto'
# Set up parameter values
id = 'testString'
- vpn_gateway_patch = vpn_gateway_patch_model
+ virtual_network_interface_patch = virtual_network_interface_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,
+ "virtual_network_interface_patch": virtual_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_vpn_gateway(**req_copy)
+ _service.update_virtual_network_interface(**req_copy)
- def test_update_vpn_gateway_value_error_with_retries(self):
- # Enable retries and run test_update_vpn_gateway_value_error.
+ def test_update_virtual_network_interface_value_error_with_retries(self):
+ # Enable retries and run test_update_virtual_network_interface_value_error.
_service.enable_retries()
- self.test_update_vpn_gateway_value_error()
+ self.test_update_virtual_network_interface_value_error()
- # Disable retries and run test_update_vpn_gateway_value_error.
+ # Disable retries and run test_update_virtual_network_interface_value_error.
_service.disable_retries()
- self.test_update_vpn_gateway_value_error()
+ self.test_update_virtual_network_interface_value_error()
-class TestListVpnGatewayConnections:
+class TestListNetworkInterfaceFloatingIps:
"""
- Test Class for list_vpn_gateway_connections
+ Test Class for list_network_interface_floating_ips
"""
@responses.activate
- def test_list_vpn_gateway_connections_all_params(self):
+ def test_list_network_interface_floating_ips_all_params(self):
"""
- list_vpn_gateway_connections()
+ list_network_interface_floating_ips()
"""
# 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
+ mock_response = '{"first": {"href": "href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -43780,17 +44186,17 @@ def test_list_vpn_gateway_connections_all_params(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
start = 'testString'
limit = 50
- status = 'down'
+ sort = 'name'
# Invoke method
- response = _service.list_vpn_gateway_connections(
- vpn_gateway_id,
+ response = _service.list_network_interface_floating_ips(
+ virtual_network_interface_id,
start=start,
limit=limit,
- status=status,
+ sort=sort,
headers={},
)
@@ -43802,25 +44208,25 @@ def test_list_vpn_gateway_connections_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 'status={}'.format(status) in query_string
+ assert 'sort={}'.format(sort) in query_string
- def test_list_vpn_gateway_connections_all_params_with_retries(self):
- # Enable retries and run test_list_vpn_gateway_connections_all_params.
+ def test_list_network_interface_floating_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_network_interface_floating_ips_all_params.
_service.enable_retries()
- self.test_list_vpn_gateway_connections_all_params()
+ self.test_list_network_interface_floating_ips_all_params()
- # Disable retries and run test_list_vpn_gateway_connections_all_params.
+ # Disable retries and run test_list_network_interface_floating_ips_all_params.
_service.disable_retries()
- self.test_list_vpn_gateway_connections_all_params()
+ self.test_list_network_interface_floating_ips_all_params()
@responses.activate
- def test_list_vpn_gateway_connections_required_params(self):
+ def test_list_network_interface_floating_ips_required_params(self):
"""
- test_list_vpn_gateway_connections_required_params()
+ test_list_network_interface_floating_ips_required_params()
"""
# 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
+ mock_response = '{"first": {"href": "href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -43830,11 +44236,11 @@ def test_list_vpn_gateway_connections_required_params(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
# Invoke method
- response = _service.list_vpn_gateway_connections(
- vpn_gateway_id,
+ response = _service.list_network_interface_floating_ips(
+ virtual_network_interface_id,
headers={},
)
@@ -43842,23 +44248,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_list_network_interface_floating_ips_required_params_with_retries(self):
+ # Enable retries and run test_list_network_interface_floating_ips_required_params.
_service.enable_retries()
- self.test_list_vpn_gateway_connections_required_params()
+ self.test_list_network_interface_floating_ips_required_params()
- # Disable retries and run test_list_vpn_gateway_connections_required_params.
+ # Disable retries and run test_list_network_interface_floating_ips_required_params.
_service.disable_retries()
- self.test_list_vpn_gateway_connections_required_params()
+ self.test_list_network_interface_floating_ips_required_params()
@responses.activate
- def test_list_vpn_gateway_connections_value_error(self):
+ def test_list_network_interface_floating_ips_value_error(self):
"""
- test_list_vpn_gateway_connections_value_error()
+ test_list_network_interface_floating_ips_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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
+ mock_response = '{"first": {"href": "href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -43868,35 +44274,35 @@ def test_list_vpn_gateway_connections_value_error(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpn_gateway_id": vpn_gateway_id,
+ "virtual_network_interface_id": virtual_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_vpn_gateway_connections(**req_copy)
+ _service.list_network_interface_floating_ips(**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_list_network_interface_floating_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_network_interface_floating_ips_value_error.
_service.enable_retries()
- self.test_list_vpn_gateway_connections_value_error()
+ self.test_list_network_interface_floating_ips_value_error()
- # Disable retries and run test_list_vpn_gateway_connections_value_error.
+ # Disable retries and run test_list_network_interface_floating_ips_value_error.
_service.disable_retries()
- self.test_list_vpn_gateway_connections_value_error()
+ self.test_list_network_interface_floating_ips_value_error()
@responses.activate
- def test_list_vpn_gateway_connections_with_pager_get_next(self):
+ def test_list_network_interface_floating_ips_with_pager_get_next(self):
"""
- test_list_vpn_gateway_connections_with_pager_get_next()
+ test_list_network_interface_floating_ips_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_gateways/testString/connections')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
responses.add(
responses.GET,
url,
@@ -43914,555 +44320,146 @@ def test_list_vpn_gateway_connections_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpnGatewayConnectionsPager(
+ pager = NetworkInterfaceFloatingIpsPager(
client=_service,
- vpn_gateway_id='testString',
+ virtual_network_interface_id='testString',
limit=10,
- status='down',
+ sort='name',
)
while pager.has_next():
next_page = pager.get_next()
assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_vpn_gateway_connections_with_pager_get_all(self):
- """
- test_list_vpn_gateway_connections_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/vpn_gateways/testString/connections')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = VpnGatewayConnectionsPager(
- client=_service,
- vpn_gateway_id='testString',
- limit=10,
- status='down',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
-
-
-class TestCreateVpnGatewayConnection:
- """
- Test Class for create_vpn_gateway_connection
- """
-
- @responses.activate
- def test_create_vpn_gateway_connection_all_params(self):
- """
- create_vpn_gateway_connection()
- """
- # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
- responses.add(
- responses.POST,
- 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'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
-
- # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
-
- # Construct a dict representation of a VPNGatewayConnectionIKEIdentityPrototypeVPNGatewayConnectionIKEIdentityFQDN model
- vpn_gateway_connection_ike_identity_prototype_model = {}
- vpn_gateway_connection_ike_identity_prototype_model['type'] = 'fqdn'
- vpn_gateway_connection_ike_identity_prototype_model['value'] = 'my-service.example.com'
-
- # Construct a dict representation of a VPNGatewayConnectionStaticRouteModeLocalPrototype model
- vpn_gateway_connection_static_route_mode_local_prototype_model = {}
- vpn_gateway_connection_static_route_mode_local_prototype_model['ike_identities'] = [vpn_gateway_connection_ike_identity_prototype_model]
-
- # Construct a dict representation of a VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress model
- vpn_gateway_connection_static_route_mode_peer_prototype_model = {}
- vpn_gateway_connection_static_route_mode_peer_prototype_model['ike_identity'] = vpn_gateway_connection_ike_identity_prototype_model
- vpn_gateway_connection_static_route_mode_peer_prototype_model['address'] = '192.0.2.5'
-
- # 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['establish_mode'] = 'bidirectional'
- 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-gateway-connection'
- vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso'
- vpn_gateway_connection_prototype_model['distribute_traffic'] = False
- vpn_gateway_connection_prototype_model['local'] = vpn_gateway_connection_static_route_mode_local_prototype_model
- vpn_gateway_connection_prototype_model['peer'] = vpn_gateway_connection_static_route_mode_peer_prototype_model
- 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
-
- # Invoke method
- response = _service.create_vpn_gateway_connection(
- vpn_gateway_id,
- vpn_gateway_connection_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 == vpn_gateway_connection_prototype
-
- 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_vpn_gateway_connection_all_params()
-
- # Disable retries and run test_create_vpn_gateway_connection_all_params.
- _service.disable_retries()
- self.test_create_vpn_gateway_connection_all_params()
-
- @responses.activate
- def test_create_vpn_gateway_connection_value_error(self):
- """
- test_create_vpn_gateway_connection_value_error()
- """
- # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
- responses.add(
- responses.POST,
- 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'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
-
- # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
-
- # Construct a dict representation of a VPNGatewayConnectionIKEIdentityPrototypeVPNGatewayConnectionIKEIdentityFQDN model
- vpn_gateway_connection_ike_identity_prototype_model = {}
- vpn_gateway_connection_ike_identity_prototype_model['type'] = 'fqdn'
- vpn_gateway_connection_ike_identity_prototype_model['value'] = 'my-service.example.com'
-
- # Construct a dict representation of a VPNGatewayConnectionStaticRouteModeLocalPrototype model
- vpn_gateway_connection_static_route_mode_local_prototype_model = {}
- vpn_gateway_connection_static_route_mode_local_prototype_model['ike_identities'] = [vpn_gateway_connection_ike_identity_prototype_model]
-
- # Construct a dict representation of a VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress model
- vpn_gateway_connection_static_route_mode_peer_prototype_model = {}
- vpn_gateway_connection_static_route_mode_peer_prototype_model['ike_identity'] = vpn_gateway_connection_ike_identity_prototype_model
- vpn_gateway_connection_static_route_mode_peer_prototype_model['address'] = '192.0.2.5'
-
- # 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['establish_mode'] = 'bidirectional'
- 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-gateway-connection'
- vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso'
- vpn_gateway_connection_prototype_model['distribute_traffic'] = False
- vpn_gateway_connection_prototype_model['local'] = vpn_gateway_connection_static_route_mode_local_prototype_model
- vpn_gateway_connection_prototype_model['peer'] = vpn_gateway_connection_static_route_mode_peer_prototype_model
- 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
-
- # 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)
-
- 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()
-
- # Disable retries and run test_create_vpn_gateway_connection_value_error.
- _service.disable_retries()
- self.test_create_vpn_gateway_connection_value_error()
-
-
-class TestDeleteVpnGatewayConnection:
- """
- Test Class for delete_vpn_gateway_connection
- """
-
- @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,
- )
-
- # Set up parameter values
- vpn_gateway_id = 'testString'
- id = 'testString'
-
- # Invoke method
- response = _service.delete_vpn_gateway_connection(
- vpn_gateway_id,
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- 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_vpn_gateway_connection_all_params()
-
- # Disable retries and run test_delete_vpn_gateway_connection_all_params.
- _service.disable_retries()
- self.test_delete_vpn_gateway_connection_all_params()
-
- @responses.activate
- def test_delete_vpn_gateway_connection_value_error(self):
- """
- test_delete_vpn_gateway_connection_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString')
- responses.add(
- responses.DELETE,
- url,
- 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_vpn_gateway_connection(**req_copy)
-
- 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_vpn_gateway_connection_value_error()
-
- # Disable retries and run test_delete_vpn_gateway_connection_value_error.
- _service.disable_retries()
- self.test_delete_vpn_gateway_connection_value_error()
-
-
-class TestGetVpnGatewayConnection:
- """
- Test Class for get_vpn_gateway_connection
- """
-
- @responses.activate
- def test_get_vpn_gateway_connection_all_params(self):
- """
- get_vpn_gateway_connection()
- """
- # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
- 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.get_vpn_gateway_connection(
- vpn_gateway_id,
- id,
- headers={},
- )
-
- # Check for correct operation
- 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.
- _service.enable_retries()
- self.test_get_vpn_gateway_connection_all_params()
-
- # Disable retries and run test_get_vpn_gateway_connection_all_params.
- _service.disable_retries()
- self.test_get_vpn_gateway_connection_all_params()
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_get_vpn_gateway_connection_value_error(self):
+ def test_list_network_interface_floating_ips_with_pager_get_all(self):
"""
- test_get_vpn_gateway_connection_value_error()
+ test_list_network_interface_floating_ips_with_pager_get_all()
"""
- # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
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.get_vpn_gateway_connection(**req_copy)
-
- 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_vpn_gateway_connection_value_error()
-
- # Disable retries and run test_get_vpn_gateway_connection_value_error.
- _service.disable_retries()
- self.test_get_vpn_gateway_connection_value_error()
+ # Exercise the pager class for this operation
+ pager = NetworkInterfaceFloatingIpsPager(
+ client=_service,
+ virtual_network_interface_id='testString',
+ limit=10,
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestUpdateVpnGatewayConnection:
+class TestRemoveNetworkInterfaceFloatingIp:
"""
- Test Class for update_vpn_gateway_connection
+ Test Class for remove_network_interface_floating_ip
"""
@responses.activate
- def test_update_vpn_gateway_connection_all_params(self):
+ def test_remove_network_interface_floating_ip_all_params(self):
"""
- update_vpn_gateway_connection()
+ remove_network_interface_floating_ip()
"""
# 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # 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'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
-
- # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
-
- # Construct a dict representation of a VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch model
- vpn_gateway_connection_peer_patch_model = {}
- vpn_gateway_connection_peer_patch_model['address'] = '192.0.2.5'
-
- # Construct a dict representation of a VPNGatewayConnectionPatch 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['distribute_traffic'] = True
- vpn_gateway_connection_patch_model['establish_mode'] = 'bidirectional'
- 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-gateway-connection'
- vpn_gateway_connection_patch_model['peer'] = vpn_gateway_connection_peer_patch_model
- vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso'
-
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- vpn_gateway_connection_patch = vpn_gateway_connection_patch_model
# Invoke method
- response = _service.update_vpn_gateway_connection(
- vpn_gateway_id,
+ response = _service.remove_network_interface_floating_ip(
+ virtual_network_interface_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
+ assert response.status_code == 204
- def test_update_vpn_gateway_connection_all_params_with_retries(self):
- # Enable retries and run test_update_vpn_gateway_connection_all_params.
+ def test_remove_network_interface_floating_ip_all_params_with_retries(self):
+ # Enable retries and run test_remove_network_interface_floating_ip_all_params.
_service.enable_retries()
- self.test_update_vpn_gateway_connection_all_params()
+ self.test_remove_network_interface_floating_ip_all_params()
- # Disable retries and run test_update_vpn_gateway_connection_all_params.
+ # Disable retries and run test_remove_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_update_vpn_gateway_connection_all_params()
+ self.test_remove_network_interface_floating_ip_all_params()
@responses.activate
- def test_update_vpn_gateway_connection_value_error(self):
+ def test_remove_network_interface_floating_ip_value_error(self):
"""
- test_update_vpn_gateway_connection_value_error()
+ test_remove_network_interface_floating_ip_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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # 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'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
-
- # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
-
- # Construct a dict representation of a VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch model
- vpn_gateway_connection_peer_patch_model = {}
- vpn_gateway_connection_peer_patch_model['address'] = '192.0.2.5'
-
- # Construct a dict representation of a VPNGatewayConnectionPatch 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['distribute_traffic'] = True
- vpn_gateway_connection_patch_model['establish_mode'] = 'bidirectional'
- 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-gateway-connection'
- vpn_gateway_connection_patch_model['peer'] = vpn_gateway_connection_peer_patch_model
- vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso'
-
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_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,
+ "virtual_network_interface_id": virtual_network_interface_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)
+ _service.remove_network_interface_floating_ip(**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_remove_network_interface_floating_ip_value_error_with_retries(self):
+ # Enable retries and run test_remove_network_interface_floating_ip_value_error.
_service.enable_retries()
- self.test_update_vpn_gateway_connection_value_error()
+ self.test_remove_network_interface_floating_ip_value_error()
- # Disable retries and run test_update_vpn_gateway_connection_value_error.
+ # Disable retries and run test_remove_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_update_vpn_gateway_connection_value_error()
+ self.test_remove_network_interface_floating_ip_value_error()
-class TestListVpnGatewayConnectionsLocalCidrs:
+class TestGetNetworkInterfaceFloatingIp:
"""
- Test Class for list_vpn_gateway_connections_local_cidrs
+ Test Class for get_network_interface_floating_ip
"""
@responses.activate
- def test_list_vpn_gateway_connections_local_cidrs_all_params(self):
+ def test_get_network_interface_floating_ip_all_params(self):
"""
- list_vpn_gateway_connections_local_cidrs()
+ get_network_interface_floating_ip()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs')
- mock_response = '{"cidrs": ["192.0.2.0/24"]}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
+ mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
responses.add(
responses.GET,
url,
@@ -44472,12 +44469,12 @@ def test_list_vpn_gateway_connections_local_cidrs_all_params(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.list_vpn_gateway_connections_local_cidrs(
- vpn_gateway_id,
+ response = _service.get_network_interface_floating_ip(
+ virtual_network_interface_id,
id,
headers={},
)
@@ -44486,23 +44483,23 @@ def test_list_vpn_gateway_connections_local_cidrs_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpn_gateway_connections_local_cidrs_all_params_with_retries(self):
- # Enable retries and run test_list_vpn_gateway_connections_local_cidrs_all_params.
+ def test_get_network_interface_floating_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_network_interface_floating_ip_all_params.
_service.enable_retries()
- self.test_list_vpn_gateway_connections_local_cidrs_all_params()
+ self.test_get_network_interface_floating_ip_all_params()
- # Disable retries and run test_list_vpn_gateway_connections_local_cidrs_all_params.
+ # Disable retries and run test_get_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_list_vpn_gateway_connections_local_cidrs_all_params()
+ self.test_get_network_interface_floating_ip_all_params()
@responses.activate
- def test_list_vpn_gateway_connections_local_cidrs_value_error(self):
+ def test_get_network_interface_floating_ip_value_error(self):
"""
- test_list_vpn_gateway_connections_local_cidrs_value_error()
+ test_get_network_interface_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs')
- mock_response = '{"cidrs": ["192.0.2.0/24"]}'
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
+ mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
responses.add(
responses.GET,
url,
@@ -44512,375 +44509,330 @@ def test_list_vpn_gateway_connections_local_cidrs_value_error(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_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,
+ "virtual_network_interface_id": virtual_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.list_vpn_gateway_connections_local_cidrs(**req_copy)
+ _service.get_network_interface_floating_ip(**req_copy)
- def test_list_vpn_gateway_connections_local_cidrs_value_error_with_retries(self):
- # Enable retries and run test_list_vpn_gateway_connections_local_cidrs_value_error.
+ def test_get_network_interface_floating_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_network_interface_floating_ip_value_error.
_service.enable_retries()
- self.test_list_vpn_gateway_connections_local_cidrs_value_error()
+ self.test_get_network_interface_floating_ip_value_error()
- # Disable retries and run test_list_vpn_gateway_connections_local_cidrs_value_error.
+ # Disable retries and run test_get_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_list_vpn_gateway_connections_local_cidrs_value_error()
+ self.test_get_network_interface_floating_ip_value_error()
-class TestRemoveVpnGatewayConnectionsLocalCidr:
+class TestAddNetworkInterfaceFloatingIp:
"""
- Test Class for remove_vpn_gateway_connections_local_cidr
+ Test Class for add_network_interface_floating_ip
"""
@responses.activate
- def test_remove_vpn_gateway_connections_local_cidr_all_params(self):
+ def test_add_network_interface_floating_ip_all_params(self):
"""
- remove_vpn_gateway_connections_local_cidr()
+ add_network_interface_floating_ip()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
+ mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
responses.add(
- responses.DELETE,
+ responses.PUT,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Invoke method
- response = _service.remove_vpn_gateway_connections_local_cidr(
- vpn_gateway_id,
+ response = _service.add_network_interface_floating_ip(
+ virtual_network_interface_id,
id,
- cidr,
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_connections_local_cidr_all_params_with_retries(self):
- # Enable retries and run test_remove_vpn_gateway_connections_local_cidr_all_params.
+ def test_add_network_interface_floating_ip_all_params_with_retries(self):
+ # Enable retries and run test_add_network_interface_floating_ip_all_params.
_service.enable_retries()
- self.test_remove_vpn_gateway_connections_local_cidr_all_params()
+ self.test_add_network_interface_floating_ip_all_params()
- # Disable retries and run test_remove_vpn_gateway_connections_local_cidr_all_params.
+ # Disable retries and run test_add_network_interface_floating_ip_all_params.
_service.disable_retries()
- self.test_remove_vpn_gateway_connections_local_cidr_all_params()
+ self.test_add_network_interface_floating_ip_all_params()
@responses.activate
- def test_remove_vpn_gateway_connections_local_cidr_value_error(self):
+ def test_add_network_interface_floating_ip_value_error(self):
"""
- test_remove_vpn_gateway_connections_local_cidr_value_error()
+ test_add_network_interface_floating_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/floating_ips/testString')
+ mock_response = '{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}'
responses.add(
- responses.DELETE,
+ responses.PUT,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpn_gateway_id": vpn_gateway_id,
+ "virtual_network_interface_id": virtual_network_interface_id,
"id": id,
- "cidr": cidr,
}
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_connections_local_cidr(**req_copy)
+ _service.add_network_interface_floating_ip(**req_copy)
- def test_remove_vpn_gateway_connections_local_cidr_value_error_with_retries(self):
- # Enable retries and run test_remove_vpn_gateway_connections_local_cidr_value_error.
+ def test_add_network_interface_floating_ip_value_error_with_retries(self):
+ # Enable retries and run test_add_network_interface_floating_ip_value_error.
_service.enable_retries()
- self.test_remove_vpn_gateway_connections_local_cidr_value_error()
+ self.test_add_network_interface_floating_ip_value_error()
- # Disable retries and run test_remove_vpn_gateway_connections_local_cidr_value_error.
+ # Disable retries and run test_add_network_interface_floating_ip_value_error.
_service.disable_retries()
- self.test_remove_vpn_gateway_connections_local_cidr_value_error()
+ self.test_add_network_interface_floating_ip_value_error()
-class TestCheckVpnGatewayConnectionsLocalCidr:
+class TestListVirtualNetworkInterfaceIps:
"""
- Test Class for check_vpn_gateway_connections_local_cidr
+ Test Class for list_virtual_network_interface_ips
"""
@responses.activate
- def test_check_vpn_gateway_connections_local_cidr_all_params(self):
+ def test_list_virtual_network_interface_ips_all_params(self):
"""
- check_vpn_gateway_connections_local_cidr()
+ list_virtual_network_interface_ips()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "href"}, "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 = '192.168.1.0/24'
+ virtual_network_interface_id = 'testString'
+ start = 'testString'
+ limit = 50
+ sort = 'name'
# Invoke method
- response = _service.check_vpn_gateway_connections_local_cidr(
- vpn_gateway_id,
- id,
- cidr,
+ response = _service.list_virtual_network_interface_ips(
+ virtual_network_interface_id,
+ start=start,
+ limit=limit,
+ sort=sort,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ 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_check_vpn_gateway_connections_local_cidr_all_params_with_retries(self):
- # Enable retries and run test_check_vpn_gateway_connections_local_cidr_all_params.
+ def test_list_virtual_network_interface_ips_all_params_with_retries(self):
+ # Enable retries and run test_list_virtual_network_interface_ips_all_params.
_service.enable_retries()
- self.test_check_vpn_gateway_connections_local_cidr_all_params()
+ self.test_list_virtual_network_interface_ips_all_params()
- # Disable retries and run test_check_vpn_gateway_connections_local_cidr_all_params.
+ # Disable retries and run test_list_virtual_network_interface_ips_all_params.
_service.disable_retries()
- self.test_check_vpn_gateway_connections_local_cidr_all_params()
+ self.test_list_virtual_network_interface_ips_all_params()
@responses.activate
- def test_check_vpn_gateway_connections_local_cidr_value_error(self):
+ def test_list_virtual_network_interface_ips_required_params(self):
"""
- test_check_vpn_gateway_connections_local_cidr_value_error()
+ test_list_virtual_network_interface_ips_required_params()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
- status=204,
- )
-
- # Set up parameter values
- vpn_gateway_id = 'testString'
- id = 'testString'
- cidr = '192.168.1.0/24'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "vpn_gateway_id": vpn_gateway_id,
- "id": id,
- "cidr": cidr,
- }
- 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_connections_local_cidr(**req_copy)
-
- def test_check_vpn_gateway_connections_local_cidr_value_error_with_retries(self):
- # Enable retries and run test_check_vpn_gateway_connections_local_cidr_value_error.
- _service.enable_retries()
- self.test_check_vpn_gateway_connections_local_cidr_value_error()
-
- # Disable retries and run test_check_vpn_gateway_connections_local_cidr_value_error.
- _service.disable_retries()
- self.test_check_vpn_gateway_connections_local_cidr_value_error()
-
-
-class TestAddVpnGatewayConnectionsLocalCidr:
- """
- Test Class for add_vpn_gateway_connections_local_cidr
- """
-
- @responses.activate
- def test_add_vpn_gateway_connections_local_cidr_all_params(self):
- """
- add_vpn_gateway_connections_local_cidr()
- """
- # Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
- responses.add(
- responses.PUT,
- url,
- status=201,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
- id = 'testString'
- cidr = '192.168.1.0/24'
+ virtual_network_interface_id = 'testString'
# Invoke method
- response = _service.add_vpn_gateway_connections_local_cidr(
- vpn_gateway_id,
- id,
- cidr,
+ response = _service.list_virtual_network_interface_ips(
+ virtual_network_interface_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 201
+ assert response.status_code == 200
- def test_add_vpn_gateway_connections_local_cidr_all_params_with_retries(self):
- # Enable retries and run test_add_vpn_gateway_connections_local_cidr_all_params.
+ def test_list_virtual_network_interface_ips_required_params_with_retries(self):
+ # Enable retries and run test_list_virtual_network_interface_ips_required_params.
_service.enable_retries()
- self.test_add_vpn_gateway_connections_local_cidr_all_params()
+ self.test_list_virtual_network_interface_ips_required_params()
- # Disable retries and run test_add_vpn_gateway_connections_local_cidr_all_params.
+ # Disable retries and run test_list_virtual_network_interface_ips_required_params.
_service.disable_retries()
- self.test_add_vpn_gateway_connections_local_cidr_all_params()
+ self.test_list_virtual_network_interface_ips_required_params()
@responses.activate
- def test_add_vpn_gateway_connections_local_cidr_value_error(self):
+ def test_list_virtual_network_interface_ips_value_error(self):
"""
- test_add_vpn_gateway_connections_local_cidr_value_error()
+ test_list_virtual_network_interface_ips_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips')
+ mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PUT,
+ responses.GET,
url,
- status=201,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
- id = 'testString'
- cidr = '192.168.1.0/24'
+ virtual_network_interface_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": cidr,
+ "virtual_network_interface_id": virtual_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.add_vpn_gateway_connections_local_cidr(**req_copy)
+ _service.list_virtual_network_interface_ips(**req_copy)
- def test_add_vpn_gateway_connections_local_cidr_value_error_with_retries(self):
- # Enable retries and run test_add_vpn_gateway_connections_local_cidr_value_error.
+ def test_list_virtual_network_interface_ips_value_error_with_retries(self):
+ # Enable retries and run test_list_virtual_network_interface_ips_value_error.
_service.enable_retries()
- self.test_add_vpn_gateway_connections_local_cidr_value_error()
+ self.test_list_virtual_network_interface_ips_value_error()
- # Disable retries and run test_add_vpn_gateway_connections_local_cidr_value_error.
+ # Disable retries and run test_list_virtual_network_interface_ips_value_error.
_service.disable_retries()
- self.test_add_vpn_gateway_connections_local_cidr_value_error()
+ self.test_list_virtual_network_interface_ips_value_error()
+ @responses.activate
+ def test_list_virtual_network_interface_ips_with_pager_get_next(self):
+ """
+ test_list_virtual_network_interface_ips_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/virtual_network_interfaces/testString/ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestListVpnGatewayConnectionsPeerCidrs:
- """
- Test Class for list_vpn_gateway_connections_peer_cidrs
- """
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VirtualNetworkInterfaceIpsPager(
+ client=_service,
+ virtual_network_interface_id='testString',
+ limit=10,
+ sort='name',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_list_vpn_gateway_connections_peer_cidrs_all_params(self):
+ def test_list_virtual_network_interface_ips_with_pager_get_all(self):
"""
- list_vpn_gateway_connections_peer_cidrs()
+ test_list_virtual_network_interface_ips_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs')
- mock_response = '{"cidrs": ["192.0.2.0/24"]}'
+ # Set up a two-page mock response
+ url = preprocess_url('/virtual_network_interfaces/testString/ips')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response1,
content_type='application/json',
status=200,
)
-
- # Set up parameter values
- vpn_gateway_id = 'testString'
- id = 'testString'
-
- # Invoke method
- response = _service.list_vpn_gateway_connections_peer_cidrs(
- vpn_gateway_id,
- id,
- headers={},
- )
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_vpn_gateway_connections_peer_cidrs_all_params_with_retries(self):
- # Enable retries and run test_list_vpn_gateway_connections_peer_cidrs_all_params.
- _service.enable_retries()
- self.test_list_vpn_gateway_connections_peer_cidrs_all_params()
-
- # Disable retries and run test_list_vpn_gateway_connections_peer_cidrs_all_params.
- _service.disable_retries()
- self.test_list_vpn_gateway_connections_peer_cidrs_all_params()
-
- @responses.activate
- def test_list_vpn_gateway_connections_peer_cidrs_value_error(self):
- """
- test_list_vpn_gateway_connections_peer_cidrs_value_error()
- """
- # Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs')
- mock_response = '{"cidrs": ["192.0.2.0/24"]}'
responses.add(
responses.GET,
url,
- body=mock_response,
+ body=mock_response2,
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.list_vpn_gateway_connections_peer_cidrs(**req_copy)
-
- def test_list_vpn_gateway_connections_peer_cidrs_value_error_with_retries(self):
- # Enable retries and run test_list_vpn_gateway_connections_peer_cidrs_value_error.
- _service.enable_retries()
- self.test_list_vpn_gateway_connections_peer_cidrs_value_error()
-
- # Disable retries and run test_list_vpn_gateway_connections_peer_cidrs_value_error.
- _service.disable_retries()
- self.test_list_vpn_gateway_connections_peer_cidrs_value_error()
+ # Exercise the pager class for this operation
+ pager = VirtualNetworkInterfaceIpsPager(
+ client=_service,
+ virtual_network_interface_id='testString',
+ limit=10,
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestRemoveVpnGatewayConnectionsPeerCidr:
+class TestRemoveVirtualNetworkInterfaceIp:
"""
- Test Class for remove_vpn_gateway_connections_peer_cidr
+ Test Class for remove_virtual_network_interface_ip
"""
@responses.activate
- def test_remove_vpn_gateway_connections_peer_cidr_all_params(self):
+ def test_remove_virtual_network_interface_ip_all_params(self):
"""
- remove_vpn_gateway_connections_peer_cidr()
+ remove_virtual_network_interface_ip()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
responses.add(
responses.DELETE,
url,
@@ -44888,15 +44840,13 @@ def test_remove_vpn_gateway_connections_peer_cidr_all_params(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Invoke method
- response = _service.remove_vpn_gateway_connections_peer_cidr(
- vpn_gateway_id,
+ response = _service.remove_virtual_network_interface_ip(
+ virtual_network_interface_id,
id,
- cidr,
headers={},
)
@@ -44904,22 +44854,22 @@ def test_remove_vpn_gateway_connections_peer_cidr_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_remove_vpn_gateway_connections_peer_cidr_all_params_with_retries(self):
- # Enable retries and run test_remove_vpn_gateway_connections_peer_cidr_all_params.
+ def test_remove_virtual_network_interface_ip_all_params_with_retries(self):
+ # Enable retries and run test_remove_virtual_network_interface_ip_all_params.
_service.enable_retries()
- self.test_remove_vpn_gateway_connections_peer_cidr_all_params()
+ self.test_remove_virtual_network_interface_ip_all_params()
- # Disable retries and run test_remove_vpn_gateway_connections_peer_cidr_all_params.
+ # Disable retries and run test_remove_virtual_network_interface_ip_all_params.
_service.disable_retries()
- self.test_remove_vpn_gateway_connections_peer_cidr_all_params()
+ self.test_remove_virtual_network_interface_ip_all_params()
@responses.activate
- def test_remove_vpn_gateway_connections_peer_cidr_value_error(self):
+ def test_remove_virtual_network_interface_ip_value_error(self):
"""
- test_remove_vpn_gateway_connections_peer_cidr_value_error()
+ test_remove_virtual_network_interface_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
responses.add(
responses.DELETE,
url,
@@ -44927,204 +44877,206 @@ def test_remove_vpn_gateway_connections_peer_cidr_value_error(self):
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpn_gateway_id": vpn_gateway_id,
+ "virtual_network_interface_id": virtual_network_interface_id,
"id": id,
- "cidr": cidr,
}
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_connections_peer_cidr(**req_copy)
+ _service.remove_virtual_network_interface_ip(**req_copy)
- def test_remove_vpn_gateway_connections_peer_cidr_value_error_with_retries(self):
- # Enable retries and run test_remove_vpn_gateway_connections_peer_cidr_value_error.
+ def test_remove_virtual_network_interface_ip_value_error_with_retries(self):
+ # Enable retries and run test_remove_virtual_network_interface_ip_value_error.
_service.enable_retries()
- self.test_remove_vpn_gateway_connections_peer_cidr_value_error()
+ self.test_remove_virtual_network_interface_ip_value_error()
- # Disable retries and run test_remove_vpn_gateway_connections_peer_cidr_value_error.
+ # Disable retries and run test_remove_virtual_network_interface_ip_value_error.
_service.disable_retries()
- self.test_remove_vpn_gateway_connections_peer_cidr_value_error()
+ self.test_remove_virtual_network_interface_ip_value_error()
-class TestCheckVpnGatewayConnectionsPeerCidr:
+class TestGetVirtualNetworkInterfaceIp:
"""
- Test Class for check_vpn_gateway_connections_peer_cidr
+ Test Class for get_virtual_network_interface_ip
"""
@responses.activate
- def test_check_vpn_gateway_connections_peer_cidr_all_params(self):
+ def test_get_virtual_network_interface_ip_all_params(self):
"""
- check_vpn_gateway_connections_peer_cidr()
+ get_virtual_network_interface_ip()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
+ mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
responses.add(
responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Invoke method
- response = _service.check_vpn_gateway_connections_peer_cidr(
- vpn_gateway_id,
+ response = _service.get_virtual_network_interface_ip(
+ virtual_network_interface_id,
id,
- cidr,
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_connections_peer_cidr_all_params_with_retries(self):
- # Enable retries and run test_check_vpn_gateway_connections_peer_cidr_all_params.
+ def test_get_virtual_network_interface_ip_all_params_with_retries(self):
+ # Enable retries and run test_get_virtual_network_interface_ip_all_params.
_service.enable_retries()
- self.test_check_vpn_gateway_connections_peer_cidr_all_params()
+ self.test_get_virtual_network_interface_ip_all_params()
- # Disable retries and run test_check_vpn_gateway_connections_peer_cidr_all_params.
+ # Disable retries and run test_get_virtual_network_interface_ip_all_params.
_service.disable_retries()
- self.test_check_vpn_gateway_connections_peer_cidr_all_params()
+ self.test_get_virtual_network_interface_ip_all_params()
@responses.activate
- def test_check_vpn_gateway_connections_peer_cidr_value_error(self):
+ def test_get_virtual_network_interface_ip_value_error(self):
"""
- test_check_vpn_gateway_connections_peer_cidr_value_error()
+ test_get_virtual_network_interface_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
+ mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
responses.add(
responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpn_gateway_id": vpn_gateway_id,
+ "virtual_network_interface_id": virtual_network_interface_id,
"id": id,
- "cidr": cidr,
}
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_connections_peer_cidr(**req_copy)
+ _service.get_virtual_network_interface_ip(**req_copy)
- def test_check_vpn_gateway_connections_peer_cidr_value_error_with_retries(self):
- # Enable retries and run test_check_vpn_gateway_connections_peer_cidr_value_error.
+ def test_get_virtual_network_interface_ip_value_error_with_retries(self):
+ # Enable retries and run test_get_virtual_network_interface_ip_value_error.
_service.enable_retries()
- self.test_check_vpn_gateway_connections_peer_cidr_value_error()
+ self.test_get_virtual_network_interface_ip_value_error()
- # Disable retries and run test_check_vpn_gateway_connections_peer_cidr_value_error.
+ # Disable retries and run test_get_virtual_network_interface_ip_value_error.
_service.disable_retries()
- self.test_check_vpn_gateway_connections_peer_cidr_value_error()
+ self.test_get_virtual_network_interface_ip_value_error()
-class TestAddVpnGatewayConnectionsPeerCidr:
+class TestAddVirtualNetworkInterfaceIp:
"""
- Test Class for add_vpn_gateway_connections_peer_cidr
+ Test Class for add_virtual_network_interface_ip
"""
@responses.activate
- def test_add_vpn_gateway_connections_peer_cidr_all_params(self):
+ def test_add_virtual_network_interface_ip_all_params(self):
"""
- add_vpn_gateway_connections_peer_cidr()
+ add_virtual_network_interface_ip()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
+ mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
responses.add(
responses.PUT,
url,
- status=201,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Invoke method
- response = _service.add_vpn_gateway_connections_peer_cidr(
- vpn_gateway_id,
+ response = _service.add_virtual_network_interface_ip(
+ virtual_network_interface_id,
id,
- cidr,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 201
+ assert response.status_code == 200
- def test_add_vpn_gateway_connections_peer_cidr_all_params_with_retries(self):
- # Enable retries and run test_add_vpn_gateway_connections_peer_cidr_all_params.
+ def test_add_virtual_network_interface_ip_all_params_with_retries(self):
+ # Enable retries and run test_add_virtual_network_interface_ip_all_params.
_service.enable_retries()
- self.test_add_vpn_gateway_connections_peer_cidr_all_params()
+ self.test_add_virtual_network_interface_ip_all_params()
- # Disable retries and run test_add_vpn_gateway_connections_peer_cidr_all_params.
+ # Disable retries and run test_add_virtual_network_interface_ip_all_params.
_service.disable_retries()
- self.test_add_vpn_gateway_connections_peer_cidr_all_params()
+ self.test_add_virtual_network_interface_ip_all_params()
@responses.activate
- def test_add_vpn_gateway_connections_peer_cidr_value_error(self):
+ def test_add_virtual_network_interface_ip_value_error(self):
"""
- test_add_vpn_gateway_connections_peer_cidr_value_error()
+ test_add_virtual_network_interface_ip_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
+ url = preprocess_url('/virtual_network_interfaces/testString/ips/testString')
+ mock_response = '{"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}'
responses.add(
responses.PUT,
url,
- status=201,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_gateway_id = 'testString'
+ virtual_network_interface_id = 'testString'
id = 'testString'
- cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpn_gateway_id": vpn_gateway_id,
+ "virtual_network_interface_id": virtual_network_interface_id,
"id": id,
- "cidr": cidr,
}
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_connections_peer_cidr(**req_copy)
+ _service.add_virtual_network_interface_ip(**req_copy)
- def test_add_vpn_gateway_connections_peer_cidr_value_error_with_retries(self):
- # Enable retries and run test_add_vpn_gateway_connections_peer_cidr_value_error.
+ def test_add_virtual_network_interface_ip_value_error_with_retries(self):
+ # Enable retries and run test_add_virtual_network_interface_ip_value_error.
_service.enable_retries()
- self.test_add_vpn_gateway_connections_peer_cidr_value_error()
+ self.test_add_virtual_network_interface_ip_value_error()
- # Disable retries and run test_add_vpn_gateway_connections_peer_cidr_value_error.
+ # Disable retries and run test_add_virtual_network_interface_ip_value_error.
_service.disable_retries()
- self.test_add_vpn_gateway_connections_peer_cidr_value_error()
+ self.test_add_virtual_network_interface_ip_value_error()
# endregion
##############################################################################
-# End of Service: VPNGateways
+# End of Service: VirtualNetworkInterfaces
##############################################################################
##############################################################################
-# Start of Service: VPNServers
+# Start of Service: Volumes
##############################################################################
# region
@@ -45175,19 +45127,285 @@ def test_new_instance_required_param_none(self):
)
-class TestListVpnServers:
+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": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}], "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ start = 'testString'
+ limit = 50
+
+ # 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": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}], "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": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}], "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_volume_profiles(**req_copy)
+
+ 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()
+
+ @responses.activate
+ def test_list_volume_profiles_with_pager_get_next(self):
+ """
+ test_list_volume_profiles_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/volume/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VolumeProfilesPager(
+ client=_service,
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_volume_profiles_with_pager_get_all(self):
+ """
+ test_list_volume_profiles_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/volume/profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"bandwidth":{"type":"fixed","value":4000},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose","storage_generation":{"type":"fixed","value":1}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VolumeProfilesPager(
+ client=_service,
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+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/10iops-tier')
+ mock_response = '{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ name = '10iops-tier'
+
+ # 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/10iops-tier')
+ mock_response = '{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "bandwidth": {"type": "fixed", "value": 4000}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose", "storage_generation": {"type": "fixed", "value": 1}}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ name = '10iops-tier'
+
+ # 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_vpn_servers
+ Test Class for list_volumes
"""
@responses.activate
- def test_list_vpn_servers_all_params(self):
+ def test_list_volumes_all_params(self):
"""
- list_vpn_servers()
+ list_volumes()
"""
# Set up mock
- url = preprocess_url('/vpn_servers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}'
+ url = preprocess_url('/volumes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45197,19 +45415,27 @@ def test_list_vpn_servers_all_params(self):
)
# Set up parameter values
- name = 'my-name'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
- sort = 'name'
+ attachment_state = 'attached'
+ encryption = 'provider_managed'
+ name = 'my-name'
+ operating_system_family = 'Ubuntu Server'
+ operating_system_architecture = 'amd64'
+ tag = 'testString'
+ zone_name = 'us-south-1'
# Invoke method
- response = _service.list_vpn_servers(
- name=name,
+ response = _service.list_volumes(
start=start,
limit=limit,
- resource_group_id=resource_group_id,
- sort=sort,
+ attachment_state=attachment_state,
+ encryption=encryption,
+ name=name,
+ operating_system_family=operating_system_family,
+ operating_system_architecture=operating_system_architecture,
+ tag=tag,
+ zone_name=zone_name,
headers={},
)
@@ -45219,29 +45445,33 @@ def test_list_vpn_servers_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 'sort={}'.format(sort) in query_string
+ assert 'attachment_state={}'.format(attachment_state) in query_string
+ assert 'encryption={}'.format(encryption) in query_string
+ assert 'name={}'.format(name) in query_string
+ assert 'operating_system.family={}'.format(operating_system_family) in query_string
+ assert 'operating_system.architecture={}'.format(operating_system_architecture) in query_string
+ assert 'tag={}'.format(tag) in query_string
+ assert 'zone.name={}'.format(zone_name) in query_string
- def test_list_vpn_servers_all_params_with_retries(self):
- # Enable retries and run test_list_vpn_servers_all_params.
+ def test_list_volumes_all_params_with_retries(self):
+ # Enable retries and run test_list_volumes_all_params.
_service.enable_retries()
- self.test_list_vpn_servers_all_params()
+ self.test_list_volumes_all_params()
- # Disable retries and run test_list_vpn_servers_all_params.
+ # Disable retries and run test_list_volumes_all_params.
_service.disable_retries()
- self.test_list_vpn_servers_all_params()
+ self.test_list_volumes_all_params()
@responses.activate
- def test_list_vpn_servers_required_params(self):
+ def test_list_volumes_required_params(self):
"""
- test_list_vpn_servers_required_params()
+ test_list_volumes_required_params()
"""
# Set up mock
- url = preprocess_url('/vpn_servers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}'
+ url = preprocess_url('/volumes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45251,29 +45481,29 @@ def test_list_vpn_servers_required_params(self):
)
# Invoke method
- response = _service.list_vpn_servers()
+ response = _service.list_volumes()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpn_servers_required_params_with_retries(self):
- # Enable retries and run test_list_vpn_servers_required_params.
+ def test_list_volumes_required_params_with_retries(self):
+ # Enable retries and run test_list_volumes_required_params.
_service.enable_retries()
- self.test_list_vpn_servers_required_params()
+ self.test_list_volumes_required_params()
- # Disable retries and run test_list_vpn_servers_required_params.
+ # Disable retries and run test_list_volumes_required_params.
_service.disable_retries()
- self.test_list_vpn_servers_required_params()
+ self.test_list_volumes_required_params()
@responses.activate
- def test_list_vpn_servers_value_error(self):
+ def test_list_volumes_value_error(self):
"""
- test_list_vpn_servers_value_error()
+ test_list_volumes_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}'
+ url = preprocess_url('/volumes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45288,26 +45518,26 @@ def test_list_vpn_servers_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_servers(**req_copy)
+ _service.list_volumes(**req_copy)
- def test_list_vpn_servers_value_error_with_retries(self):
- # Enable retries and run test_list_vpn_servers_value_error.
+ def test_list_volumes_value_error_with_retries(self):
+ # Enable retries and run test_list_volumes_value_error.
_service.enable_retries()
- self.test_list_vpn_servers_value_error()
+ self.test_list_volumes_value_error()
- # Disable retries and run test_list_vpn_servers_value_error.
+ # Disable retries and run test_list_volumes_value_error.
_service.disable_retries()
- self.test_list_vpn_servers_value_error()
+ self.test_list_volumes_value_error()
@responses.activate
- def test_list_vpn_servers_with_pager_get_next(self):
+ def test_list_volumes_with_pager_get_next(self):
"""
- test_list_vpn_servers_with_pager_get_next()
+ test_list_volumes_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_servers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/volumes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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,
@@ -45325,12 +45555,16 @@ def test_list_vpn_servers_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpnServersPager(
+ pager = VolumesPager(
client=_service,
- name='my-name',
limit=10,
- resource_group_id='testString',
- sort='name',
+ attachment_state='attached',
+ encryption='provider_managed',
+ name='my-name',
+ operating_system_family='Ubuntu Server',
+ operating_system_architecture='amd64',
+ tag='testString',
+ zone_name='us-south-1',
)
while pager.has_next():
next_page = pager.get_next()
@@ -45339,14 +45573,14 @@ def test_list_vpn_servers_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpn_servers_with_pager_get_all(self):
+ def test_list_volumes_with_pager_get_all(self):
"""
- test_list_vpn_servers_with_pager_get_all()
+ test_list_volumes_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_servers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/volumes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"allowed_use":{"api_version":"2024-06-23","bare_metal_server":"enable_secure_boot == true","instance":"gpu.count > 0 && enable_secure_boot == true"},"attachment_state":"attached","bandwidth":100,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"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-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"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"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r006-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"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"}],"storage_generation":1,"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":"id"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","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,
@@ -45363,31 +45597,35 @@ def test_list_vpn_servers_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpnServersPager(
+ pager = VolumesPager(
client=_service,
- name='my-name',
limit=10,
- resource_group_id='testString',
- sort='name',
+ attachment_state='attached',
+ encryption='provider_managed',
+ name='my-name',
+ operating_system_family='Ubuntu Server',
+ operating_system_architecture='amd64',
+ tag='testString',
+ zone_name='us-south-1',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateVpnServer:
+class TestCreateVolume:
"""
- Test Class for create_vpn_server
+ Test Class for create_volume
"""
@responses.activate
- def test_create_vpn_server_all_params(self):
+ def test_create_volume_all_params(self):
"""
- create_vpn_server()
+ create_volume()
"""
# Set up mock
- url = preprocess_url('/vpn_servers')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45396,63 +45634,40 @@ def test_create_vpn_server_all_params(self):
status=201,
)
- # 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/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a IP model
- ip_model = {}
- ip_model['address'] = '192.168.3.4'
+ # Construct a dict representation of a VolumeProfileIdentityByName model
+ volume_profile_identity_model = {}
+ volume_profile_identity_model['name'] = 'custom'
# 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34: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['bandwidth'] = 1000
+ 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'] = []
+ 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
- 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]
+ volume_prototype = volume_prototype_model
# Invoke method
- 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,
+ response = _service.create_volume(
+ volume_prototype,
headers={},
)
@@ -45461,36 +45676,25 @@ def test_create_vpn_server_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['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]
+ assert req_body == volume_prototype
- def test_create_vpn_server_all_params_with_retries(self):
- # Enable retries and run test_create_vpn_server_all_params.
+ def test_create_volume_all_params_with_retries(self):
+ # Enable retries and run test_create_volume_all_params.
_service.enable_retries()
- self.test_create_vpn_server_all_params()
+ self.test_create_volume_all_params()
- # Disable retries and run test_create_vpn_server_all_params.
+ # Disable retries and run test_create_volume_all_params.
_service.disable_retries()
- self.test_create_vpn_server_all_params()
+ self.test_create_volume_all_params()
@responses.activate
- def test_create_vpn_server_value_error(self):
+ def test_create_volume_value_error(self):
"""
- test_create_vpn_server_value_error()
+ test_create_volume_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45499,87 +45703,72 @@ def test_create_vpn_server_value_error(self):
status=201,
)
- # 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/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a IP model
- ip_model = {}
- ip_model['address'] = '192.168.3.4'
+ # Construct a dict representation of a VolumeProfileIdentityByName model
+ volume_profile_identity_model = {}
+ volume_profile_identity_model['name'] = 'custom'
# 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # 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/aa2432b1fa4d4ace891e9b80fc104e34: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['bandwidth'] = 1000
+ 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'] = []
+ 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
- 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]
+ volume_prototype = volume_prototype_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "certificate": certificate,
- "client_authentication": client_authentication,
- "client_ip_pool": client_ip_pool,
- "subnets": subnets,
+ "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_vpn_server(**req_copy)
+ _service.create_volume(**req_copy)
- def test_create_vpn_server_value_error_with_retries(self):
- # Enable retries and run test_create_vpn_server_value_error.
+ def test_create_volume_value_error_with_retries(self):
+ # Enable retries and run test_create_volume_value_error.
_service.enable_retries()
- self.test_create_vpn_server_value_error()
+ self.test_create_volume_value_error()
- # Disable retries and run test_create_vpn_server_value_error.
+ # Disable retries and run test_create_volume_value_error.
_service.disable_retries()
- self.test_create_vpn_server_value_error()
+ self.test_create_volume_value_error()
-class TestDeleteVpnServer:
+class TestDeleteVolume:
"""
- Test Class for delete_vpn_server
+ Test Class for delete_volume
"""
@responses.activate
- def test_delete_vpn_server_all_params(self):
+ def test_delete_volume_all_params(self):
"""
- delete_vpn_server()
+ delete_volume()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
+ url = preprocess_url('/volumes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
@@ -45587,7 +45776,7 @@ def test_delete_vpn_server_all_params(self):
if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.delete_vpn_server(
+ response = _service.delete_volume(
id,
if_match=if_match,
headers={},
@@ -45595,63 +45784,63 @@ def test_delete_vpn_server_all_params(self):
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_vpn_server_all_params_with_retries(self):
- # Enable retries and run test_delete_vpn_server_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_delete_vpn_server_all_params()
+ self.test_delete_volume_all_params()
- # Disable retries and run test_delete_vpn_server_all_params.
+ # Disable retries and run test_delete_volume_all_params.
_service.disable_retries()
- self.test_delete_vpn_server_all_params()
+ self.test_delete_volume_all_params()
@responses.activate
- def test_delete_vpn_server_required_params(self):
+ def test_delete_volume_required_params(self):
"""
- test_delete_vpn_server_required_params()
+ test_delete_volume_required_params()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
+ url = preprocess_url('/volumes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
id = 'testString'
# Invoke method
- response = _service.delete_vpn_server(
+ response = _service.delete_volume(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_vpn_server_required_params_with_retries(self):
- # Enable retries and run test_delete_vpn_server_required_params.
+ def test_delete_volume_required_params_with_retries(self):
+ # Enable retries and run test_delete_volume_required_params.
_service.enable_retries()
- self.test_delete_vpn_server_required_params()
+ self.test_delete_volume_required_params()
- # Disable retries and run test_delete_vpn_server_required_params.
+ # Disable retries and run test_delete_volume_required_params.
_service.disable_retries()
- self.test_delete_vpn_server_required_params()
+ self.test_delete_volume_required_params()
@responses.activate
- def test_delete_vpn_server_value_error(self):
+ def test_delete_volume_value_error(self):
"""
- test_delete_vpn_server_value_error()
+ test_delete_volume_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
+ url = preprocess_url('/volumes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
@@ -45664,31 +45853,31 @@ def test_delete_vpn_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.delete_vpn_server(**req_copy)
+ _service.delete_volume(**req_copy)
- def test_delete_vpn_server_value_error_with_retries(self):
- # Enable retries and run test_delete_vpn_server_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_delete_vpn_server_value_error()
+ self.test_delete_volume_value_error()
- # Disable retries and run test_delete_vpn_server_value_error.
+ # Disable retries and run test_delete_volume_value_error.
_service.disable_retries()
- self.test_delete_vpn_server_value_error()
+ self.test_delete_volume_value_error()
-class TestGetVpnServer:
+class TestGetVolume:
"""
- Test Class for get_vpn_server
+ Test Class for get_volume
"""
@responses.activate
- def test_get_vpn_server_all_params(self):
+ def test_get_volume_all_params(self):
"""
- get_vpn_server()
+ get_volume()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes/testString')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45701,7 +45890,7 @@ def test_get_vpn_server_all_params(self):
id = 'testString'
# Invoke method
- response = _service.get_vpn_server(
+ response = _service.get_volume(
id,
headers={},
)
@@ -45710,23 +45899,23 @@ def test_get_vpn_server_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_vpn_server_all_params_with_retries(self):
- # Enable retries and run test_get_vpn_server_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_get_vpn_server_all_params()
+ self.test_get_volume_all_params()
- # Disable retries and run test_get_vpn_server_all_params.
+ # Disable retries and run test_get_volume_all_params.
_service.disable_retries()
- self.test_get_vpn_server_all_params()
+ self.test_get_volume_all_params()
@responses.activate
- def test_get_vpn_server_value_error(self):
+ def test_get_volume_value_error(self):
"""
- test_get_vpn_server_value_error()
+ test_get_volume_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes/testString')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45745,31 +45934,31 @@ def test_get_vpn_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.get_vpn_server(**req_copy)
+ _service.get_volume(**req_copy)
- def test_get_vpn_server_value_error_with_retries(self):
- # Enable retries and run test_get_vpn_server_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_get_vpn_server_value_error()
+ self.test_get_volume_value_error()
- # Disable retries and run test_get_vpn_server_value_error.
+ # Disable retries and run test_get_volume_value_error.
_service.disable_retries()
- self.test_get_vpn_server_value_error()
+ self.test_get_volume_value_error()
-class TestUpdateVpnServer:
+class TestUpdateVolume:
"""
- Test Class for update_vpn_server
+ Test Class for update_volume
"""
@responses.activate
- def test_update_vpn_server_all_params(self):
+ def test_update_volume_all_params(self):
"""
- update_vpn_server()
+ update_volume()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes/testString')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45778,49 +45967,35 @@ def test_update_vpn_server_all_params(self):
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/aa2432b1fa4d4ace891e9b80fc104e34: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 VolumeAllowedUsePatch model
+ volume_allowed_use_patch_model = {}
+ volume_allowed_use_patch_model['api_version'] = '2024-06-23'
+ volume_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # 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 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-updated'
- vpn_server_patch_model['port'] = 443
- vpn_server_patch_model['protocol'] = 'tcp'
- vpn_server_patch_model['subnets'] = [subnet_identity_model]
+ # Construct a dict representation of a VolumePatch model
+ volume_patch_model = {}
+ volume_patch_model['allowed_use'] = volume_allowed_use_patch_model
+ volume_patch_model['bandwidth'] = 1000
+ 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'
- vpn_server_patch = vpn_server_patch_model
+ volume_patch = volume_patch_model
if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_vpn_server(
+ response = _service.update_volume(
id,
- vpn_server_patch,
+ volume_patch,
if_match=if_match,
headers={},
)
@@ -45830,25 +46005,25 @@ def test_update_vpn_server_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 == vpn_server_patch
+ assert req_body == volume_patch
- def test_update_vpn_server_all_params_with_retries(self):
- # Enable retries and run test_update_vpn_server_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_update_vpn_server_all_params()
+ self.test_update_volume_all_params()
- # Disable retries and run test_update_vpn_server_all_params.
+ # Disable retries and run test_update_volume_all_params.
_service.disable_retries()
- self.test_update_vpn_server_all_params()
+ self.test_update_volume_all_params()
@responses.activate
- def test_update_vpn_server_required_params(self):
+ def test_update_volume_required_params(self):
"""
- test_update_vpn_server_required_params()
+ test_update_volume_required_params()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes/testString')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45857,48 +46032,34 @@ def test_update_vpn_server_required_params(self):
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/aa2432b1fa4d4ace891e9b80fc104e34: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 VolumeAllowedUsePatch model
+ volume_allowed_use_patch_model = {}
+ volume_allowed_use_patch_model['api_version'] = '2024-06-23'
+ volume_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # 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 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-updated'
- vpn_server_patch_model['port'] = 443
- vpn_server_patch_model['protocol'] = 'tcp'
- vpn_server_patch_model['subnets'] = [subnet_identity_model]
+ # Construct a dict representation of a VolumePatch model
+ volume_patch_model = {}
+ volume_patch_model['allowed_use'] = volume_allowed_use_patch_model
+ volume_patch_model['bandwidth'] = 1000
+ 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'
- vpn_server_patch = vpn_server_patch_model
+ volume_patch = volume_patch_model
# Invoke method
- response = _service.update_vpn_server(
+ response = _service.update_volume(
id,
- vpn_server_patch,
+ volume_patch,
headers={},
)
@@ -45907,25 +46068,25 @@ def test_update_vpn_server_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 == vpn_server_patch
+ assert req_body == volume_patch
- def test_update_vpn_server_required_params_with_retries(self):
- # Enable retries and run test_update_vpn_server_required_params.
+ def test_update_volume_required_params_with_retries(self):
+ # Enable retries and run test_update_volume_required_params.
_service.enable_retries()
- self.test_update_vpn_server_required_params()
+ self.test_update_volume_required_params()
- # Disable retries and run test_update_vpn_server_required_params.
+ # Disable retries and run test_update_volume_required_params.
_service.disable_retries()
- self.test_update_vpn_server_required_params()
+ self.test_update_volume_required_params()
@responses.activate
- def test_update_vpn_server_value_error(self):
+ def test_update_volume_value_error(self):
"""
- test_update_vpn_server_value_error()
+ test_update_volume_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString')
- mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/volumes/testString')
+ mock_response = '{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "allowed_use": {"api_version": "2024-06-23", "bare_metal_server": "enable_secure_boot == true", "instance": "gpu.count > 0 && enable_secure_boot == true"}, "attachment_state": "attached", "bandwidth": 100, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "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-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "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"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-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/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r006-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/r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r006-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "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"}], "storage_generation": 1, "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": "id"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "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,
@@ -45934,120 +46095,153 @@ def test_update_vpn_server_value_error(self):
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/aa2432b1fa4d4ace891e9b80fc104e34: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 VolumeAllowedUsePatch model
+ volume_allowed_use_patch_model = {}
+ volume_allowed_use_patch_model['api_version'] = '2024-06-23'
+ volume_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ # 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 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-updated'
- vpn_server_patch_model['port'] = 443
- vpn_server_patch_model['protocol'] = 'tcp'
- vpn_server_patch_model['subnets'] = [subnet_identity_model]
+ # Construct a dict representation of a VolumePatch model
+ volume_patch_model = {}
+ volume_patch_model['allowed_use'] = volume_allowed_use_patch_model
+ volume_patch_model['bandwidth'] = 1000
+ 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'
- vpn_server_patch = vpn_server_patch_model
+ volume_patch = volume_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
"id": id,
- "vpn_server_patch": vpn_server_patch,
+ "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.update_vpn_server(**req_copy)
+ _service.update_volume(**req_copy)
- def test_update_vpn_server_value_error_with_retries(self):
- # Enable retries and run test_update_vpn_server_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_update_vpn_server_value_error()
+ self.test_update_volume_value_error()
- # Disable retries and run test_update_vpn_server_value_error.
+ # Disable retries and run test_update_volume_value_error.
_service.disable_retries()
- self.test_update_vpn_server_value_error()
+ self.test_update_volume_value_error()
-class TestGetVpnServerClientConfiguration:
+class TestListVolumeInstanceProfiles:
"""
- Test Class for get_vpn_server_client_configuration
+ Test Class for list_volume_instance_profiles
"""
@responses.activate
- def test_get_vpn_server_client_configuration_all_params(self):
+ def test_list_volume_instance_profiles_all_params(self):
"""
- get_vpn_server_client_configuration()
+ list_volume_instance_profiles()
"""
# Set up mock
- 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"'
+ url = preprocess_url('/volumes/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
body=mock_response,
- content_type='text/plain',
+ content_type='application/json',
status=200,
)
# Set up parameter values
id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.get_vpn_server_client_configuration(
+ response = _service.list_volume_instance_profiles(
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_get_vpn_server_client_configuration_all_params_with_retries(self):
- # Enable retries and run test_get_vpn_server_client_configuration_all_params.
+ def test_list_volume_instance_profiles_all_params_with_retries(self):
+ # Enable retries and run test_list_volume_instance_profiles_all_params.
_service.enable_retries()
- self.test_get_vpn_server_client_configuration_all_params()
+ self.test_list_volume_instance_profiles_all_params()
- # Disable retries and run test_get_vpn_server_client_configuration_all_params.
+ # Disable retries and run test_list_volume_instance_profiles_all_params.
_service.disable_retries()
- self.test_get_vpn_server_client_configuration_all_params()
+ self.test_list_volume_instance_profiles_all_params()
@responses.activate
- def test_get_vpn_server_client_configuration_value_error(self):
+ def test_list_volume_instance_profiles_required_params(self):
"""
- test_get_vpn_server_client_configuration_value_error()
+ test_list_volume_instance_profiles_required_params()
"""
# Set up mock
- 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"'
+ url = preprocess_url('/volumes/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
body=mock_response,
- content_type='text/plain',
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.list_volume_instance_profiles(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_volume_instance_profiles_required_params_with_retries(self):
+ # Enable retries and run test_list_volume_instance_profiles_required_params.
+ _service.enable_retries()
+ self.test_list_volume_instance_profiles_required_params()
+
+ # Disable retries and run test_list_volume_instance_profiles_required_params.
+ _service.disable_retries()
+ self.test_list_volume_instance_profiles_required_params()
+
+ @responses.activate
+ def test_list_volume_instance_profiles_value_error(self):
+ """
+ test_list_volume_instance_profiles_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/volumes/testString/instance_profiles')
+ mock_response = '{"first": {"href": "href"}, "instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
status=200,
)
@@ -46061,31 +46255,159 @@ def test_get_vpn_server_client_configuration_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_vpn_server_client_configuration(**req_copy)
+ _service.list_volume_instance_profiles(**req_copy)
- def test_get_vpn_server_client_configuration_value_error_with_retries(self):
- # Enable retries and run test_get_vpn_server_client_configuration_value_error.
+ def test_list_volume_instance_profiles_value_error_with_retries(self):
+ # Enable retries and run test_list_volume_instance_profiles_value_error.
_service.enable_retries()
- self.test_get_vpn_server_client_configuration_value_error()
+ self.test_list_volume_instance_profiles_value_error()
- # Disable retries and run test_get_vpn_server_client_configuration_value_error.
+ # Disable retries and run test_list_volume_instance_profiles_value_error.
_service.disable_retries()
- self.test_get_vpn_server_client_configuration_value_error()
+ self.test_list_volume_instance_profiles_value_error()
+ @responses.activate
+ def test_list_volume_instance_profiles_with_pager_get_next(self):
+ """
+ test_list_volume_instance_profiles_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/volumes/testString/instance_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestListVpnServerClients:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VolumeInstanceProfilesPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_volume_instance_profiles_with_pager_get_all(self):
+ """
+ test_list_volume_instance_profiles_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/volumes/testString/instance_profiles')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VolumeInstanceProfilesPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+# endregion
+##############################################################################
+# End of Service: Volumes
+##############################################################################
+
+##############################################################################
+# Start of Service: VPCs
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_vpn_server_clients
+ 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 TestListVpcs:
+ """
+ Test Class for list_vpcs
"""
@responses.activate
- def test_list_vpn_server_clients_all_params(self):
+ def test_list_vpcs_all_params(self):
"""
- list_vpn_server_clients()
+ list_vpcs()
"""
# 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpcs')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}'
responses.add(
responses.GET,
url,
@@ -46095,17 +46417,17 @@ def test_list_vpn_server_clients_all_params(self):
)
# Set up parameter values
- vpn_server_id = 'testString'
start = 'testString'
limit = 50
- sort = 'created_at'
+ resource_group_id = 'testString'
+ classic_access = True
# Invoke method
- response = _service.list_vpn_server_clients(
- vpn_server_id,
+ response = _service.list_vpcs(
start=start,
limit=limit,
- sort=sort,
+ resource_group_id=resource_group_id,
+ classic_access=classic_access,
headers={},
)
@@ -46117,25 +46439,26 @@ def test_list_vpn_server_clients_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 'sort={}'.format(sort) in query_string
+ assert 'resource_group.id={}'.format(resource_group_id) in query_string
+ assert 'classic_access={}'.format('true' if classic_access else 'false') in query_string
- def test_list_vpn_server_clients_all_params_with_retries(self):
- # Enable retries and run test_list_vpn_server_clients_all_params.
+ def test_list_vpcs_all_params_with_retries(self):
+ # Enable retries and run test_list_vpcs_all_params.
_service.enable_retries()
- self.test_list_vpn_server_clients_all_params()
+ self.test_list_vpcs_all_params()
- # Disable retries and run test_list_vpn_server_clients_all_params.
+ # Disable retries and run test_list_vpcs_all_params.
_service.disable_retries()
- self.test_list_vpn_server_clients_all_params()
+ self.test_list_vpcs_all_params()
@responses.activate
- def test_list_vpn_server_clients_required_params(self):
+ def test_list_vpcs_required_params(self):
"""
- test_list_vpn_server_clients_required_params()
+ test_list_vpcs_required_params()
"""
# 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpcs')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}'
responses.add(
responses.GET,
url,
@@ -46144,36 +46467,30 @@ def test_list_vpn_server_clients_required_params(self):
status=200,
)
- # Set up parameter values
- vpn_server_id = 'testString'
-
# Invoke method
- response = _service.list_vpn_server_clients(
- vpn_server_id,
- headers={},
- )
+ response = _service.list_vpcs()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_vpn_server_clients_required_params_with_retries(self):
- # Enable retries and run test_list_vpn_server_clients_required_params.
+ def test_list_vpcs_required_params_with_retries(self):
+ # Enable retries and run test_list_vpcs_required_params.
_service.enable_retries()
- self.test_list_vpn_server_clients_required_params()
+ self.test_list_vpcs_required_params()
- # Disable retries and run test_list_vpn_server_clients_required_params.
+ # Disable retries and run test_list_vpcs_required_params.
_service.disable_retries()
- self.test_list_vpn_server_clients_required_params()
+ self.test_list_vpcs_required_params()
@responses.activate
- def test_list_vpn_server_clients_value_error(self):
+ def test_list_vpcs_value_error(self):
"""
- test_list_vpn_server_clients_value_error()
+ test_list_vpcs_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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpcs')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}'
responses.add(
responses.GET,
url,
@@ -46182,36 +46499,32 @@ def test_list_vpn_server_clients_value_error(self):
status=200,
)
- # Set up parameter values
- vpn_server_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.list_vpn_server_clients(**req_copy)
+ _service.list_vpcs(**req_copy)
- def test_list_vpn_server_clients_value_error_with_retries(self):
- # Enable retries and run test_list_vpn_server_clients_value_error.
+ def test_list_vpcs_value_error_with_retries(self):
+ # Enable retries and run test_list_vpcs_value_error.
_service.enable_retries()
- self.test_list_vpn_server_clients_value_error()
+ self.test_list_vpcs_value_error()
- # Disable retries and run test_list_vpn_server_clients_value_error.
+ # Disable retries and run test_list_vpcs_value_error.
_service.disable_retries()
- self.test_list_vpn_server_clients_value_error()
+ self.test_list_vpcs_value_error()
@responses.activate
- def test_list_vpn_server_clients_with_pager_get_next(self):
+ def test_list_vpcs_with_pager_get_next(self):
"""
- test_list_vpn_server_clients_with_pager_get_next()
+ test_list_vpcs_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_servers/testString/clients')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
- mock_response2 = '{"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
+ url = preprocess_url('/vpcs')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
responses.add(
responses.GET,
url,
@@ -46229,11 +46542,11 @@ def test_list_vpn_server_clients_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = VpnServerClientsPager(
+ pager = VpcsPager(
client=_service,
- vpn_server_id='testString',
limit=10,
- sort='created_at',
+ resource_group_id='testString',
+ classic_access=True,
)
while pager.has_next():
next_page = pager.get_next()
@@ -46242,14 +46555,14 @@ def test_list_vpn_server_clients_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_vpn_server_clients_with_pager_get_all(self):
+ def test_list_vpcs_with_pager_get_all(self):
"""
- test_list_vpn_server_clients_with_pager_get_all()
+ test_list_vpcs_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/vpn_servers/testString/clients')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
- mock_response2 = '{"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
+ url = preprocess_url('/vpcs')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","cse_source_ips":[{"ip":{"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"}}],"default_network_acl":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"dns":{"enable_hub":true,"resolution_binding_count":0,"resolver":{"servers":[{"address":"192.168.3.4","zone_affinity":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"type":"delegated","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}},"health_reasons":[{"code":"dns_resolution_binding_failed","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","public_address_ranges":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a","id":"r006-a4841334-b584-4293-938e-3bc63b4a5b6a","name":"my-public-address-range","resource_type":"public_address_range"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"vpc","status":"available"}]}'
responses.add(
responses.GET,
url,
@@ -46266,273 +46579,289 @@ def test_list_vpn_server_clients_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = VpnServerClientsPager(
+ pager = VpcsPager(
client=_service,
- vpn_server_id='testString',
limit=10,
- sort='created_at',
+ resource_group_id='testString',
+ classic_access=True,
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestDeleteVpnServerClient:
+class TestCreateVpc:
"""
- Test Class for delete_vpn_server_client
+ Test Class for create_vpc
"""
@responses.activate
- def test_delete_vpn_server_client_all_params(self):
+ def test_create_vpc_all_params(self):
"""
- delete_vpn_server_client()
+ create_vpc()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/clients/testString')
+ url = preprocess_url('/vpcs')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
+ responses.add(
+ responses.POST,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
+ )
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a DNSServerPrototype model
+ dns_server_prototype_model = {}
+ dns_server_prototype_model['address'] = '192.168.3.4'
+ dns_server_prototype_model['zone_affinity'] = zone_identity_model
+
+ # Construct a dict representation of a VPCDNSResolverPrototypeVPCDNSResolverTypeManualPrototype model
+ vpcdns_resolver_prototype_model = {}
+ vpcdns_resolver_prototype_model['manual_servers'] = [dns_server_prototype_model]
+ vpcdns_resolver_prototype_model['type'] = 'manual'
+
+ # Construct a dict representation of a VPCDNSPrototype model
+ vpcdns_prototype_model = {}
+ vpcdns_prototype_model['enable_hub'] = False
+ vpcdns_prototype_model['resolver'] = vpcdns_resolver_prototype_model
+
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Set up parameter values
+ address_prefix_management = 'auto'
+ classic_access = False
+ dns = vpcdns_prototype_model
+ name = 'my-vpc'
+ resource_group = resource_group_identity_model
+
+ # Invoke method
+ response = _service.create_vpc(
+ address_prefix_management=address_prefix_management,
+ classic_access=classic_access,
+ dns=dns,
+ name=name,
+ resource_group=resource_group,
+ 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['address_prefix_management'] == 'auto'
+ assert req_body['classic_access'] == False
+ assert req_body['dns'] == vpcdns_prototype_model
+ assert req_body['name'] == 'my-vpc'
+ assert req_body['resource_group'] == resource_group_identity_model
+
+ def test_create_vpc_all_params_with_retries(self):
+ # Enable retries and run test_create_vpc_all_params.
+ _service.enable_retries()
+ self.test_create_vpc_all_params()
+
+ # Disable retries and run test_create_vpc_all_params.
+ _service.disable_retries()
+ self.test_create_vpc_all_params()
+
+ @responses.activate
+ def test_create_vpc_required_params(self):
+ """
+ test_create_vpc_required_params()
+ """
+ # Set up mock
+ url = preprocess_url('/vpcs')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
- # Set up parameter values
- vpn_server_id = 'testString'
- id = 'testString'
-
# Invoke method
- response = _service.delete_vpn_server_client(
- vpn_server_id,
- id,
- headers={},
- )
+ response = _service.create_vpc()
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 201
- def test_delete_vpn_server_client_all_params_with_retries(self):
- # Enable retries and run test_delete_vpn_server_client_all_params.
+ def test_create_vpc_required_params_with_retries(self):
+ # Enable retries and run test_create_vpc_required_params.
_service.enable_retries()
- self.test_delete_vpn_server_client_all_params()
+ self.test_create_vpc_required_params()
- # Disable retries and run test_delete_vpn_server_client_all_params.
+ # Disable retries and run test_create_vpc_required_params.
_service.disable_retries()
- self.test_delete_vpn_server_client_all_params()
+ self.test_create_vpc_required_params()
@responses.activate
- def test_delete_vpn_server_client_value_error(self):
+ def test_create_vpc_value_error(self):
"""
- test_delete_vpn_server_client_value_error()
+ test_create_vpc_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/clients/testString')
+ url = preprocess_url('/vpcs')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
- responses.DELETE,
+ responses.POST,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
- # Set up parameter values
- vpn_server_id = 'testString'
- id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.delete_vpn_server_client(**req_copy)
+ _service.create_vpc(**req_copy)
- def test_delete_vpn_server_client_value_error_with_retries(self):
- # Enable retries and run test_delete_vpn_server_client_value_error.
+ def test_create_vpc_value_error_with_retries(self):
+ # Enable retries and run test_create_vpc_value_error.
_service.enable_retries()
- self.test_delete_vpn_server_client_value_error()
+ self.test_create_vpc_value_error()
- # Disable retries and run test_delete_vpn_server_client_value_error.
+ # Disable retries and run test_create_vpc_value_error.
_service.disable_retries()
- self.test_delete_vpn_server_client_value_error()
+ self.test_create_vpc_value_error()
-class TestGetVpnServerClient:
+class TestDeleteVpc:
"""
- Test Class for get_vpn_server_client
+ Test Class for delete_vpc
"""
@responses.activate
- def test_get_vpn_server_client_all_params(self):
+ def test_delete_vpc_all_params(self):
"""
- get_vpn_server_client()
+ delete_vpc()
"""
# Set up mock
- 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}'
+ url = preprocess_url('/vpcs/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.get_vpn_server_client(
- vpn_server_id,
+ response = _service.delete_vpc(
id,
+ if_match=if_match,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
-
- 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_get_vpn_server_client_all_params()
-
- # Disable retries and run test_get_vpn_server_client_all_params.
- _service.disable_retries()
- self.test_get_vpn_server_client_all_params()
-
- @responses.activate
- def test_get_vpn_server_client_value_error(self):
- """
- test_get_vpn_server_client_value_error()
- """
- # Set up mock
- 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- vpn_server_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "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.get_vpn_server_client(**req_copy)
+ assert response.status_code == 204
- def test_get_vpn_server_client_value_error_with_retries(self):
- # Enable retries and run test_get_vpn_server_client_value_error.
+ def test_delete_vpc_all_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_all_params.
_service.enable_retries()
- self.test_get_vpn_server_client_value_error()
+ self.test_delete_vpc_all_params()
- # Disable retries and run test_get_vpn_server_client_value_error.
+ # Disable retries and run test_delete_vpc_all_params.
_service.disable_retries()
- self.test_get_vpn_server_client_value_error()
-
-
-class TestDisconnectVpnClient:
- """
- Test Class for disconnect_vpn_client
- """
+ self.test_delete_vpc_all_params()
@responses.activate
- def test_disconnect_vpn_client_all_params(self):
+ def test_delete_vpc_required_params(self):
"""
- disconnect_vpn_client()
+ test_delete_vpc_required_params()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/clients/testString/disconnect')
+ url = preprocess_url('/vpcs/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.disconnect_vpn_client(
- vpn_server_id,
+ response = _service.delete_vpc(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_disconnect_vpn_client_all_params_with_retries(self):
- # Enable retries and run test_disconnect_vpn_client_all_params.
+ def test_delete_vpc_required_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_required_params.
_service.enable_retries()
- self.test_disconnect_vpn_client_all_params()
+ self.test_delete_vpc_required_params()
- # Disable retries and run test_disconnect_vpn_client_all_params.
+ # Disable retries and run test_delete_vpc_required_params.
_service.disable_retries()
- self.test_disconnect_vpn_client_all_params()
+ self.test_delete_vpc_required_params()
@responses.activate
- def test_disconnect_vpn_client_value_error(self):
+ def test_delete_vpc_value_error(self):
"""
- test_disconnect_vpn_client_value_error()
+ test_delete_vpc_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/clients/testString/disconnect')
+ url = preprocess_url('/vpcs/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.disconnect_vpn_client(**req_copy)
+ _service.delete_vpc(**req_copy)
- def test_disconnect_vpn_client_value_error_with_retries(self):
- # Enable retries and run test_disconnect_vpn_client_value_error.
+ def test_delete_vpc_value_error_with_retries(self):
+ # Enable retries and run test_delete_vpc_value_error.
_service.enable_retries()
- self.test_disconnect_vpn_client_value_error()
+ self.test_delete_vpc_value_error()
- # Disable retries and run test_disconnect_vpn_client_value_error.
+ # Disable retries and run test_delete_vpc_value_error.
_service.disable_retries()
- self.test_disconnect_vpn_client_value_error()
+ self.test_delete_vpc_value_error()
-class TestListVpnServerRoutes:
+class TestGetVpc:
"""
- Test Class for list_vpn_server_routes
+ Test Class for get_vpc
"""
@responses.activate
- def test_list_vpn_server_routes_all_params(self):
+ def test_get_vpc_all_params(self):
"""
- list_vpn_server_routes()
+ get_vpc()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}'
+ url = preprocess_url('/vpcs/testString')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
responses.GET,
url,
@@ -46542,47 +46871,35 @@ def test_list_vpn_server_routes_all_params(self):
)
# Set up parameter values
- vpn_server_id = 'testString'
- start = 'testString'
- limit = 50
- sort = 'name'
+ id = 'testString'
# Invoke method
- response = _service.list_vpn_server_routes(
- vpn_server_id,
- start=start,
- limit=limit,
- sort=sort,
+ response = _service.get_vpc(
+ 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 '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.
+ def test_get_vpc_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_all_params.
_service.enable_retries()
- self.test_list_vpn_server_routes_all_params()
+ self.test_get_vpc_all_params()
- # Disable retries and run test_list_vpn_server_routes_all_params.
+ # Disable retries and run test_get_vpc_all_params.
_service.disable_retries()
- self.test_list_vpn_server_routes_all_params()
+ self.test_get_vpc_all_params()
@responses.activate
- def test_list_vpn_server_routes_required_params(self):
+ def test_get_vpc_value_error(self):
"""
- test_list_vpn_server_routes_required_params()
+ test_get_vpc_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}'
+ url = preprocess_url('/vpcs/testString')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
responses.GET,
url,
@@ -46592,326 +46909,341 @@ def test_list_vpn_server_routes_required_params(self):
)
# Set up parameter values
- vpn_server_id = 'testString'
-
- # Invoke method
- response = _service.list_vpn_server_routes(
- vpn_server_id,
- headers={},
- )
+ id = 'testString'
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
+ # 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_vpc(**req_copy)
- def test_list_vpn_server_routes_required_params_with_retries(self):
- # Enable retries and run test_list_vpn_server_routes_required_params.
+ def test_get_vpc_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_value_error.
_service.enable_retries()
- self.test_list_vpn_server_routes_required_params()
+ self.test_get_vpc_value_error()
- # Disable retries and run test_list_vpn_server_routes_required_params.
+ # Disable retries and run test_get_vpc_value_error.
_service.disable_retries()
- self.test_list_vpn_server_routes_required_params()
+ self.test_get_vpc_value_error()
+
+
+class TestUpdateVpc:
+ """
+ Test Class for update_vpc
+ """
@responses.activate
- def test_list_vpn_server_routes_value_error(self):
+ def test_update_vpc_all_params(self):
"""
- test_list_vpn_server_routes_value_error()
+ update_vpc()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/routes')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}'
+ url = preprocess_url('/vpcs/testString')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a DNSServerPrototype model
+ dns_server_prototype_model = {}
+ dns_server_prototype_model['address'] = '192.168.3.4'
+ dns_server_prototype_model['zone_affinity'] = zone_identity_model
+
+ # Construct a dict representation of a VPCDNSResolverVPCPatchVPCIdentityById model
+ vpcdns_resolver_vpc_patch_model = {}
+ vpcdns_resolver_vpc_patch_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a VPCDNSResolverPatch model
+ vpcdns_resolver_patch_model = {}
+ vpcdns_resolver_patch_model['manual_servers'] = [dns_server_prototype_model]
+ vpcdns_resolver_patch_model['type'] = 'delegated'
+ vpcdns_resolver_patch_model['vpc'] = vpcdns_resolver_vpc_patch_model
+
+ # Construct a dict representation of a VPCDNSPatch model
+ vpcdns_patch_model = {}
+ vpcdns_patch_model['enable_hub'] = True
+ vpcdns_patch_model['resolver'] = vpcdns_resolver_patch_model
+
+ # Construct a dict representation of a VPCPatch model
+ vpc_patch_model = {}
+ vpc_patch_model['dns'] = vpcdns_patch_model
+ vpc_patch_model['name'] = 'my-vpc'
+
# Set up parameter values
- vpn_server_id = 'testString'
+ id = 'testString'
+ vpc_patch = vpc_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "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.list_vpn_server_routes(**req_copy)
+ # Invoke method
+ response = _service.update_vpc(
+ id,
+ vpc_patch,
+ if_match=if_match,
+ headers={},
+ )
- def test_list_vpn_server_routes_value_error_with_retries(self):
- # Enable retries and run test_list_vpn_server_routes_value_error.
+ # 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 == vpc_patch
+
+ def test_update_vpc_all_params_with_retries(self):
+ # Enable retries and run test_update_vpc_all_params.
_service.enable_retries()
- self.test_list_vpn_server_routes_value_error()
+ self.test_update_vpc_all_params()
- # Disable retries and run test_list_vpn_server_routes_value_error.
+ # Disable retries and run test_update_vpc_all_params.
_service.disable_retries()
- self.test_list_vpn_server_routes_value_error()
+ self.test_update_vpc_all_params()
@responses.activate
- def test_list_vpn_server_routes_with_pager_get_next(self):
+ def test_update_vpc_required_params(self):
"""
- test_list_vpn_server_routes_with_pager_get_next()
+ test_update_vpc_required_params()
"""
- # Set up a two-page mock response
- url = preprocess_url('/vpn_servers/testString/routes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
- mock_response2 = '{"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/vpcs/testString')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = VpnServerRoutesPager(
- client=_service,
- vpn_server_id='testString',
- limit=10,
- sort='name',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- @responses.activate
- def test_list_vpn_server_routes_with_pager_get_all(self):
- """
- test_list_vpn_server_routes_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/vpn_servers/testString/routes')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
- mock_response2 = '{"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
+ # Construct a dict representation of a DNSServerPrototype model
+ dns_server_prototype_model = {}
+ dns_server_prototype_model['address'] = '192.168.3.4'
+ dns_server_prototype_model['zone_affinity'] = zone_identity_model
- # Exercise the pager class for this operation
- pager = VpnServerRoutesPager(
- client=_service,
- vpn_server_id='testString',
- limit=10,
- sort='name',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Construct a dict representation of a VPCDNSResolverVPCPatchVPCIdentityById model
+ vpcdns_resolver_vpc_patch_model = {}
+ vpcdns_resolver_vpc_patch_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a dict representation of a VPCDNSResolverPatch model
+ vpcdns_resolver_patch_model = {}
+ vpcdns_resolver_patch_model['manual_servers'] = [dns_server_prototype_model]
+ vpcdns_resolver_patch_model['type'] = 'delegated'
+ vpcdns_resolver_patch_model['vpc'] = vpcdns_resolver_vpc_patch_model
-class TestCreateVpnServerRoute:
- """
- Test Class for create_vpn_server_route
- """
+ # Construct a dict representation of a VPCDNSPatch model
+ vpcdns_patch_model = {}
+ vpcdns_patch_model['enable_hub'] = True
+ vpcdns_patch_model['resolver'] = vpcdns_resolver_patch_model
- @responses.activate
- def test_create_vpn_server_route_all_params(self):
- """
- create_vpn_server_route()
- """
- # Set up mock
- 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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=201,
- )
+ # Construct a dict representation of a VPCPatch model
+ vpc_patch_model = {}
+ vpc_patch_model['dns'] = vpcdns_patch_model
+ vpc_patch_model['name'] = 'my-vpc'
# Set up parameter values
- vpn_server_id = 'testString'
- destination = '172.16.0.0/16'
- action = 'deliver'
- name = 'my-vpn-route-2'
+ id = 'testString'
+ vpc_patch = vpc_patch_model
# Invoke method
- response = _service.create_vpn_server_route(
- vpn_server_id,
- destination,
- action=action,
- name=name,
+ response = _service.update_vpc(
+ id,
+ vpc_patch,
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['destination'] == '172.16.0.0/16'
- assert req_body['action'] == 'deliver'
- assert req_body['name'] == 'my-vpn-route-2'
+ assert req_body == vpc_patch
- def test_create_vpn_server_route_all_params_with_retries(self):
- # Enable retries and run test_create_vpn_server_route_all_params.
+ def test_update_vpc_required_params_with_retries(self):
+ # Enable retries and run test_update_vpc_required_params.
_service.enable_retries()
- self.test_create_vpn_server_route_all_params()
+ self.test_update_vpc_required_params()
- # Disable retries and run test_create_vpn_server_route_all_params.
+ # Disable retries and run test_update_vpc_required_params.
_service.disable_retries()
- self.test_create_vpn_server_route_all_params()
+ self.test_update_vpc_required_params()
@responses.activate
- def test_create_vpn_server_route_value_error(self):
+ def test_update_vpc_value_error(self):
"""
- test_create_vpn_server_route_value_error()
+ test_update_vpc_value_error()
"""
# Set up mock
- 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
+ url = preprocess_url('/vpcs/testString')
+ mock_response = '{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"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"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": true, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "public_address_ranges": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::public-address-range:r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_address_ranges/r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "id": "r006-a4841334-b584-4293-938e-3bc63b4a5b6a", "name": "my-public-address-range", "resource_type": "public_address_range"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a DNSServerPrototype model
+ dns_server_prototype_model = {}
+ dns_server_prototype_model['address'] = '192.168.3.4'
+ dns_server_prototype_model['zone_affinity'] = zone_identity_model
+
+ # Construct a dict representation of a VPCDNSResolverVPCPatchVPCIdentityById model
+ vpcdns_resolver_vpc_patch_model = {}
+ vpcdns_resolver_vpc_patch_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a dict representation of a VPCDNSResolverPatch model
+ vpcdns_resolver_patch_model = {}
+ vpcdns_resolver_patch_model['manual_servers'] = [dns_server_prototype_model]
+ vpcdns_resolver_patch_model['type'] = 'delegated'
+ vpcdns_resolver_patch_model['vpc'] = vpcdns_resolver_vpc_patch_model
+
+ # Construct a dict representation of a VPCDNSPatch model
+ vpcdns_patch_model = {}
+ vpcdns_patch_model['enable_hub'] = True
+ vpcdns_patch_model['resolver'] = vpcdns_resolver_patch_model
+
+ # Construct a dict representation of a VPCPatch model
+ vpc_patch_model = {}
+ vpc_patch_model['dns'] = vpcdns_patch_model
+ vpc_patch_model['name'] = 'my-vpc'
+
# Set up parameter values
- vpn_server_id = 'testString'
- destination = '172.16.0.0/16'
- action = 'deliver'
- name = 'my-vpn-route-2'
+ id = 'testString'
+ vpc_patch = vpc_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "vpn_server_id": vpn_server_id,
- "destination": destination,
+ "id": id,
+ "vpc_patch": vpc_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.create_vpn_server_route(**req_copy)
+ _service.update_vpc(**req_copy)
- def test_create_vpn_server_route_value_error_with_retries(self):
- # Enable retries and run test_create_vpn_server_route_value_error.
+ def test_update_vpc_value_error_with_retries(self):
+ # Enable retries and run test_update_vpc_value_error.
_service.enable_retries()
- self.test_create_vpn_server_route_value_error()
+ self.test_update_vpc_value_error()
- # Disable retries and run test_create_vpn_server_route_value_error.
+ # Disable retries and run test_update_vpc_value_error.
_service.disable_retries()
- self.test_create_vpn_server_route_value_error()
+ self.test_update_vpc_value_error()
-class TestDeleteVpnServerRoute:
+class TestGetVpcDefaultNetworkAcl:
"""
- Test Class for delete_vpn_server_route
+ Test Class for get_vpc_default_network_acl
"""
@responses.activate
- def test_delete_vpn_server_route_all_params(self):
+ def test_get_vpc_default_network_acl_all_params(self):
"""
- delete_vpn_server_route()
+ get_vpc_default_network_acl()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/routes/testString')
+ url = preprocess_url('/vpcs/testString/default_network_acl')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_vpn_server_route(
- vpn_server_id,
+ response = _service.get_vpc_default_network_acl(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_vpn_server_route_all_params_with_retries(self):
- # Enable retries and run test_delete_vpn_server_route_all_params.
+ def test_get_vpc_default_network_acl_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_default_network_acl_all_params.
_service.enable_retries()
- self.test_delete_vpn_server_route_all_params()
+ self.test_get_vpc_default_network_acl_all_params()
- # Disable retries and run test_delete_vpn_server_route_all_params.
+ # Disable retries and run test_get_vpc_default_network_acl_all_params.
_service.disable_retries()
- self.test_delete_vpn_server_route_all_params()
+ self.test_get_vpc_default_network_acl_all_params()
@responses.activate
- def test_delete_vpn_server_route_value_error(self):
+ def test_get_vpc_default_network_acl_value_error(self):
"""
- test_delete_vpn_server_route_value_error()
+ test_get_vpc_default_network_acl_value_error()
"""
# Set up mock
- url = preprocess_url('/vpn_servers/testString/routes/testString')
+ url = preprocess_url('/vpcs/testString/default_network_acl')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-network-acl-rule"}, "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/r006-3217cb8b-5368-452a-9399-a84f14fb539d/rules/r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "r006-8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-network-acl-rule", "source": "192.168.3.0/24", "protocol": "all"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.delete_vpn_server_route(**req_copy)
+ _service.get_vpc_default_network_acl(**req_copy)
- def test_delete_vpn_server_route_value_error_with_retries(self):
- # Enable retries and run test_delete_vpn_server_route_value_error.
+ def test_get_vpc_default_network_acl_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_default_network_acl_value_error.
_service.enable_retries()
- self.test_delete_vpn_server_route_value_error()
+ self.test_get_vpc_default_network_acl_value_error()
- # Disable retries and run test_delete_vpn_server_route_value_error.
+ # Disable retries and run test_get_vpc_default_network_acl_value_error.
_service.disable_retries()
- self.test_delete_vpn_server_route_value_error()
+ self.test_get_vpc_default_network_acl_value_error()
-class TestGetVpnServerRoute:
+class TestGetVpcDefaultRoutingTable:
"""
- Test Class for get_vpn_server_route
+ Test Class for get_vpc_default_routing_table
"""
@responses.activate
- def test_get_vpn_server_route_all_params(self):
+ def test_get_vpc_default_routing_table_all_params(self):
"""
- get_vpn_server_route()
+ get_vpc_default_routing_table()
"""
# Set up mock
- 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
+ url = preprocess_url('/vpcs/testString/default_routing_table')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
responses.GET,
url,
@@ -46921,12 +47253,10 @@ def test_get_vpn_server_route_all_params(self):
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_vpn_server_route(
- vpn_server_id,
+ response = _service.get_vpc_default_routing_table(
id,
headers={},
)
@@ -46935,23 +47265,23 @@ def test_get_vpn_server_route_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_vpn_server_route_all_params_with_retries(self):
- # Enable retries and run test_get_vpn_server_route_all_params.
+ def test_get_vpc_default_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_default_routing_table_all_params.
_service.enable_retries()
- self.test_get_vpn_server_route_all_params()
+ self.test_get_vpc_default_routing_table_all_params()
- # Disable retries and run test_get_vpn_server_route_all_params.
+ # Disable retries and run test_get_vpc_default_routing_table_all_params.
_service.disable_retries()
- self.test_get_vpn_server_route_all_params()
+ self.test_get_vpc_default_routing_table_all_params()
@responses.activate
- def test_get_vpn_server_route_value_error(self):
+ def test_get_vpc_default_routing_table_value_error(self):
"""
- test_get_vpn_server_route_value_error()
+ test_get_vpc_default_routing_table_value_error()
"""
# Set up mock
- 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
+ url = preprocess_url('/vpcs/testString/default_routing_table')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
responses.GET,
url,
@@ -46961,199 +47291,121 @@ def test_get_vpn_server_route_value_error(self):
)
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "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.get_vpn_server_route(**req_copy)
+ _service.get_vpc_default_routing_table(**req_copy)
- def test_get_vpn_server_route_value_error_with_retries(self):
- # Enable retries and run test_get_vpn_server_route_value_error.
+ def test_get_vpc_default_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_default_routing_table_value_error.
_service.enable_retries()
- self.test_get_vpn_server_route_value_error()
+ self.test_get_vpc_default_routing_table_value_error()
- # Disable retries and run test_get_vpn_server_route_value_error.
+ # Disable retries and run test_get_vpc_default_routing_table_value_error.
_service.disable_retries()
- self.test_get_vpn_server_route_value_error()
+ self.test_get_vpc_default_routing_table_value_error()
-class TestUpdateVpnServerRoute:
+class TestGetVpcDefaultSecurityGroup:
"""
- Test Class for update_vpn_server_route
+ Test Class for get_vpc_default_security_group
"""
@responses.activate
- def test_update_vpn_server_route_all_params(self):
+ def test_get_vpc_default_security_group_all_params(self):
"""
- update_vpn_server_route()
+ get_vpc_default_security_group()
"""
# Set up mock
- 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
+ url = preprocess_url('/vpcs/testString/default_security_group')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
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-server-route-updated'
-
# Set up parameter values
- vpn_server_id = 'testString'
id = 'testString'
- vpn_server_route_patch = vpn_server_route_patch_model
# Invoke method
- response = _service.update_vpn_server_route(
- vpn_server_id,
+ response = _service.get_vpc_default_security_group(
id,
- vpn_server_route_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_server_route_patch
- def test_update_vpn_server_route_all_params_with_retries(self):
- # Enable retries and run test_update_vpn_server_route_all_params.
+ def test_get_vpc_default_security_group_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_default_security_group_all_params.
_service.enable_retries()
- self.test_update_vpn_server_route_all_params()
+ self.test_get_vpc_default_security_group_all_params()
- # Disable retries and run test_update_vpn_server_route_all_params.
+ # Disable retries and run test_get_vpc_default_security_group_all_params.
_service.disable_retries()
- self.test_update_vpn_server_route_all_params()
+ self.test_get_vpc_default_security_group_all_params()
@responses.activate
- def test_update_vpn_server_route_value_error(self):
+ def test_get_vpc_default_security_group_value_error(self):
"""
- test_update_vpn_server_route_value_error()
+ test_get_vpc_default_security_group_value_error()
"""
# Set up mock
- 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
+ url = preprocess_url('/vpcs/testString/default_security_group')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "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/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
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-server-route-updated'
-
# Set up parameter values
- vpn_server_id = 'testString'
id = '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_server_id": vpn_server_id,
"id": id,
- "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.update_vpn_server_route(**req_copy)
+ _service.get_vpc_default_security_group(**req_copy)
- def test_update_vpn_server_route_value_error_with_retries(self):
- # Enable retries and run test_update_vpn_server_route_value_error.
+ def test_get_vpc_default_security_group_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_default_security_group_value_error.
_service.enable_retries()
- self.test_update_vpn_server_route_value_error()
+ self.test_get_vpc_default_security_group_value_error()
- # Disable retries and run test_update_vpn_server_route_value_error.
+ # Disable retries and run test_get_vpc_default_security_group_value_error.
_service.disable_retries()
- self.test_update_vpn_server_route_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: VPNServers
-##############################################################################
-
-##############################################################################
-# Start of Service: LoadBalancers
-##############################################################################
-# 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,
- )
+ self.test_get_vpc_default_security_group_value_error()
-class TestListLoadBalancerProfiles:
+class TestListVpcAddressPrefixes:
"""
- Test Class for list_load_balancer_profiles
+ Test Class for list_vpc_address_prefixes
"""
@responses.activate
- def test_list_load_balancer_profiles_all_params(self):
+ def test_list_vpc_address_prefixes_all_params(self):
"""
- list_load_balancer_profiles()
+ list_vpc_address_prefixes()
"""
# Set up mock
- url = preprocess_url('/load_balancer/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}'
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response = '{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -47163,11 +47415,13 @@ def test_list_load_balancer_profiles_all_params(self):
)
# Set up parameter values
+ vpc_id = 'testString'
start = 'testString'
limit = 50
# Invoke method
- response = _service.list_load_balancer_profiles(
+ response = _service.list_vpc_address_prefixes(
+ vpc_id,
start=start,
limit=limit,
headers={},
@@ -47182,23 +47436,23 @@ def test_list_load_balancer_profiles_all_params(self):
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- def test_list_load_balancer_profiles_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_profiles_all_params.
+ def test_list_vpc_address_prefixes_all_params_with_retries(self):
+ # Enable retries and run test_list_vpc_address_prefixes_all_params.
_service.enable_retries()
- self.test_list_load_balancer_profiles_all_params()
+ self.test_list_vpc_address_prefixes_all_params()
- # Disable retries and run test_list_load_balancer_profiles_all_params.
+ # Disable retries and run test_list_vpc_address_prefixes_all_params.
_service.disable_retries()
- self.test_list_load_balancer_profiles_all_params()
+ self.test_list_vpc_address_prefixes_all_params()
@responses.activate
- def test_list_load_balancer_profiles_required_params(self):
+ def test_list_vpc_address_prefixes_required_params(self):
"""
- test_list_load_balancer_profiles_required_params()
+ test_list_vpc_address_prefixes_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancer/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}'
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response = '{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -47207,30 +47461,36 @@ def test_list_load_balancer_profiles_required_params(self):
status=200,
)
+ # Set up parameter values
+ vpc_id = 'testString'
+
# Invoke method
- response = _service.list_load_balancer_profiles()
+ response = _service.list_vpc_address_prefixes(
+ vpc_id,
+ headers={},
+ )
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_load_balancer_profiles_required_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_profiles_required_params.
+ def test_list_vpc_address_prefixes_required_params_with_retries(self):
+ # Enable retries and run test_list_vpc_address_prefixes_required_params.
_service.enable_retries()
- self.test_list_load_balancer_profiles_required_params()
+ self.test_list_vpc_address_prefixes_required_params()
- # Disable retries and run test_list_load_balancer_profiles_required_params.
+ # Disable retries and run test_list_vpc_address_prefixes_required_params.
_service.disable_retries()
- self.test_list_load_balancer_profiles_required_params()
+ self.test_list_vpc_address_prefixes_required_params()
@responses.activate
- def test_list_load_balancer_profiles_value_error(self):
+ def test_list_vpc_address_prefixes_value_error(self):
"""
- test_list_load_balancer_profiles_value_error()
+ test_list_vpc_address_prefixes_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancer/profiles')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}'
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response = '{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -47239,32 +47499,36 @@ def test_list_load_balancer_profiles_value_error(self):
status=200,
)
+ # Set up parameter values
+ vpc_id = 'testString'
+
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpc_id": vpc_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_load_balancer_profiles(**req_copy)
+ _service.list_vpc_address_prefixes(**req_copy)
- def test_list_load_balancer_profiles_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancer_profiles_value_error.
+ def test_list_vpc_address_prefixes_value_error_with_retries(self):
+ # Enable retries and run test_list_vpc_address_prefixes_value_error.
_service.enable_retries()
- self.test_list_load_balancer_profiles_value_error()
+ self.test_list_vpc_address_prefixes_value_error()
- # Disable retries and run test_list_load_balancer_profiles_value_error.
+ # Disable retries and run test_list_vpc_address_prefixes_value_error.
_service.disable_retries()
- self.test_list_load_balancer_profiles_value_error()
+ self.test_list_vpc_address_prefixes_value_error()
@responses.activate
- def test_list_load_balancer_profiles_with_pager_get_next(self):
+ def test_list_vpc_address_prefixes_with_pager_get_next(self):
"""
- test_list_load_balancer_profiles_with_pager_get_next()
+ test_list_vpc_address_prefixes_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/load_balancer/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"udp_supported":{"type":"fixed","value":true}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"udp_supported":{"type":"fixed","value":true}}]}'
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -47282,8 +47546,9 @@ def test_list_load_balancer_profiles_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = LoadBalancerProfilesPager(
+ pager = VpcAddressPrefixesPager(
client=_service,
+ vpc_id='testString',
limit=10,
)
while pager.has_next():
@@ -47293,14 +47558,14 @@ def test_list_load_balancer_profiles_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_load_balancer_profiles_with_pager_get_all(self):
+ def test_list_vpc_address_prefixes_with_pager_get_all(self):
"""
- test_list_load_balancer_profiles_with_pager_get_all()
+ test_list_vpc_address_prefixes_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/load_balancer/profiles')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"udp_supported":{"type":"fixed","value":true}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"profiles":[{"access_modes":{"type":"enum","values":["private"]},"availability":{"type":"fixed","value":"region"},"failsafe_policy_actions":{"default":"fail","type":"enum","values":["forward"]},"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","instance_groups_supported":{"type":"fixed","value":true},"logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"source_ip_session_persistence_supported":{"type":"fixed","value":true},"targetable_load_balancer_profiles":[{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"}],"udp_supported":{"type":"fixed","value":true}}]}'
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"address_prefixes":[{"cidr":"192.168.3.0/24","created_at":"2019-01-01T12:00:00.000Z","has_subnets":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789","id":"r006-68574057-c5e0-4675-ada4-99377d8f4789","is_default":false,"name":"my-vpc-address-prefix-zone-1","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -47317,8 +47582,9 @@ def test_list_load_balancer_profiles_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = LoadBalancerProfilesPager(
+ pager = VpcAddressPrefixesPager(
client=_service,
+ vpc_id='testString',
limit=10,
)
all_results = pager.get_all()
@@ -47326,100 +47592,207 @@ def test_list_load_balancer_profiles_with_pager_get_all(self):
assert len(all_results) == 2
-class TestGetLoadBalancerProfile:
+class TestCreateVpcAddressPrefix:
"""
- Test Class for get_load_balancer_profile
+ Test Class for create_vpc_address_prefix
"""
@responses.activate
- def test_get_load_balancer_profile_all_params(self):
+ def test_create_vpc_address_prefix_all_params(self):
"""
- get_load_balancer_profile()
+ create_vpc_address_prefix()
"""
# Set up mock
- url = preprocess_url('/load_balancer/profiles/network-fixed')
- mock_response = '{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "udp_supported": {"type": "fixed", "value": true}}'
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "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,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
+ )
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Set up parameter values
+ vpc_id = 'testString'
+ cidr = '10.240.0.0/18'
+ zone = zone_identity_model
+ is_default = True
+ name = 'my-vpc-address-prefix-zone-1'
+
+ # Invoke method
+ response = _service.create_vpc_address_prefix(
+ vpc_id,
+ cidr,
+ zone,
+ is_default=is_default,
+ name=name,
+ 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['cidr'] == '10.240.0.0/18'
+ assert req_body['zone'] == zone_identity_model
+ assert req_body['is_default'] == True
+ assert req_body['name'] == 'my-vpc-address-prefix-zone-1'
+
+ def test_create_vpc_address_prefix_all_params_with_retries(self):
+ # Enable retries and run test_create_vpc_address_prefix_all_params.
+ _service.enable_retries()
+ self.test_create_vpc_address_prefix_all_params()
+
+ # Disable retries and run test_create_vpc_address_prefix_all_params.
+ _service.disable_retries()
+ self.test_create_vpc_address_prefix_all_params()
+
+ @responses.activate
+ def test_create_vpc_address_prefix_value_error(self):
+ """
+ test_create_vpc_address_prefix_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/vpcs/testString/address_prefixes')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "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 ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
# Set up parameter values
- name = 'network-fixed'
+ vpc_id = 'testString'
+ cidr = '10.240.0.0/18'
+ zone = zone_identity_model
+ is_default = True
+ name = 'my-vpc-address-prefix-zone-1'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "vpc_id": vpc_id,
+ "cidr": cidr,
+ "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_vpc_address_prefix(**req_copy)
+
+ def test_create_vpc_address_prefix_value_error_with_retries(self):
+ # Enable retries and run test_create_vpc_address_prefix_value_error.
+ _service.enable_retries()
+ self.test_create_vpc_address_prefix_value_error()
+
+ # Disable retries and run test_create_vpc_address_prefix_value_error.
+ _service.disable_retries()
+ self.test_create_vpc_address_prefix_value_error()
+
+
+class TestDeleteVpcAddressPrefix:
+ """
+ Test Class for delete_vpc_address_prefix
+ """
+
+ @responses.activate
+ def test_delete_vpc_address_prefix_all_params(self):
+ """
+ delete_vpc_address_prefix()
+ """
+ # Set up mock
+ url = preprocess_url('/vpcs/testString/address_prefixes/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ vpc_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.get_load_balancer_profile(
- name,
+ response = _service.delete_vpc_address_prefix(
+ vpc_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_load_balancer_profile_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_profile_all_params.
+ def test_delete_vpc_address_prefix_all_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_address_prefix_all_params.
_service.enable_retries()
- self.test_get_load_balancer_profile_all_params()
+ self.test_delete_vpc_address_prefix_all_params()
- # Disable retries and run test_get_load_balancer_profile_all_params.
+ # Disable retries and run test_delete_vpc_address_prefix_all_params.
_service.disable_retries()
- self.test_get_load_balancer_profile_all_params()
+ self.test_delete_vpc_address_prefix_all_params()
@responses.activate
- def test_get_load_balancer_profile_value_error(self):
+ def test_delete_vpc_address_prefix_value_error(self):
"""
- test_get_load_balancer_profile_value_error()
+ test_delete_vpc_address_prefix_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancer/profiles/network-fixed')
- mock_response = '{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "failsafe_policy_actions": {"default": "fail", "type": "enum", "values": ["forward"]}, "family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "targetable_load_balancer_profiles": [{"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}], "udp_supported": {"type": "fixed", "value": true}}'
+ url = preprocess_url('/vpcs/testString/address_prefixes/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- name = 'network-fixed'
+ vpc_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "name": name,
+ "vpc_id": vpc_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_load_balancer_profile(**req_copy)
+ _service.delete_vpc_address_prefix(**req_copy)
- def test_get_load_balancer_profile_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_profile_value_error.
+ def test_delete_vpc_address_prefix_value_error_with_retries(self):
+ # Enable retries and run test_delete_vpc_address_prefix_value_error.
_service.enable_retries()
- self.test_get_load_balancer_profile_value_error()
+ self.test_delete_vpc_address_prefix_value_error()
- # Disable retries and run test_get_load_balancer_profile_value_error.
+ # Disable retries and run test_delete_vpc_address_prefix_value_error.
_service.disable_retries()
- self.test_get_load_balancer_profile_value_error()
+ self.test_delete_vpc_address_prefix_value_error()
-class TestListLoadBalancers:
+class TestGetVpcAddressPrefix:
"""
- Test Class for list_load_balancers
+ Test Class for get_vpc_address_prefix
"""
@responses.activate
- def test_list_load_balancers_all_params(self):
+ def test_get_vpc_address_prefix_all_params(self):
"""
- list_load_balancers()
+ get_vpc_address_prefix()
"""
# Set up mock
- url = preprocess_url('/load_balancers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpcs/testString/address_prefixes/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "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,
@@ -47429,42 +47802,37 @@ def test_list_load_balancers_all_params(self):
)
# Set up parameter values
- start = 'testString'
- limit = 50
+ vpc_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_load_balancers(
- start=start,
- limit=limit,
+ response = _service.get_vpc_address_prefix(
+ vpc_id,
+ 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
- def test_list_load_balancers_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancers_all_params.
+ def test_get_vpc_address_prefix_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_address_prefix_all_params.
_service.enable_retries()
- self.test_list_load_balancers_all_params()
+ self.test_get_vpc_address_prefix_all_params()
- # Disable retries and run test_list_load_balancers_all_params.
+ # Disable retries and run test_get_vpc_address_prefix_all_params.
_service.disable_retries()
- self.test_list_load_balancers_all_params()
+ self.test_get_vpc_address_prefix_all_params()
@responses.activate
- def test_list_load_balancers_required_params(self):
+ def test_get_vpc_address_prefix_value_error(self):
"""
- test_list_load_balancers_required_params()
+ test_get_vpc_address_prefix_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpcs/testString/address_prefixes/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "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,
@@ -47473,972 +47841,739 @@ def test_list_load_balancers_required_params(self):
status=200,
)
- # Invoke method
- response = _service.list_load_balancers()
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_load_balancers_required_params_with_retries(self):
- # Enable retries and run test_list_load_balancers_required_params.
- _service.enable_retries()
- self.test_list_load_balancers_required_params()
-
- # Disable retries and run test_list_load_balancers_required_params.
- _service.disable_retries()
- self.test_list_load_balancers_required_params()
-
- @responses.activate
- def test_list_load_balancers_value_error(self):
- """
- test_list_load_balancers_value_error()
- """
- # Set up mock
- url = preprocess_url('/load_balancers')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "href"}, "total_count": 132}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
+ # Set up parameter values
+ vpc_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpc_id": vpc_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_load_balancers(**req_copy)
+ _service.get_vpc_address_prefix(**req_copy)
- def test_list_load_balancers_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancers_value_error.
+ def test_get_vpc_address_prefix_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_address_prefix_value_error.
_service.enable_retries()
- self.test_list_load_balancers_value_error()
+ self.test_get_vpc_address_prefix_value_error()
- # Disable retries and run test_list_load_balancers_value_error.
+ # Disable retries and run test_get_vpc_address_prefix_value_error.
_service.disable_retries()
- self.test_list_load_balancers_value_error()
-
- @responses.activate
- def test_list_load_balancers_with_pager_get_next(self):
- """
- test_list_load_balancers_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/load_balancers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
- mock_response2 = '{"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = LoadBalancersPager(
- client=_service,
- limit=10,
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_load_balancers_with_pager_get_all(self):
- """
- test_list_load_balancers_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/load_balancers')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
- mock_response2 = '{"total_count":2,"limit":1,"load_balancers":[{"access_mode":"private","attached_load_balancer_pool_members":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a","id":"r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}],"availability":"region","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","dns":{"instance":{"crn":"crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"},"zone":{"id":"d66662cc-aa23-4fe1-9987-858487a61f45"}},"failsafe_policy_actions":["forward"],"hostname":"6b88d615-us-south.lb.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","instance_groups_supported":true,"is_private_path":true,"is_public":true,"listeners":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091","id":"r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}],"logging":{"datapath":{"active":true}},"name":"my-load-balancer","operating_status":"offline","pools":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004","id":"r006-70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"profile":{"family":"application","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","name":"network-fixed"},"provisioning_status":"active","public_ips":[{"address":"192.168.3.4"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"load_balancer","route_mode":true,"security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"source_ip_session_persistence_supported":true,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = LoadBalancersPager(
- client=_service,
- limit=10,
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_get_vpc_address_prefix_value_error()
-class TestCreateLoadBalancer:
+class TestUpdateVpcAddressPrefix:
"""
- Test Class for create_load_balancer
+ Test Class for update_vpc_address_prefix
"""
@responses.activate
- def test_create_load_balancer_all_params(self):
+ def test_update_vpc_address_prefix_all_params(self):
"""
- create_load_balancer()
+ update_vpc_address_prefix()
"""
# Set up mock
- url = preprocess_url('/load_balancers')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/address_prefixes/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a DNSInstanceIdentityByCRN model
- dns_instance_identity_model = {}
- dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
-
- # Construct a dict representation of a DNSZoneIdentityById model
- dns_zone_identity_model = {}
- dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
-
- # Construct a dict representation of a LoadBalancerDNSPrototype model
- load_balancer_dns_prototype_model = {}
- load_balancer_dns_prototype_model['instance'] = dns_instance_identity_model
- load_balancer_dns_prototype_model['zone'] = dns_zone_identity_model
-
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityByName model
- load_balancer_pool_identity_by_name_model = {}
- load_balancer_pool_identity_by_name_model['name'] = 'my-load-balancer-pool'
-
- # Construct a dict representation of a LoadBalancerListenerIdentityById model
- load_balancer_listener_identity_model = {}
- load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
-
- # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
- load_balancer_listener_https_redirect_prototype_model = {}
- load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
- load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
- load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
-
- # Construct a dict representation of a LoadBalancerListenerPrototypeLoadBalancerContext model
- load_balancer_listener_prototype_load_balancer_context_model = {}
- load_balancer_listener_prototype_load_balancer_context_model['accept_proxy_protocol'] = True
- load_balancer_listener_prototype_load_balancer_context_model['certificate_instance'] = certificate_instance_identity_model
- load_balancer_listener_prototype_load_balancer_context_model['connection_limit'] = 2000
- load_balancer_listener_prototype_load_balancer_context_model['default_pool'] = load_balancer_pool_identity_by_name_model
- load_balancer_listener_prototype_load_balancer_context_model['https_redirect'] = load_balancer_listener_https_redirect_prototype_model
- load_balancer_listener_prototype_load_balancer_context_model['idle_connection_timeout'] = 100
- load_balancer_listener_prototype_load_balancer_context_model['port'] = 443
- load_balancer_listener_prototype_load_balancer_context_model['port_max'] = 499
- load_balancer_listener_prototype_load_balancer_context_model['port_min'] = 443
- load_balancer_listener_prototype_load_balancer_context_model['protocol'] = 'http'
-
- # Construct a dict representation of a LoadBalancerLoggingDatapathPrototype model
- load_balancer_logging_datapath_prototype_model = {}
- load_balancer_logging_datapath_prototype_model['active'] = True
-
- # Construct a dict representation of a LoadBalancerLoggingPrototype model
- load_balancer_logging_prototype_model = {}
- load_balancer_logging_prototype_model['datapath'] = load_balancer_logging_datapath_prototype_model
-
- # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
- load_balancer_pool_health_monitor_prototype_model = {}
- load_balancer_pool_health_monitor_prototype_model['delay'] = 5
- load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
- load_balancer_pool_health_monitor_prototype_model['port'] = 22
- load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
- load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
-
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
- load_balancer_pool_member_prototype_model = {}
- load_balancer_pool_member_prototype_model['port'] = 80
- load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_prototype_model['weight'] = 50
-
- # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
- load_balancer_pool_session_persistence_prototype_model = {}
- load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
- load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
-
- # Construct a dict representation of a LoadBalancerPoolPrototypeLoadBalancerContext model
- load_balancer_pool_prototype_load_balancer_context_model = {}
- load_balancer_pool_prototype_load_balancer_context_model['algorithm'] = 'least_connections'
- load_balancer_pool_prototype_load_balancer_context_model['health_monitor'] = load_balancer_pool_health_monitor_prototype_model
- load_balancer_pool_prototype_load_balancer_context_model['members'] = [load_balancer_pool_member_prototype_model]
- load_balancer_pool_prototype_load_balancer_context_model['name'] = 'my-load-balancer-pool'
- load_balancer_pool_prototype_load_balancer_context_model['protocol'] = 'http'
- load_balancer_pool_prototype_load_balancer_context_model['proxy_protocol'] = 'disabled'
- load_balancer_pool_prototype_load_balancer_context_model['session_persistence'] = load_balancer_pool_session_persistence_prototype_model
-
- # Construct a dict representation of a LoadBalancerProfileIdentityByName model
- load_balancer_profile_identity_model = {}
- load_balancer_profile_identity_model['name'] = 'network-fixed'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # Construct a dict representation of a AddressPrefixPatch model
+ address_prefix_patch_model = {}
+ address_prefix_patch_model['is_default'] = False
+ address_prefix_patch_model['name'] = 'my-vpc-address-prefix-updated'
# Set up parameter values
- is_public = True
- subnets = [subnet_identity_model]
- dns = load_balancer_dns_prototype_model
- is_private_path = True
- listeners = [load_balancer_listener_prototype_load_balancer_context_model]
- logging = load_balancer_logging_prototype_model
- name = 'my-load-balancer'
- pools = [load_balancer_pool_prototype_load_balancer_context_model]
- profile = load_balancer_profile_identity_model
- resource_group = resource_group_identity_model
- route_mode = True
- security_groups = [security_group_identity_model]
+ vpc_id = 'testString'
+ id = 'testString'
+ address_prefix_patch = address_prefix_patch_model
# Invoke method
- response = _service.create_load_balancer(
- is_public,
- subnets,
- dns=dns,
- is_private_path=is_private_path,
- listeners=listeners,
- logging=logging,
- name=name,
- pools=pools,
- profile=profile,
- resource_group=resource_group,
- route_mode=route_mode,
- security_groups=security_groups,
+ response = _service.update_vpc_address_prefix(
+ vpc_id,
+ id,
+ address_prefix_patch,
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['is_public'] == True
- assert req_body['subnets'] == [subnet_identity_model]
- assert req_body['dns'] == load_balancer_dns_prototype_model
- assert req_body['is_private_path'] == True
- assert req_body['listeners'] == [load_balancer_listener_prototype_load_balancer_context_model]
- assert req_body['logging'] == load_balancer_logging_prototype_model
- assert req_body['name'] == 'my-load-balancer'
- assert req_body['pools'] == [load_balancer_pool_prototype_load_balancer_context_model]
- assert req_body['profile'] == load_balancer_profile_identity_model
- assert req_body['resource_group'] == resource_group_identity_model
- assert req_body['route_mode'] == True
- assert req_body['security_groups'] == [security_group_identity_model]
+ assert req_body == address_prefix_patch
- def test_create_load_balancer_all_params_with_retries(self):
- # Enable retries and run test_create_load_balancer_all_params.
+ def test_update_vpc_address_prefix_all_params_with_retries(self):
+ # Enable retries and run test_update_vpc_address_prefix_all_params.
_service.enable_retries()
- self.test_create_load_balancer_all_params()
+ self.test_update_vpc_address_prefix_all_params()
- # Disable retries and run test_create_load_balancer_all_params.
+ # Disable retries and run test_update_vpc_address_prefix_all_params.
_service.disable_retries()
- self.test_create_load_balancer_all_params()
+ self.test_update_vpc_address_prefix_all_params()
@responses.activate
- def test_create_load_balancer_value_error(self):
+ def test_update_vpc_address_prefix_value_error(self):
"""
- test_create_load_balancer_value_error()
+ test_update_vpc_address_prefix_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/address_prefixes/testString')
+ mock_response = '{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/address_prefixes/r006-68574057-c5e0-4675-ada4-99377d8f4789", "id": "r006-68574057-c5e0-4675-ada4-99377d8f4789", "is_default": false, "name": "my-vpc-address-prefix-zone-1", "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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a DNSInstanceIdentityByCRN model
- dns_instance_identity_model = {}
- dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
-
- # Construct a dict representation of a DNSZoneIdentityById model
- dns_zone_identity_model = {}
- dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
-
- # Construct a dict representation of a LoadBalancerDNSPrototype model
- load_balancer_dns_prototype_model = {}
- load_balancer_dns_prototype_model['instance'] = dns_instance_identity_model
- load_balancer_dns_prototype_model['zone'] = dns_zone_identity_model
-
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityByName model
- load_balancer_pool_identity_by_name_model = {}
- load_balancer_pool_identity_by_name_model['name'] = 'my-load-balancer-pool'
-
- # Construct a dict representation of a LoadBalancerListenerIdentityById model
- load_balancer_listener_identity_model = {}
- load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
-
- # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
- load_balancer_listener_https_redirect_prototype_model = {}
- load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
- load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
- load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
-
- # Construct a dict representation of a LoadBalancerListenerPrototypeLoadBalancerContext model
- load_balancer_listener_prototype_load_balancer_context_model = {}
- load_balancer_listener_prototype_load_balancer_context_model['accept_proxy_protocol'] = True
- load_balancer_listener_prototype_load_balancer_context_model['certificate_instance'] = certificate_instance_identity_model
- load_balancer_listener_prototype_load_balancer_context_model['connection_limit'] = 2000
- load_balancer_listener_prototype_load_balancer_context_model['default_pool'] = load_balancer_pool_identity_by_name_model
- load_balancer_listener_prototype_load_balancer_context_model['https_redirect'] = load_balancer_listener_https_redirect_prototype_model
- load_balancer_listener_prototype_load_balancer_context_model['idle_connection_timeout'] = 100
- load_balancer_listener_prototype_load_balancer_context_model['port'] = 443
- load_balancer_listener_prototype_load_balancer_context_model['port_max'] = 499
- load_balancer_listener_prototype_load_balancer_context_model['port_min'] = 443
- load_balancer_listener_prototype_load_balancer_context_model['protocol'] = 'http'
-
- # Construct a dict representation of a LoadBalancerLoggingDatapathPrototype model
- load_balancer_logging_datapath_prototype_model = {}
- load_balancer_logging_datapath_prototype_model['active'] = True
-
- # Construct a dict representation of a LoadBalancerLoggingPrototype model
- load_balancer_logging_prototype_model = {}
- load_balancer_logging_prototype_model['datapath'] = load_balancer_logging_datapath_prototype_model
-
- # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
- load_balancer_pool_health_monitor_prototype_model = {}
- load_balancer_pool_health_monitor_prototype_model['delay'] = 5
- load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
- load_balancer_pool_health_monitor_prototype_model['port'] = 22
- load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
- load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
-
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
- load_balancer_pool_member_prototype_model = {}
- load_balancer_pool_member_prototype_model['port'] = 80
- load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_prototype_model['weight'] = 50
-
- # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
- load_balancer_pool_session_persistence_prototype_model = {}
- load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
- load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
-
- # Construct a dict representation of a LoadBalancerPoolPrototypeLoadBalancerContext model
- load_balancer_pool_prototype_load_balancer_context_model = {}
- load_balancer_pool_prototype_load_balancer_context_model['algorithm'] = 'least_connections'
- load_balancer_pool_prototype_load_balancer_context_model['health_monitor'] = load_balancer_pool_health_monitor_prototype_model
- load_balancer_pool_prototype_load_balancer_context_model['members'] = [load_balancer_pool_member_prototype_model]
- load_balancer_pool_prototype_load_balancer_context_model['name'] = 'my-load-balancer-pool'
- load_balancer_pool_prototype_load_balancer_context_model['protocol'] = 'http'
- load_balancer_pool_prototype_load_balancer_context_model['proxy_protocol'] = 'disabled'
- load_balancer_pool_prototype_load_balancer_context_model['session_persistence'] = load_balancer_pool_session_persistence_prototype_model
-
- # Construct a dict representation of a LoadBalancerProfileIdentityByName model
- load_balancer_profile_identity_model = {}
- load_balancer_profile_identity_model['name'] = 'network-fixed'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # Construct a dict representation of a AddressPrefixPatch model
+ address_prefix_patch_model = {}
+ address_prefix_patch_model['is_default'] = False
+ address_prefix_patch_model['name'] = 'my-vpc-address-prefix-updated'
# Set up parameter values
- is_public = True
- subnets = [subnet_identity_model]
- dns = load_balancer_dns_prototype_model
- is_private_path = True
- listeners = [load_balancer_listener_prototype_load_balancer_context_model]
- logging = load_balancer_logging_prototype_model
- name = 'my-load-balancer'
- pools = [load_balancer_pool_prototype_load_balancer_context_model]
- profile = load_balancer_profile_identity_model
- resource_group = resource_group_identity_model
- route_mode = True
- security_groups = [security_group_identity_model]
+ vpc_id = 'testString'
+ id = 'testString'
+ address_prefix_patch = address_prefix_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "is_public": is_public,
- "subnets": subnets,
+ "vpc_id": vpc_id,
+ "id": id,
+ "address_prefix_patch": address_prefix_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.create_load_balancer(**req_copy)
+ _service.update_vpc_address_prefix(**req_copy)
- def test_create_load_balancer_value_error_with_retries(self):
- # Enable retries and run test_create_load_balancer_value_error.
+ def test_update_vpc_address_prefix_value_error_with_retries(self):
+ # Enable retries and run test_update_vpc_address_prefix_value_error.
_service.enable_retries()
- self.test_create_load_balancer_value_error()
+ self.test_update_vpc_address_prefix_value_error()
- # Disable retries and run test_create_load_balancer_value_error.
+ # Disable retries and run test_update_vpc_address_prefix_value_error.
_service.disable_retries()
- self.test_create_load_balancer_value_error()
+ self.test_update_vpc_address_prefix_value_error()
-class TestDeleteLoadBalancer:
+class TestListVpcDnsResolutionBindings:
"""
- Test Class for delete_load_balancer
+ Test Class for list_vpc_dns_resolution_bindings
"""
@responses.activate
- def test_delete_load_balancer_all_params(self):
+ def test_list_vpc_dns_resolution_bindings_all_params(self):
"""
- delete_load_balancer()
+ list_vpc_dns_resolution_bindings()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response = '{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+ vpc_id = 'testString'
+ sort = 'name'
+ start = 'testString'
+ limit = 50
+ name = 'my-name'
+ vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_name = 'my-vpc'
+ account_id = 'bb1b52262f7441a586f49068482f1e60'
# Invoke method
- response = _service.delete_load_balancer(
- id,
- if_match=if_match,
+ response = _service.list_vpc_dns_resolution_bindings(
+ vpc_id,
+ sort=sort,
+ start=start,
+ limit=limit,
+ name=name,
+ vpc_crn=vpc_crn,
+ vpc_name=vpc_name,
+ account_id=account_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ 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 'sort={}'.format(sort) in query_string
+ assert 'start={}'.format(start) in query_string
+ assert 'limit={}'.format(limit) in query_string
+ assert 'name={}'.format(name) in query_string
+ assert 'vpc.crn={}'.format(vpc_crn) in query_string
+ assert 'vpc.name={}'.format(vpc_name) in query_string
+ assert 'account.id={}'.format(account_id) in query_string
- def test_delete_load_balancer_all_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_all_params.
+ def test_list_vpc_dns_resolution_bindings_all_params_with_retries(self):
+ # Enable retries and run test_list_vpc_dns_resolution_bindings_all_params.
_service.enable_retries()
- self.test_delete_load_balancer_all_params()
+ self.test_list_vpc_dns_resolution_bindings_all_params()
- # Disable retries and run test_delete_load_balancer_all_params.
+ # Disable retries and run test_list_vpc_dns_resolution_bindings_all_params.
_service.disable_retries()
- self.test_delete_load_balancer_all_params()
+ self.test_list_vpc_dns_resolution_bindings_all_params()
@responses.activate
- def test_delete_load_balancer_required_params(self):
+ def test_list_vpc_dns_resolution_bindings_required_params(self):
"""
- test_delete_load_balancer_required_params()
+ test_list_vpc_dns_resolution_bindings_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response = '{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ vpc_id = 'testString'
# Invoke method
- response = _service.delete_load_balancer(
- id,
+ response = _service.list_vpc_dns_resolution_bindings(
+ vpc_id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_load_balancer_required_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_required_params.
+ def test_list_vpc_dns_resolution_bindings_required_params_with_retries(self):
+ # Enable retries and run test_list_vpc_dns_resolution_bindings_required_params.
_service.enable_retries()
- self.test_delete_load_balancer_required_params()
+ self.test_list_vpc_dns_resolution_bindings_required_params()
- # Disable retries and run test_delete_load_balancer_required_params.
+ # Disable retries and run test_list_vpc_dns_resolution_bindings_required_params.
_service.disable_retries()
- self.test_delete_load_balancer_required_params()
+ self.test_list_vpc_dns_resolution_bindings_required_params()
@responses.activate
- def test_delete_load_balancer_value_error(self):
+ def test_list_vpc_dns_resolution_bindings_value_error(self):
"""
- test_delete_load_balancer_value_error()
+ test_list_vpc_dns_resolution_bindings_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response = '{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- id = 'testString'
+ vpc_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "vpc_id": vpc_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_load_balancer(**req_copy)
+ _service.list_vpc_dns_resolution_bindings(**req_copy)
- def test_delete_load_balancer_value_error_with_retries(self):
- # Enable retries and run test_delete_load_balancer_value_error.
+ def test_list_vpc_dns_resolution_bindings_value_error_with_retries(self):
+ # Enable retries and run test_list_vpc_dns_resolution_bindings_value_error.
_service.enable_retries()
- self.test_delete_load_balancer_value_error()
+ self.test_list_vpc_dns_resolution_bindings_value_error()
- # Disable retries and run test_delete_load_balancer_value_error.
+ # Disable retries and run test_list_vpc_dns_resolution_bindings_value_error.
_service.disable_retries()
- self.test_delete_load_balancer_value_error()
+ self.test_list_vpc_dns_resolution_bindings_value_error()
+
+ @responses.activate
+ def test_list_vpc_dns_resolution_bindings_with_pager_get_next(self):
+ """
+ test_list_vpc_dns_resolution_bindings_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpcDnsResolutionBindingsPager(
+ client=_service,
+ vpc_id='testString',
+ sort='name',
+ limit=10,
+ name='my-name',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ account_id='bb1b52262f7441a586f49068482f1e60',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+ @responses.activate
+ def test_list_vpc_dns_resolution_bindings_with_pager_get_all(self):
+ """
+ test_list_vpc_dns_resolution_bindings_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"dns_resolution_bindings":[{"created_at":"2019-01-01T12:00:00.000Z","endpoint_gateways":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"endpoint_gateway"}],"health_reasons":[{"code":"disconnected_from_bound_vpc","message":"The VPC specified in the DNS resolution binding has been disconnected.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","id":"r006-8a524686-fcf6-4947-a59b-188c1ed78ad1","lifecycle_state":"stable","name":"my-dns-resolution-binding","resource_type":"vpc_dns_resolution_binding","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"vpc"}}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestGetLoadBalancer:
+ # Exercise the pager class for this operation
+ pager = VpcDnsResolutionBindingsPager(
+ client=_service,
+ vpc_id='testString',
+ sort='name',
+ limit=10,
+ name='my-name',
+ vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
+ vpc_name='my-vpc',
+ account_id='bb1b52262f7441a586f49068482f1e60',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateVpcDnsResolutionBinding:
"""
- Test Class for get_load_balancer
+ Test Class for create_vpc_dns_resolution_binding
"""
@responses.activate
- def test_get_load_balancer_all_params(self):
+ def test_create_vpc_dns_resolution_binding_all_params(self):
"""
- get_load_balancer()
+ create_vpc_dns_resolution_binding()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
# Set up parameter values
- id = 'testString'
+ vpc_id = 'testString'
+ vpc = vpc_identity_model
+ name = 'my-dns-resolution-binding'
# Invoke method
- response = _service.get_load_balancer(
- id,
+ response = _service.create_vpc_dns_resolution_binding(
+ vpc_id,
+ vpc,
+ 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['vpc'] == vpc_identity_model
+ assert req_body['name'] == 'my-dns-resolution-binding'
- def test_get_load_balancer_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_all_params.
+ def test_create_vpc_dns_resolution_binding_all_params_with_retries(self):
+ # Enable retries and run test_create_vpc_dns_resolution_binding_all_params.
_service.enable_retries()
- self.test_get_load_balancer_all_params()
+ self.test_create_vpc_dns_resolution_binding_all_params()
- # Disable retries and run test_get_load_balancer_all_params.
+ # Disable retries and run test_create_vpc_dns_resolution_binding_all_params.
_service.disable_retries()
- self.test_get_load_balancer_all_params()
+ self.test_create_vpc_dns_resolution_binding_all_params()
@responses.activate
- def test_get_load_balancer_value_error(self):
+ def test_create_vpc_dns_resolution_binding_value_error(self):
"""
- test_get_load_balancer_value_error()
+ test_create_vpc_dns_resolution_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a VPCIdentityById model
+ vpc_identity_model = {}
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
# Set up parameter values
- id = 'testString'
+ vpc_id = 'testString'
+ vpc = vpc_identity_model
+ name = 'my-dns-resolution-binding'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
+ "vpc_id": vpc_id,
+ "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.get_load_balancer(**req_copy)
+ _service.create_vpc_dns_resolution_binding(**req_copy)
- def test_get_load_balancer_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_value_error.
+ def test_create_vpc_dns_resolution_binding_value_error_with_retries(self):
+ # Enable retries and run test_create_vpc_dns_resolution_binding_value_error.
_service.enable_retries()
- self.test_get_load_balancer_value_error()
+ self.test_create_vpc_dns_resolution_binding_value_error()
- # Disable retries and run test_get_load_balancer_value_error.
+ # Disable retries and run test_create_vpc_dns_resolution_binding_value_error.
_service.disable_retries()
- self.test_get_load_balancer_value_error()
+ self.test_create_vpc_dns_resolution_binding_value_error()
-class TestUpdateLoadBalancer:
+class TestDeleteVpcDnsResolutionBinding:
"""
- Test Class for update_load_balancer
+ Test Class for delete_vpc_dns_resolution_binding
"""
@responses.activate
- def test_update_load_balancer_all_params(self):
+ def test_delete_vpc_dns_resolution_binding_all_params(self):
"""
- update_load_balancer()
+ delete_vpc_dns_resolution_binding()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
- # Construct a dict representation of a DNSInstanceIdentityByCRN model
- dns_instance_identity_model = {}
- dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
-
- # Construct a dict representation of a DNSZoneIdentityById model
- dns_zone_identity_model = {}
- dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
-
- # Construct a dict representation of a LoadBalancerDNSPatch model
- load_balancer_dns_patch_model = {}
- load_balancer_dns_patch_model['instance'] = dns_instance_identity_model
- load_balancer_dns_patch_model['zone'] = dns_zone_identity_model
-
- # Construct a dict representation of a LoadBalancerLoggingDatapathPatch model
- load_balancer_logging_datapath_patch_model = {}
- load_balancer_logging_datapath_patch_model['active'] = True
-
- # Construct a dict representation of a LoadBalancerLoggingPatch model
- load_balancer_logging_patch_model = {}
- load_balancer_logging_patch_model['datapath'] = load_balancer_logging_datapath_patch_model
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a LoadBalancerPatch model
- load_balancer_patch_model = {}
- load_balancer_patch_model['dns'] = load_balancer_dns_patch_model
- load_balancer_patch_model['logging'] = load_balancer_logging_patch_model
- load_balancer_patch_model['name'] = 'my-load-balancer'
- load_balancer_patch_model['subnets'] = [subnet_identity_model]
-
# Set up parameter values
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_patch = load_balancer_patch_model
- if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_load_balancer(
+ response = _service.delete_vpc_dns_resolution_binding(
+ vpc_id,
id,
- load_balancer_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 == load_balancer_patch
+ assert response.status_code == 202
- def test_update_load_balancer_all_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_all_params.
+ def test_delete_vpc_dns_resolution_binding_all_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_dns_resolution_binding_all_params.
_service.enable_retries()
- self.test_update_load_balancer_all_params()
+ self.test_delete_vpc_dns_resolution_binding_all_params()
- # Disable retries and run test_update_load_balancer_all_params.
+ # Disable retries and run test_delete_vpc_dns_resolution_binding_all_params.
_service.disable_retries()
- self.test_update_load_balancer_all_params()
+ self.test_delete_vpc_dns_resolution_binding_all_params()
@responses.activate
- def test_update_load_balancer_required_params(self):
+ def test_delete_vpc_dns_resolution_binding_value_error(self):
"""
- test_update_load_balancer_required_params()
+ test_delete_vpc_dns_resolution_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=202,
)
- # Construct a dict representation of a DNSInstanceIdentityByCRN model
- dns_instance_identity_model = {}
- dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
+ # Set up parameter values
+ vpc_id = 'testString'
+ id = 'testString'
- # Construct a dict representation of a DNSZoneIdentityById model
- dns_zone_identity_model = {}
- dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "vpc_id": vpc_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_vpc_dns_resolution_binding(**req_copy)
- # Construct a dict representation of a LoadBalancerDNSPatch model
- load_balancer_dns_patch_model = {}
- load_balancer_dns_patch_model['instance'] = dns_instance_identity_model
- load_balancer_dns_patch_model['zone'] = dns_zone_identity_model
+ def test_delete_vpc_dns_resolution_binding_value_error_with_retries(self):
+ # Enable retries and run test_delete_vpc_dns_resolution_binding_value_error.
+ _service.enable_retries()
+ self.test_delete_vpc_dns_resolution_binding_value_error()
- # Construct a dict representation of a LoadBalancerLoggingDatapathPatch model
- load_balancer_logging_datapath_patch_model = {}
- load_balancer_logging_datapath_patch_model['active'] = True
+ # Disable retries and run test_delete_vpc_dns_resolution_binding_value_error.
+ _service.disable_retries()
+ self.test_delete_vpc_dns_resolution_binding_value_error()
- # Construct a dict representation of a LoadBalancerLoggingPatch model
- load_balancer_logging_patch_model = {}
- load_balancer_logging_patch_model['datapath'] = load_balancer_logging_datapath_patch_model
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+class TestGetVpcDnsResolutionBinding:
+ """
+ Test Class for get_vpc_dns_resolution_binding
+ """
- # Construct a dict representation of a LoadBalancerPatch model
- load_balancer_patch_model = {}
- load_balancer_patch_model['dns'] = load_balancer_dns_patch_model
- load_balancer_patch_model['logging'] = load_balancer_logging_patch_model
- load_balancer_patch_model['name'] = 'my-load-balancer'
- load_balancer_patch_model['subnets'] = [subnet_identity_model]
+ @responses.activate
+ def test_get_vpc_dns_resolution_binding_all_params(self):
+ """
+ get_vpc_dns_resolution_binding()
+ """
+ # Set up mock
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
# Set up parameter values
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_patch = load_balancer_patch_model
# Invoke method
- response = _service.update_load_balancer(
+ response = _service.get_vpc_dns_resolution_binding(
+ vpc_id,
id,
- load_balancer_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 == load_balancer_patch
- def test_update_load_balancer_required_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_required_params.
+ def test_get_vpc_dns_resolution_binding_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_dns_resolution_binding_all_params.
_service.enable_retries()
- self.test_update_load_balancer_required_params()
+ self.test_get_vpc_dns_resolution_binding_all_params()
- # Disable retries and run test_update_load_balancer_required_params.
+ # Disable retries and run test_get_vpc_dns_resolution_binding_all_params.
_service.disable_retries()
- self.test_update_load_balancer_required_params()
+ self.test_get_vpc_dns_resolution_binding_all_params()
@responses.activate
- def test_update_load_balancer_value_error(self):
+ def test_get_vpc_dns_resolution_binding_value_error(self):
"""
- test_update_load_balancer_value_error()
+ test_get_vpc_dns_resolution_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString')
- mock_response = '{"access_mode": "private", "attached_load_balancer_pool_members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "failsafe_policy_actions": ["forward"], "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "application", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a DNSInstanceIdentityByCRN model
- dns_instance_identity_model = {}
- dns_instance_identity_model['crn'] = 'crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::'
-
- # Construct a dict representation of a DNSZoneIdentityById model
- dns_zone_identity_model = {}
- dns_zone_identity_model['id'] = 'd66662cc-aa23-4fe1-9987-858487a61f45'
-
- # Construct a dict representation of a LoadBalancerDNSPatch model
- load_balancer_dns_patch_model = {}
- load_balancer_dns_patch_model['instance'] = dns_instance_identity_model
- load_balancer_dns_patch_model['zone'] = dns_zone_identity_model
-
- # Construct a dict representation of a LoadBalancerLoggingDatapathPatch model
- load_balancer_logging_datapath_patch_model = {}
- load_balancer_logging_datapath_patch_model['active'] = True
-
- # Construct a dict representation of a LoadBalancerLoggingPatch model
- load_balancer_logging_patch_model = {}
- load_balancer_logging_patch_model['datapath'] = load_balancer_logging_datapath_patch_model
-
- # Construct a dict representation of a SubnetIdentityById model
- subnet_identity_model = {}
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
-
- # Construct a dict representation of a LoadBalancerPatch model
- load_balancer_patch_model = {}
- load_balancer_patch_model['dns'] = load_balancer_dns_patch_model
- load_balancer_patch_model['logging'] = load_balancer_logging_patch_model
- load_balancer_patch_model['name'] = 'my-load-balancer'
- load_balancer_patch_model['subnets'] = [subnet_identity_model]
-
# Set up parameter values
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_patch = load_balancer_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpc_id": vpc_id,
"id": id,
- "load_balancer_patch": load_balancer_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_load_balancer(**req_copy)
+ _service.get_vpc_dns_resolution_binding(**req_copy)
- def test_update_load_balancer_value_error_with_retries(self):
- # Enable retries and run test_update_load_balancer_value_error.
+ def test_get_vpc_dns_resolution_binding_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_dns_resolution_binding_value_error.
_service.enable_retries()
- self.test_update_load_balancer_value_error()
+ self.test_get_vpc_dns_resolution_binding_value_error()
- # Disable retries and run test_update_load_balancer_value_error.
+ # Disable retries and run test_get_vpc_dns_resolution_binding_value_error.
_service.disable_retries()
- self.test_update_load_balancer_value_error()
+ self.test_get_vpc_dns_resolution_binding_value_error()
-class TestGetLoadBalancerStatistics:
+class TestUpdateVpcDnsResolutionBinding:
"""
- Test Class for get_load_balancer_statistics
+ Test Class for update_vpc_dns_resolution_binding
"""
@responses.activate
- def test_get_load_balancer_statistics_all_params(self):
+ def test_update_vpc_dns_resolution_binding_all_params(self):
"""
- get_load_balancer_statistics()
+ update_vpc_dns_resolution_binding()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/statistics')
- mock_response = '{"active_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a VPCDNSResolutionBindingPatch model
+ vpcdns_resolution_binding_patch_model = {}
+ vpcdns_resolution_binding_patch_model['name'] = 'my-dns-resolution-binding-updated'
+
# Set up parameter values
+ vpc_id = 'testString'
id = 'testString'
+ vpcdns_resolution_binding_patch = vpcdns_resolution_binding_patch_model
# Invoke method
- response = _service.get_load_balancer_statistics(
+ response = _service.update_vpc_dns_resolution_binding(
+ vpc_id,
id,
+ vpcdns_resolution_binding_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 == vpcdns_resolution_binding_patch
- def test_get_load_balancer_statistics_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_statistics_all_params.
+ def test_update_vpc_dns_resolution_binding_all_params_with_retries(self):
+ # Enable retries and run test_update_vpc_dns_resolution_binding_all_params.
_service.enable_retries()
- self.test_get_load_balancer_statistics_all_params()
+ self.test_update_vpc_dns_resolution_binding_all_params()
- # Disable retries and run test_get_load_balancer_statistics_all_params.
+ # Disable retries and run test_update_vpc_dns_resolution_binding_all_params.
_service.disable_retries()
- self.test_get_load_balancer_statistics_all_params()
+ self.test_update_vpc_dns_resolution_binding_all_params()
@responses.activate
- def test_get_load_balancer_statistics_value_error(self):
+ def test_update_vpc_dns_resolution_binding_value_error(self):
"""
- test_get_load_balancer_statistics_value_error()
+ test_update_vpc_dns_resolution_binding_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/statistics')
- mock_response = '{"active_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}'
+ url = preprocess_url('/vpcs/testString/dns_resolution_bindings/testString')
+ mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
status=200,
)
+ # Construct a dict representation of a VPCDNSResolutionBindingPatch model
+ vpcdns_resolution_binding_patch_model = {}
+ vpcdns_resolution_binding_patch_model['name'] = 'my-dns-resolution-binding-updated'
+
# Set up parameter values
+ vpc_id = 'testString'
id = 'testString'
+ vpcdns_resolution_binding_patch = vpcdns_resolution_binding_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpc_id": vpc_id,
"id": id,
+ "vpcdns_resolution_binding_patch": vpcdns_resolution_binding_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_load_balancer_statistics(**req_copy)
+ _service.update_vpc_dns_resolution_binding(**req_copy)
- def test_get_load_balancer_statistics_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_statistics_value_error.
+ def test_update_vpc_dns_resolution_binding_value_error_with_retries(self):
+ # Enable retries and run test_update_vpc_dns_resolution_binding_value_error.
_service.enable_retries()
- self.test_get_load_balancer_statistics_value_error()
+ self.test_update_vpc_dns_resolution_binding_value_error()
- # Disable retries and run test_get_load_balancer_statistics_value_error.
+ # Disable retries and run test_update_vpc_dns_resolution_binding_value_error.
_service.disable_retries()
- self.test_get_load_balancer_statistics_value_error()
+ self.test_update_vpc_dns_resolution_binding_value_error()
-class TestListLoadBalancerListeners:
+class TestListVpcRoutes:
"""
- Test Class for list_load_balancer_listeners
+ Test Class for list_vpc_routes
"""
@responses.activate
- def test_list_load_balancer_listeners_all_params(self):
+ def test_list_vpc_routes_all_params(self):
"""
- list_load_balancer_listeners()
+ list_vpc_routes()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners')
- mock_response = '{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}'
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48448,35 +48583,47 @@ def test_list_load_balancer_listeners_all_params(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ zone_name = 'us-south-1'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.list_load_balancer_listeners(
- load_balancer_id,
+ response = _service.list_vpc_routes(
+ vpc_id,
+ zone_name=zone_name,
+ 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 'zone.name={}'.format(zone_name) in query_string
+ assert 'start={}'.format(start) in query_string
+ assert 'limit={}'.format(limit) in query_string
- def test_list_load_balancer_listeners_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_listeners_all_params.
+ def test_list_vpc_routes_all_params_with_retries(self):
+ # Enable retries and run test_list_vpc_routes_all_params.
_service.enable_retries()
- self.test_list_load_balancer_listeners_all_params()
+ self.test_list_vpc_routes_all_params()
- # Disable retries and run test_list_load_balancer_listeners_all_params.
+ # Disable retries and run test_list_vpc_routes_all_params.
_service.disable_retries()
- self.test_list_load_balancer_listeners_all_params()
+ self.test_list_vpc_routes_all_params()
@responses.activate
- def test_list_load_balancer_listeners_value_error(self):
+ def test_list_vpc_routes_required_params(self):
"""
- test_list_load_balancer_listeners_value_error()
+ test_list_vpc_routes_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners')
- mock_response = '{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}'
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48486,40 +48633,151 @@ def test_list_load_balancer_listeners_value_error(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+
+ # Invoke method
+ response = _service.list_vpc_routes(
+ vpc_id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_vpc_routes_required_params_with_retries(self):
+ # Enable retries and run test_list_vpc_routes_required_params.
+ _service.enable_retries()
+ self.test_list_vpc_routes_required_params()
+
+ # Disable retries and run test_list_vpc_routes_required_params.
+ _service.disable_retries()
+ self.test_list_vpc_routes_required_params()
+
+ @responses.activate
+ def test_list_vpc_routes_value_error(self):
+ """
+ test_list_vpc_routes_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ vpc_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_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_load_balancer_listeners(**req_copy)
+ _service.list_vpc_routes(**req_copy)
- def test_list_load_balancer_listeners_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancer_listeners_value_error.
+ def test_list_vpc_routes_value_error_with_retries(self):
+ # Enable retries and run test_list_vpc_routes_value_error.
_service.enable_retries()
- self.test_list_load_balancer_listeners_value_error()
+ self.test_list_vpc_routes_value_error()
- # Disable retries and run test_list_load_balancer_listeners_value_error.
+ # Disable retries and run test_list_vpc_routes_value_error.
_service.disable_retries()
- self.test_list_load_balancer_listeners_value_error()
+ self.test_list_vpc_routes_value_error()
+ @responses.activate
+ def test_list_vpc_routes_with_pager_get_next(self):
+ """
+ test_list_vpc_routes_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestCreateLoadBalancerListener:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpcRoutesPager(
+ client=_service,
+ vpc_id='testString',
+ zone_name='us-south-1',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_vpc_routes_with_pager_get_all(self):
+ """
+ test_list_vpc_routes_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VpcRoutesPager(
+ client=_service,
+ vpc_id='testString',
+ zone_name='us-south-1',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateVpcRoute:
"""
- Test Class for create_load_balancer_listener
+ Test Class for create_vpc_route
"""
@responses.activate
- def test_create_load_balancer_listener_all_params(self):
+ def test_create_vpc_route_all_params(self):
"""
- create_load_balancer_listener()
+ create_vpc_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners')
- mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48528,71 +48786,34 @@ def test_create_load_balancer_listener_all_params(self):
status=201,
)
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerListenerIdentityById model
- load_balancer_listener_identity_model = {}
- load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
-
- # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
- load_balancer_listener_https_redirect_prototype_model = {}
- load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
- load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
- load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
- load_balancer_listener_policy_rule_prototype_model = {}
- load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
- load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
- load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
- load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_listener_policy_target_prototype_model = {}
- load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- # Construct a dict representation of a LoadBalancerListenerPolicyPrototype model
- load_balancer_listener_policy_prototype_model = {}
- load_balancer_listener_policy_prototype_model['action'] = 'forward_to_listener'
- load_balancer_listener_policy_prototype_model['name'] = 'my-load-balancer-listener-policy'
- load_balancer_listener_policy_prototype_model['priority'] = 5
- load_balancer_listener_policy_prototype_model['rules'] = [load_balancer_listener_policy_rule_prototype_model]
- load_balancer_listener_policy_prototype_model['target'] = load_balancer_listener_policy_target_prototype_model
+ # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_prototype_model = {}
+ route_next_hop_prototype_model['address'] = '0.0.0.0'
# Set up parameter values
- load_balancer_id = 'testString'
- protocol = 'http'
- accept_proxy_protocol = True
- certificate_instance = certificate_instance_identity_model
- connection_limit = 2000
- default_pool = load_balancer_pool_identity_model
- https_redirect = load_balancer_listener_https_redirect_prototype_model
- idle_connection_timeout = 100
- policies = [load_balancer_listener_policy_prototype_model]
- port = 443
- port_max = 499
- port_min = 443
+ vpc_id = 'testString'
+ destination = '192.168.3.0/24'
+ zone = zone_identity_model
+ action = 'deliver'
+ advertise = False
+ name = 'my-vpc-routing-table-route'
+ next_hop = route_next_hop_prototype_model
+ priority = 1
# Invoke method
- response = _service.create_load_balancer_listener(
- load_balancer_id,
- protocol,
- accept_proxy_protocol=accept_proxy_protocol,
- certificate_instance=certificate_instance,
- connection_limit=connection_limit,
- default_pool=default_pool,
- https_redirect=https_redirect,
- idle_connection_timeout=idle_connection_timeout,
- policies=policies,
- port=port,
- port_max=port_max,
- port_min=port_min,
+ response = _service.create_vpc_route(
+ vpc_id,
+ destination,
+ zone,
+ action=action,
+ advertise=advertise,
+ name=name,
+ next_hop=next_hop,
+ priority=priority,
headers={},
)
@@ -48601,35 +48822,31 @@ def test_create_load_balancer_listener_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['protocol'] == 'http'
- assert req_body['accept_proxy_protocol'] == True
- assert req_body['certificate_instance'] == certificate_instance_identity_model
- assert req_body['connection_limit'] == 2000
- assert req_body['default_pool'] == load_balancer_pool_identity_model
- assert req_body['https_redirect'] == load_balancer_listener_https_redirect_prototype_model
- assert req_body['idle_connection_timeout'] == 100
- assert req_body['policies'] == [load_balancer_listener_policy_prototype_model]
- assert req_body['port'] == 443
- assert req_body['port_max'] == 499
- assert req_body['port_min'] == 443
+ assert req_body['destination'] == '192.168.3.0/24'
+ assert req_body['zone'] == zone_identity_model
+ assert req_body['action'] == 'deliver'
+ assert req_body['advertise'] == False
+ assert req_body['name'] == 'my-vpc-routing-table-route'
+ assert req_body['next_hop'] == route_next_hop_prototype_model
+ assert req_body['priority'] == 1
- def test_create_load_balancer_listener_all_params_with_retries(self):
- # Enable retries and run test_create_load_balancer_listener_all_params.
+ def test_create_vpc_route_all_params_with_retries(self):
+ # Enable retries and run test_create_vpc_route_all_params.
_service.enable_retries()
- self.test_create_load_balancer_listener_all_params()
+ self.test_create_vpc_route_all_params()
- # Disable retries and run test_create_load_balancer_listener_all_params.
+ # Disable retries and run test_create_vpc_route_all_params.
_service.disable_retries()
- self.test_create_load_balancer_listener_all_params()
+ self.test_create_vpc_route_all_params()
@responses.activate
- def test_create_load_balancer_listener_value_error(self):
+ def test_create_vpc_route_value_error(self):
"""
- test_create_load_balancer_listener_value_error()
+ test_create_vpc_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners')
- mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
+ url = preprocess_url('/vpcs/testString/routes')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48638,169 +48855,137 @@ def test_create_load_balancer_listener_value_error(self):
status=201,
)
- # 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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerListenerIdentityById model
- load_balancer_listener_identity_model = {}
- load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
-
- # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPrototype model
- load_balancer_listener_https_redirect_prototype_model = {}
- load_balancer_listener_https_redirect_prototype_model['http_status_code'] = 301
- load_balancer_listener_https_redirect_prototype_model['listener'] = load_balancer_listener_identity_model
- load_balancer_listener_https_redirect_prototype_model['uri'] = '/example?doc=get'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
- load_balancer_listener_policy_rule_prototype_model = {}
- load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
- load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
- load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
- load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_listener_policy_target_prototype_model = {}
- load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- # Construct a dict representation of a LoadBalancerListenerPolicyPrototype model
- load_balancer_listener_policy_prototype_model = {}
- load_balancer_listener_policy_prototype_model['action'] = 'forward_to_listener'
- load_balancer_listener_policy_prototype_model['name'] = 'my-load-balancer-listener-policy'
- load_balancer_listener_policy_prototype_model['priority'] = 5
- load_balancer_listener_policy_prototype_model['rules'] = [load_balancer_listener_policy_rule_prototype_model]
- load_balancer_listener_policy_prototype_model['target'] = load_balancer_listener_policy_target_prototype_model
+ # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_prototype_model = {}
+ route_next_hop_prototype_model['address'] = '0.0.0.0'
# Set up parameter values
- load_balancer_id = 'testString'
- protocol = 'http'
- accept_proxy_protocol = True
- certificate_instance = certificate_instance_identity_model
- connection_limit = 2000
- default_pool = load_balancer_pool_identity_model
- https_redirect = load_balancer_listener_https_redirect_prototype_model
- idle_connection_timeout = 100
- policies = [load_balancer_listener_policy_prototype_model]
- port = 443
- port_max = 499
- port_min = 443
+ vpc_id = 'testString'
+ destination = '192.168.3.0/24'
+ zone = zone_identity_model
+ action = 'deliver'
+ advertise = False
+ name = 'my-vpc-routing-table-route'
+ next_hop = route_next_hop_prototype_model
+ priority = 1
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "protocol": protocol,
+ "vpc_id": vpc_id,
+ "destination": destination,
+ "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_load_balancer_listener(**req_copy)
+ _service.create_vpc_route(**req_copy)
- def test_create_load_balancer_listener_value_error_with_retries(self):
- # Enable retries and run test_create_load_balancer_listener_value_error.
+ def test_create_vpc_route_value_error_with_retries(self):
+ # Enable retries and run test_create_vpc_route_value_error.
_service.enable_retries()
- self.test_create_load_balancer_listener_value_error()
+ self.test_create_vpc_route_value_error()
- # Disable retries and run test_create_load_balancer_listener_value_error.
+ # Disable retries and run test_create_vpc_route_value_error.
_service.disable_retries()
- self.test_create_load_balancer_listener_value_error()
+ self.test_create_vpc_route_value_error()
-class TestDeleteLoadBalancerListener:
+class TestDeleteVpcRoute:
"""
- Test Class for delete_load_balancer_listener
+ Test Class for delete_vpc_route
"""
@responses.activate
- def test_delete_load_balancer_listener_all_params(self):
+ def test_delete_vpc_route_all_params(self):
"""
- delete_load_balancer_listener()
+ delete_vpc_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString')
+ url = preprocess_url('/vpcs/testString/routes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_load_balancer_listener(
- load_balancer_id,
+ response = _service.delete_vpc_route(
+ vpc_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_load_balancer_listener_all_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_listener_all_params.
+ def test_delete_vpc_route_all_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_route_all_params.
_service.enable_retries()
- self.test_delete_load_balancer_listener_all_params()
+ self.test_delete_vpc_route_all_params()
- # Disable retries and run test_delete_load_balancer_listener_all_params.
+ # Disable retries and run test_delete_vpc_route_all_params.
_service.disable_retries()
- self.test_delete_load_balancer_listener_all_params()
+ self.test_delete_vpc_route_all_params()
@responses.activate
- def test_delete_load_balancer_listener_value_error(self):
+ def test_delete_vpc_route_value_error(self):
"""
- test_delete_load_balancer_listener_value_error()
+ test_delete_vpc_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString')
+ url = preprocess_url('/vpcs/testString/routes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_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_load_balancer_listener(**req_copy)
+ _service.delete_vpc_route(**req_copy)
- def test_delete_load_balancer_listener_value_error_with_retries(self):
- # Enable retries and run test_delete_load_balancer_listener_value_error.
+ def test_delete_vpc_route_value_error_with_retries(self):
+ # Enable retries and run test_delete_vpc_route_value_error.
_service.enable_retries()
- self.test_delete_load_balancer_listener_value_error()
+ self.test_delete_vpc_route_value_error()
- # Disable retries and run test_delete_load_balancer_listener_value_error.
+ # Disable retries and run test_delete_vpc_route_value_error.
_service.disable_retries()
- self.test_delete_load_balancer_listener_value_error()
+ self.test_delete_vpc_route_value_error()
-class TestGetLoadBalancerListener:
+class TestGetVpcRoute:
"""
- Test Class for get_load_balancer_listener
+ Test Class for get_vpc_route
"""
@responses.activate
- def test_get_load_balancer_listener_all_params(self):
+ def test_get_vpc_route_all_params(self):
"""
- get_load_balancer_listener()
+ get_vpc_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString')
- mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
+ url = preprocess_url('/vpcs/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48810,12 +48995,12 @@ def test_get_load_balancer_listener_all_params(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_load_balancer_listener(
- load_balancer_id,
+ response = _service.get_vpc_route(
+ vpc_id,
id,
headers={},
)
@@ -48824,23 +49009,23 @@ def test_get_load_balancer_listener_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_load_balancer_listener_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_listener_all_params.
+ def test_get_vpc_route_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_route_all_params.
_service.enable_retries()
- self.test_get_load_balancer_listener_all_params()
+ self.test_get_vpc_route_all_params()
- # Disable retries and run test_get_load_balancer_listener_all_params.
+ # Disable retries and run test_get_vpc_route_all_params.
_service.disable_retries()
- self.test_get_load_balancer_listener_all_params()
+ self.test_get_vpc_route_all_params()
@responses.activate
- def test_get_load_balancer_listener_value_error(self):
+ def test_get_vpc_route_value_error(self):
"""
- test_get_load_balancer_listener_value_error()
+ test_get_vpc_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString')
- mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
+ url = preprocess_url('/vpcs/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48850,42 +49035,42 @@ def test_get_load_balancer_listener_value_error(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_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_load_balancer_listener(**req_copy)
+ _service.get_vpc_route(**req_copy)
- def test_get_load_balancer_listener_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_listener_value_error.
+ def test_get_vpc_route_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_route_value_error.
_service.enable_retries()
- self.test_get_load_balancer_listener_value_error()
+ self.test_get_vpc_route_value_error()
- # Disable retries and run test_get_load_balancer_listener_value_error.
+ # Disable retries and run test_get_vpc_route_value_error.
_service.disable_retries()
- self.test_get_load_balancer_listener_value_error()
+ self.test_get_vpc_route_value_error()
-class TestUpdateLoadBalancerListener:
+class TestUpdateVpcRoute:
"""
- Test Class for update_load_balancer_listener
+ Test Class for update_vpc_route
"""
@responses.activate
- def test_update_load_balancer_listener_all_params(self):
+ def test_update_vpc_route_all_params(self):
"""
- update_load_balancer_listener()
+ update_vpc_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString')
- mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
+ url = preprocess_url('/vpcs/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48894,47 +49079,27 @@ def test_update_load_balancer_listener_all_params(self):
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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
-
- # Construct a dict representation of a LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityById model
- load_balancer_listener_default_pool_patch_model = {}
- load_balancer_listener_default_pool_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerListenerIdentityById model
- load_balancer_listener_identity_model = {}
- load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
-
- # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPatch model
- load_balancer_listener_https_redirect_patch_model = {}
- load_balancer_listener_https_redirect_patch_model['http_status_code'] = 301
- load_balancer_listener_https_redirect_patch_model['listener'] = load_balancer_listener_identity_model
- load_balancer_listener_https_redirect_patch_model['uri'] = '/example?doc=get'
+ # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_patch_model = {}
+ route_next_hop_patch_model['address'] = '10.240.0.12'
- # Construct a dict representation of a LoadBalancerListenerPatch model
- load_balancer_listener_patch_model = {}
- load_balancer_listener_patch_model['accept_proxy_protocol'] = True
- load_balancer_listener_patch_model['certificate_instance'] = certificate_instance_identity_model
- load_balancer_listener_patch_model['connection_limit'] = 2000
- load_balancer_listener_patch_model['default_pool'] = load_balancer_listener_default_pool_patch_model
- load_balancer_listener_patch_model['https_redirect'] = load_balancer_listener_https_redirect_patch_model
- load_balancer_listener_patch_model['idle_connection_timeout'] = 100
- load_balancer_listener_patch_model['port'] = 443
- load_balancer_listener_patch_model['port_max'] = 499
- load_balancer_listener_patch_model['port_min'] = 443
- load_balancer_listener_patch_model['protocol'] = 'http'
+ # Construct a dict representation of a RoutePatch model
+ route_patch_model = {}
+ route_patch_model['advertise'] = True
+ route_patch_model['name'] = 'my-vpc-routing-table-route'
+ route_patch_model['next_hop'] = route_next_hop_patch_model
+ route_patch_model['priority'] = 1
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_listener_patch = load_balancer_listener_patch_model
+ route_patch = route_patch_model
# Invoke method
- response = _service.update_load_balancer_listener(
- load_balancer_id,
+ response = _service.update_vpc_route(
+ vpc_id,
id,
- load_balancer_listener_patch,
+ route_patch,
headers={},
)
@@ -48943,25 +49108,25 @@ def test_update_load_balancer_listener_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 == load_balancer_listener_patch
+ assert req_body == route_patch
- def test_update_load_balancer_listener_all_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_listener_all_params.
+ def test_update_vpc_route_all_params_with_retries(self):
+ # Enable retries and run test_update_vpc_route_all_params.
_service.enable_retries()
- self.test_update_load_balancer_listener_all_params()
+ self.test_update_vpc_route_all_params()
- # Disable retries and run test_update_load_balancer_listener_all_params.
+ # Disable retries and run test_update_vpc_route_all_params.
_service.disable_retries()
- self.test_update_load_balancer_listener_all_params()
+ self.test_update_vpc_route_all_params()
@responses.activate
- def test_update_load_balancer_listener_value_error(self):
+ def test_update_vpc_route_value_error(self):
"""
- test_update_load_balancer_listener_value_error()
+ test_update_vpc_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString')
- mock_response = '{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091"}, "uri": "/example?doc=get"}, "id": "r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}'
+ url = preprocess_url('/vpcs/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -48970,76 +49135,56 @@ def test_update_load_balancer_listener_value_error(self):
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/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5'
-
- # Construct a dict representation of a LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityById model
- load_balancer_listener_default_pool_patch_model = {}
- load_balancer_listener_default_pool_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerListenerIdentityById model
- load_balancer_listener_identity_model = {}
- load_balancer_listener_identity_model['id'] = 'r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091'
-
- # Construct a dict representation of a LoadBalancerListenerHTTPSRedirectPatch model
- load_balancer_listener_https_redirect_patch_model = {}
- load_balancer_listener_https_redirect_patch_model['http_status_code'] = 301
- load_balancer_listener_https_redirect_patch_model['listener'] = load_balancer_listener_identity_model
- load_balancer_listener_https_redirect_patch_model['uri'] = '/example?doc=get'
+ # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_patch_model = {}
+ route_next_hop_patch_model['address'] = '10.240.0.12'
- # Construct a dict representation of a LoadBalancerListenerPatch model
- load_balancer_listener_patch_model = {}
- load_balancer_listener_patch_model['accept_proxy_protocol'] = True
- load_balancer_listener_patch_model['certificate_instance'] = certificate_instance_identity_model
- load_balancer_listener_patch_model['connection_limit'] = 2000
- load_balancer_listener_patch_model['default_pool'] = load_balancer_listener_default_pool_patch_model
- load_balancer_listener_patch_model['https_redirect'] = load_balancer_listener_https_redirect_patch_model
- load_balancer_listener_patch_model['idle_connection_timeout'] = 100
- load_balancer_listener_patch_model['port'] = 443
- load_balancer_listener_patch_model['port_max'] = 499
- load_balancer_listener_patch_model['port_min'] = 443
- load_balancer_listener_patch_model['protocol'] = 'http'
+ # Construct a dict representation of a RoutePatch model
+ route_patch_model = {}
+ route_patch_model['advertise'] = True
+ route_patch_model['name'] = 'my-vpc-routing-table-route'
+ route_patch_model['next_hop'] = route_next_hop_patch_model
+ route_patch_model['priority'] = 1
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_listener_patch = load_balancer_listener_patch_model
+ route_patch = route_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_id,
"id": id,
- "load_balancer_listener_patch": load_balancer_listener_patch,
+ "route_patch": 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.update_load_balancer_listener(**req_copy)
+ _service.update_vpc_route(**req_copy)
- def test_update_load_balancer_listener_value_error_with_retries(self):
- # Enable retries and run test_update_load_balancer_listener_value_error.
+ def test_update_vpc_route_value_error_with_retries(self):
+ # Enable retries and run test_update_vpc_route_value_error.
_service.enable_retries()
- self.test_update_load_balancer_listener_value_error()
+ self.test_update_vpc_route_value_error()
- # Disable retries and run test_update_load_balancer_listener_value_error.
+ # Disable retries and run test_update_vpc_route_value_error.
_service.disable_retries()
- self.test_update_load_balancer_listener_value_error()
+ self.test_update_vpc_route_value_error()
-class TestListLoadBalancerListenerPolicies:
+class TestListVpcRoutingTables:
"""
- Test Class for list_load_balancer_listener_policies
+ Test Class for list_vpc_routing_tables
"""
@responses.activate
- def test_list_load_balancer_listener_policies_all_params(self):
+ def test_list_vpc_routing_tables_all_params(self):
"""
- list_load_balancer_listener_policies()
+ list_vpc_routing_tables()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
- mock_response = '{"policies": [{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}]}'
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -49049,37 +49194,47 @@ def test_list_load_balancer_listener_policies_all_params(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
+ vpc_id = 'testString'
+ start = 'testString'
+ limit = 50
+ is_default = True
# Invoke method
- response = _service.list_load_balancer_listener_policies(
- load_balancer_id,
- listener_id,
+ response = _service.list_vpc_routing_tables(
+ vpc_id,
+ start=start,
+ limit=limit,
+ is_default=is_default,
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 'is_default={}'.format('true' if is_default else 'false') in query_string
- def test_list_load_balancer_listener_policies_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_listener_policies_all_params.
+ def test_list_vpc_routing_tables_all_params_with_retries(self):
+ # Enable retries and run test_list_vpc_routing_tables_all_params.
_service.enable_retries()
- self.test_list_load_balancer_listener_policies_all_params()
+ self.test_list_vpc_routing_tables_all_params()
- # Disable retries and run test_list_load_balancer_listener_policies_all_params.
+ # Disable retries and run test_list_vpc_routing_tables_all_params.
_service.disable_retries()
- self.test_list_load_balancer_listener_policies_all_params()
+ self.test_list_vpc_routing_tables_all_params()
@responses.activate
- def test_list_load_balancer_listener_policies_value_error(self):
+ def test_list_vpc_routing_tables_required_params(self):
"""
- test_list_load_balancer_listener_policies_value_error()
+ test_list_vpc_routing_tables_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
- mock_response = '{"policies": [{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}]}'
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -49089,954 +49244,743 @@ def test_list_load_balancer_listener_policies_value_error(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_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_load_balancer_listener_policies(**req_copy)
-
- def test_list_load_balancer_listener_policies_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancer_listener_policies_value_error.
- _service.enable_retries()
- self.test_list_load_balancer_listener_policies_value_error()
-
- # Disable retries and run test_list_load_balancer_listener_policies_value_error.
- _service.disable_retries()
- self.test_list_load_balancer_listener_policies_value_error()
-
-
-class TestCreateLoadBalancerListenerPolicy:
- """
- Test Class for create_load_balancer_listener_policy
- """
-
- @responses.activate
- def test_create_load_balancer_listener_policy_all_params(self):
- """
- create_load_balancer_listener_policy()
- """
- # Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
- mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
- responses.add(
- responses.POST,
- url,
- body=mock_response,
- content_type='application/json',
- status=201,
- )
-
- # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
- load_balancer_listener_policy_rule_prototype_model = {}
- load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
- load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
- load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
- load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_listener_policy_target_prototype_model = {}
- load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- action = 'forward_to_listener'
- priority = 5
- name = 'my-load-balancer-listener-policy'
- rules = [load_balancer_listener_policy_rule_prototype_model]
- target = load_balancer_listener_policy_target_prototype_model
+ vpc_id = 'testString'
# Invoke method
- response = _service.create_load_balancer_listener_policy(
- load_balancer_id,
- listener_id,
- action,
- priority,
- name=name,
- rules=rules,
- target=target,
+ response = _service.list_vpc_routing_tables(
+ vpc_id,
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['action'] == 'forward_to_listener'
- assert req_body['priority'] == 5
- assert req_body['name'] == 'my-load-balancer-listener-policy'
- assert req_body['rules'] == [load_balancer_listener_policy_rule_prototype_model]
- assert req_body['target'] == load_balancer_listener_policy_target_prototype_model
+ assert response.status_code == 200
- def test_create_load_balancer_listener_policy_all_params_with_retries(self):
- # Enable retries and run test_create_load_balancer_listener_policy_all_params.
+ def test_list_vpc_routing_tables_required_params_with_retries(self):
+ # Enable retries and run test_list_vpc_routing_tables_required_params.
_service.enable_retries()
- self.test_create_load_balancer_listener_policy_all_params()
+ self.test_list_vpc_routing_tables_required_params()
- # Disable retries and run test_create_load_balancer_listener_policy_all_params.
+ # Disable retries and run test_list_vpc_routing_tables_required_params.
_service.disable_retries()
- self.test_create_load_balancer_listener_policy_all_params()
+ self.test_list_vpc_routing_tables_required_params()
@responses.activate
- def test_create_load_balancer_listener_policy_value_error(self):
+ def test_list_vpc_routing_tables_value_error(self):
"""
- test_create_load_balancer_listener_policy_value_error()
+ test_list_vpc_routing_tables_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies')
- mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a LoadBalancerListenerPolicyRulePrototype model
- load_balancer_listener_policy_rule_prototype_model = {}
- load_balancer_listener_policy_rule_prototype_model['condition'] = 'contains'
- load_balancer_listener_policy_rule_prototype_model['field'] = 'MY-APP-HEADER'
- load_balancer_listener_policy_rule_prototype_model['type'] = 'body'
- load_balancer_listener_policy_rule_prototype_model['value'] = 'testString'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_listener_policy_target_prototype_model = {}
- load_balancer_listener_policy_target_prototype_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- action = 'forward_to_listener'
- priority = 5
- name = 'my-load-balancer-listener-policy'
- rules = [load_balancer_listener_policy_rule_prototype_model]
- target = load_balancer_listener_policy_target_prototype_model
+ vpc_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "action": action,
- "priority": priority,
+ "vpc_id": vpc_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_load_balancer_listener_policy(**req_copy)
+ _service.list_vpc_routing_tables(**req_copy)
- def test_create_load_balancer_listener_policy_value_error_with_retries(self):
- # Enable retries and run test_create_load_balancer_listener_policy_value_error.
+ def test_list_vpc_routing_tables_value_error_with_retries(self):
+ # Enable retries and run test_list_vpc_routing_tables_value_error.
_service.enable_retries()
- self.test_create_load_balancer_listener_policy_value_error()
+ self.test_list_vpc_routing_tables_value_error()
- # Disable retries and run test_create_load_balancer_listener_policy_value_error.
+ # Disable retries and run test_list_vpc_routing_tables_value_error.
_service.disable_retries()
- self.test_create_load_balancer_listener_policy_value_error()
-
-
-class TestDeleteLoadBalancerListenerPolicy:
- """
- Test Class for delete_load_balancer_listener_policy
- """
+ self.test_list_vpc_routing_tables_value_error()
@responses.activate
- def test_delete_load_balancer_listener_policy_all_params(self):
+ def test_list_vpc_routing_tables_with_pager_get_next(self):
"""
- delete_load_balancer_listener_policy()
+ test_list_vpc_routing_tables_with_pager_get_next()
"""
- # Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
)
-
- # Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- id = 'testString'
-
- # Invoke method
- response = _service.delete_load_balancer_listener_policy(
- load_balancer_id,
- listener_id,
- id,
- headers={},
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 202
-
- def test_delete_load_balancer_listener_policy_all_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_listener_policy_all_params.
- _service.enable_retries()
- self.test_delete_load_balancer_listener_policy_all_params()
-
- # Disable retries and run test_delete_load_balancer_listener_policy_all_params.
- _service.disable_retries()
- self.test_delete_load_balancer_listener_policy_all_params()
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpcRoutingTablesPager(
+ client=_service,
+ vpc_id='testString',
+ limit=10,
+ is_default=True,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
@responses.activate
- def test_delete_load_balancer_listener_policy_value_error(self):
+ def test_list_vpc_routing_tables_with_pager_get_all(self):
"""
- test_delete_load_balancer_listener_policy_value_error()
+ test_list_vpc_routing_tables_with_pager_get_all()
"""
- # Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_server"}],"advertise_routes_to":["transit_gateway"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840","id":"r006-6885e83f-03b2-4603-8a86-db2a0f55c840","is_default":true,"lifecycle_state":"stable","name":"my-routing-table-1","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"routing_table","route_direct_link_ingress":false,"route_internet_ingress":true,"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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","name":"my-vpc-routing-table-route"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- # Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_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_load_balancer_listener_policy(**req_copy)
-
- def test_delete_load_balancer_listener_policy_value_error_with_retries(self):
- # Enable retries and run test_delete_load_balancer_listener_policy_value_error.
- _service.enable_retries()
- self.test_delete_load_balancer_listener_policy_value_error()
-
- # Disable retries and run test_delete_load_balancer_listener_policy_value_error.
- _service.disable_retries()
- self.test_delete_load_balancer_listener_policy_value_error()
+ # Exercise the pager class for this operation
+ pager = VpcRoutingTablesPager(
+ client=_service,
+ vpc_id='testString',
+ limit=10,
+ is_default=True,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestGetLoadBalancerListenerPolicy:
+class TestCreateVpcRoutingTable:
"""
- Test Class for get_load_balancer_listener_policy
+ Test Class for create_vpc_routing_table
"""
@responses.activate
- def test_get_load_balancer_listener_policy_all_params(self):
+ def test_create_vpc_routing_table_all_params(self):
"""
- get_load_balancer_listener_policy()
+ create_vpc_routing_table()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
- mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a ResourceFilter model
+ resource_filter_model = {}
+ resource_filter_model['resource_type'] = 'vpn_server'
+
+ # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_prototype_model = {}
+ route_next_hop_prototype_model['address'] = '0.0.0.0'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a RoutePrototype model
+ route_prototype_model = {}
+ route_prototype_model['action'] = 'deliver'
+ route_prototype_model['advertise'] = False
+ route_prototype_model['destination'] = '192.168.3.0/24'
+ route_prototype_model['name'] = 'my-vpc-routing-table-route'
+ route_prototype_model['next_hop'] = route_next_hop_prototype_model
+ route_prototype_model['priority'] = 1
+ route_prototype_model['zone'] = zone_identity_model
+
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- id = 'testString'
+ vpc_id = 'testString'
+ accept_routes_from = [resource_filter_model]
+ advertise_routes_to = []
+ name = 'my-routing-table-1'
+ route_direct_link_ingress = False
+ route_internet_ingress = False
+ route_transit_gateway_ingress = False
+ route_vpc_zone_ingress = False
+ routes = [route_prototype_model]
# Invoke method
- response = _service.get_load_balancer_listener_policy(
- load_balancer_id,
- listener_id,
- id,
+ response = _service.create_vpc_routing_table(
+ vpc_id,
+ accept_routes_from=accept_routes_from,
+ advertise_routes_to=advertise_routes_to,
+ name=name,
+ route_direct_link_ingress=route_direct_link_ingress,
+ route_internet_ingress=route_internet_ingress,
+ route_transit_gateway_ingress=route_transit_gateway_ingress,
+ route_vpc_zone_ingress=route_vpc_zone_ingress,
+ routes=routes,
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['accept_routes_from'] == [resource_filter_model]
+ assert req_body['advertise_routes_to'] == []
+ assert req_body['name'] == 'my-routing-table-1'
+ assert req_body['route_direct_link_ingress'] == False
+ assert req_body['route_internet_ingress'] == False
+ assert req_body['route_transit_gateway_ingress'] == False
+ assert req_body['route_vpc_zone_ingress'] == False
+ assert req_body['routes'] == [route_prototype_model]
- def test_get_load_balancer_listener_policy_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_listener_policy_all_params.
+ def test_create_vpc_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_create_vpc_routing_table_all_params.
_service.enable_retries()
- self.test_get_load_balancer_listener_policy_all_params()
+ self.test_create_vpc_routing_table_all_params()
- # Disable retries and run test_get_load_balancer_listener_policy_all_params.
+ # Disable retries and run test_create_vpc_routing_table_all_params.
_service.disable_retries()
- self.test_get_load_balancer_listener_policy_all_params()
+ self.test_create_vpc_routing_table_all_params()
@responses.activate
- def test_get_load_balancer_listener_policy_value_error(self):
+ def test_create_vpc_routing_table_value_error(self):
"""
- test_get_load_balancer_listener_policy_value_error()
+ test_create_vpc_routing_table_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
- mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ status=201,
)
+ # Construct a dict representation of a ResourceFilter model
+ resource_filter_model = {}
+ resource_filter_model['resource_type'] = 'vpn_server'
+
+ # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_prototype_model = {}
+ route_next_hop_prototype_model['address'] = '0.0.0.0'
+
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
+
+ # Construct a dict representation of a RoutePrototype model
+ route_prototype_model = {}
+ route_prototype_model['action'] = 'deliver'
+ route_prototype_model['advertise'] = False
+ route_prototype_model['destination'] = '192.168.3.0/24'
+ route_prototype_model['name'] = 'my-vpc-routing-table-route'
+ route_prototype_model['next_hop'] = route_next_hop_prototype_model
+ route_prototype_model['priority'] = 1
+ route_prototype_model['zone'] = zone_identity_model
+
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- id = 'testString'
+ vpc_id = 'testString'
+ accept_routes_from = [resource_filter_model]
+ advertise_routes_to = []
+ name = 'my-routing-table-1'
+ route_direct_link_ingress = False
+ route_internet_ingress = False
+ route_transit_gateway_ingress = False
+ route_vpc_zone_ingress = False
+ routes = [route_prototype_model]
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "id": id,
+ "vpc_id": vpc_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_load_balancer_listener_policy(**req_copy)
+ _service.create_vpc_routing_table(**req_copy)
- def test_get_load_balancer_listener_policy_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_listener_policy_value_error.
+ def test_create_vpc_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_create_vpc_routing_table_value_error.
_service.enable_retries()
- self.test_get_load_balancer_listener_policy_value_error()
+ self.test_create_vpc_routing_table_value_error()
- # Disable retries and run test_get_load_balancer_listener_policy_value_error.
+ # Disable retries and run test_create_vpc_routing_table_value_error.
_service.disable_retries()
- self.test_get_load_balancer_listener_policy_value_error()
+ self.test_create_vpc_routing_table_value_error()
-class TestUpdateLoadBalancerListenerPolicy:
+class TestDeleteVpcRoutingTable:
"""
- Test Class for update_load_balancer_listener_policy
+ Test Class for delete_vpc_routing_table
"""
@responses.activate
- def test_update_load_balancer_listener_policy_all_params(self):
+ def test_delete_vpc_routing_table_all_params(self):
"""
- update_load_balancer_listener_policy()
+ delete_vpc_routing_table()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
- mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_listener_policy_target_patch_model = {}
- load_balancer_listener_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyPatch model
- load_balancer_listener_policy_patch_model = {}
- load_balancer_listener_policy_patch_model['name'] = 'my-load-balancer-listener-policy-updated'
- load_balancer_listener_policy_patch_model['priority'] = 5
- load_balancer_listener_policy_patch_model['target'] = load_balancer_listener_policy_target_patch_model
-
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_listener_policy_patch = load_balancer_listener_policy_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.update_load_balancer_listener_policy(
- load_balancer_id,
- listener_id,
+ response = _service.delete_vpc_routing_table(
+ vpc_id,
id,
- load_balancer_listener_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 == load_balancer_listener_policy_patch
+ assert response.status_code == 204
- def test_update_load_balancer_listener_policy_all_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_listener_policy_all_params.
+ def test_delete_vpc_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_routing_table_all_params.
_service.enable_retries()
- self.test_update_load_balancer_listener_policy_all_params()
+ self.test_delete_vpc_routing_table_all_params()
- # Disable retries and run test_update_load_balancer_listener_policy_all_params.
+ # Disable retries and run test_delete_vpc_routing_table_all_params.
_service.disable_retries()
- self.test_update_load_balancer_listener_policy_all_params()
+ self.test_delete_vpc_routing_table_all_params()
@responses.activate
- def test_update_load_balancer_listener_policy_value_error(self):
+ def test_delete_vpc_routing_table_required_params(self):
"""
- test_update_load_balancer_listener_policy_value_error()
+ test_delete_vpc_routing_table_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString')
- mock_response = '{"action": "forward_to_listener", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "id": "r006-0b00a37f-a3d7-43ca-8187-f1e88d659245", "name": "my-load-balancer-listener-policy", "priority": 5, "provisioning_status": "active", "rules": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b"}], "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
responses.add(
- responses.PATCH,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_listener_policy_target_patch_model = {}
- load_balancer_listener_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerListenerPolicyPatch model
- load_balancer_listener_policy_patch_model = {}
- load_balancer_listener_policy_patch_model['name'] = 'my-load-balancer-listener-policy-updated'
- load_balancer_listener_policy_patch_model['priority'] = 5
- load_balancer_listener_policy_patch_model['target'] = load_balancer_listener_policy_target_patch_model
-
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
- load_balancer_listener_policy_patch = load_balancer_listener_policy_patch_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "id": id,
- "load_balancer_listener_policy_patch": load_balancer_listener_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_load_balancer_listener_policy(**req_copy)
-
- def test_update_load_balancer_listener_policy_value_error_with_retries(self):
- # Enable retries and run test_update_load_balancer_listener_policy_value_error.
- _service.enable_retries()
- self.test_update_load_balancer_listener_policy_value_error()
-
- # Disable retries and run test_update_load_balancer_listener_policy_value_error.
- _service.disable_retries()
- self.test_update_load_balancer_listener_policy_value_error()
-
-
-class TestListLoadBalancerListenerPolicyRules:
- """
- Test Class for list_load_balancer_listener_policy_rules
- """
-
- @responses.activate
- def test_list_load_balancer_listener_policy_rules_all_params(self):
- """
- list_load_balancer_listener_policy_rules()
- """
- # Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
- mock_response = '{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
# Invoke method
- response = _service.list_load_balancer_listener_policy_rules(
- load_balancer_id,
- listener_id,
- policy_id,
+ response = _service.delete_vpc_routing_table(
+ vpc_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_list_load_balancer_listener_policy_rules_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_listener_policy_rules_all_params.
+ 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_list_load_balancer_listener_policy_rules_all_params()
+ self.test_delete_vpc_routing_table_required_params()
- # Disable retries and run test_list_load_balancer_listener_policy_rules_all_params.
+ # Disable retries and run test_delete_vpc_routing_table_required_params.
_service.disable_retries()
- self.test_list_load_balancer_listener_policy_rules_all_params()
+ self.test_delete_vpc_routing_table_required_params()
@responses.activate
- def test_list_load_balancer_listener_policy_rules_value_error(self):
+ def test_delete_vpc_routing_table_value_error(self):
"""
- test_list_load_balancer_listener_policy_rules_value_error()
+ test_delete_vpc_routing_table_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
- mock_response = '{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}]}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
+ vpc_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "policy_id": policy_id,
+ "vpc_id": vpc_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_load_balancer_listener_policy_rules(**req_copy)
+ _service.delete_vpc_routing_table(**req_copy)
- def test_list_load_balancer_listener_policy_rules_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancer_listener_policy_rules_value_error.
+ def test_delete_vpc_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_delete_vpc_routing_table_value_error.
_service.enable_retries()
- self.test_list_load_balancer_listener_policy_rules_value_error()
+ self.test_delete_vpc_routing_table_value_error()
- # Disable retries and run test_list_load_balancer_listener_policy_rules_value_error.
+ # Disable retries and run test_delete_vpc_routing_table_value_error.
_service.disable_retries()
- self.test_list_load_balancer_listener_policy_rules_value_error()
+ self.test_delete_vpc_routing_table_value_error()
-class TestCreateLoadBalancerListenerPolicyRule:
+class TestGetVpcRoutingTable:
"""
- Test Class for create_load_balancer_listener_policy_rule
+ Test Class for get_vpc_routing_table
"""
@responses.activate
- def test_create_load_balancer_listener_policy_rule_all_params(self):
+ def test_get_vpc_routing_table_all_params(self):
"""
- create_load_balancer_listener_policy_rule()
+ get_vpc_routing_table()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
- mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
- condition = 'contains'
- type = 'body'
- value = 'testString'
- field = 'MY-APP-HEADER'
+ vpc_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.create_load_balancer_listener_policy_rule(
- load_balancer_id,
- listener_id,
- policy_id,
- condition,
- type,
- value,
- field=field,
+ response = _service.get_vpc_routing_table(
+ vpc_id,
+ id,
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['condition'] == 'contains'
- assert req_body['type'] == 'body'
- assert req_body['value'] == 'testString'
- assert req_body['field'] == 'MY-APP-HEADER'
+ assert response.status_code == 200
- def test_create_load_balancer_listener_policy_rule_all_params_with_retries(self):
- # Enable retries and run test_create_load_balancer_listener_policy_rule_all_params.
+ def test_get_vpc_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_routing_table_all_params.
_service.enable_retries()
- self.test_create_load_balancer_listener_policy_rule_all_params()
+ self.test_get_vpc_routing_table_all_params()
- # Disable retries and run test_create_load_balancer_listener_policy_rule_all_params.
+ # Disable retries and run test_get_vpc_routing_table_all_params.
_service.disable_retries()
- self.test_create_load_balancer_listener_policy_rule_all_params()
+ self.test_get_vpc_routing_table_all_params()
@responses.activate
- def test_create_load_balancer_listener_policy_rule_value_error(self):
+ def test_get_vpc_routing_table_value_error(self):
"""
- test_create_load_balancer_listener_policy_rule_value_error()
+ test_get_vpc_routing_table_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules')
- mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
- condition = 'contains'
- type = 'body'
- value = 'testString'
- field = 'MY-APP-HEADER'
+ vpc_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "policy_id": policy_id,
- "condition": condition,
- "type": type,
- "value": value,
+ "vpc_id": vpc_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_load_balancer_listener_policy_rule(**req_copy)
+ _service.get_vpc_routing_table(**req_copy)
- def test_create_load_balancer_listener_policy_rule_value_error_with_retries(self):
- # Enable retries and run test_create_load_balancer_listener_policy_rule_value_error.
+ def test_get_vpc_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_routing_table_value_error.
_service.enable_retries()
- self.test_create_load_balancer_listener_policy_rule_value_error()
+ self.test_get_vpc_routing_table_value_error()
- # Disable retries and run test_create_load_balancer_listener_policy_rule_value_error.
+ # Disable retries and run test_get_vpc_routing_table_value_error.
_service.disable_retries()
- self.test_create_load_balancer_listener_policy_rule_value_error()
+ self.test_get_vpc_routing_table_value_error()
-class TestDeleteLoadBalancerListenerPolicyRule:
+class TestUpdateVpcRoutingTable:
"""
- Test Class for delete_load_balancer_listener_policy_rule
+ Test Class for update_vpc_routing_table
"""
@responses.activate
- def test_delete_load_balancer_listener_policy_rule_all_params(self):
+ def test_update_vpc_routing_table_all_params(self):
"""
- delete_load_balancer_listener_policy_rule()
+ update_vpc_routing_table()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.DELETE,
+ responses.PATCH,
url,
- status=202,
+ 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['advertise_routes_to'] = ['transit_gateway']
+ routing_table_patch_model['name'] = 'my-routing-table-2'
+ routing_table_patch_model['route_direct_link_ingress'] = True
+ routing_table_patch_model['route_internet_ingress'] = True
+ routing_table_patch_model['route_transit_gateway_ingress'] = True
+ routing_table_patch_model['route_vpc_zone_ingress'] = True
+
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
+ routing_table_patch = routing_table_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
# Invoke method
- response = _service.delete_load_balancer_listener_policy_rule(
- load_balancer_id,
- listener_id,
- policy_id,
+ response = _service.update_vpc_routing_table(
+ vpc_id,
id,
+ routing_table_patch,
+ if_match=if_match,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
-
- def test_delete_load_balancer_listener_policy_rule_all_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_listener_policy_rule_all_params.
- _service.enable_retries()
- self.test_delete_load_balancer_listener_policy_rule_all_params()
-
- # Disable retries and run test_delete_load_balancer_listener_policy_rule_all_params.
- _service.disable_retries()
- self.test_delete_load_balancer_listener_policy_rule_all_params()
-
- @responses.activate
- def test_delete_load_balancer_listener_policy_rule_value_error(self):
- """
- test_delete_load_balancer_listener_policy_rule_value_error()
- """
- # Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
- responses.add(
- responses.DELETE,
- url,
- status=202,
- )
-
- # Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
- id = 'testString'
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "policy_id": 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.delete_load_balancer_listener_policy_rule(**req_copy)
+ 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_delete_load_balancer_listener_policy_rule_value_error_with_retries(self):
- # Enable retries and run test_delete_load_balancer_listener_policy_rule_value_error.
+ def test_update_vpc_routing_table_all_params_with_retries(self):
+ # Enable retries and run test_update_vpc_routing_table_all_params.
_service.enable_retries()
- self.test_delete_load_balancer_listener_policy_rule_value_error()
+ self.test_update_vpc_routing_table_all_params()
- # Disable retries and run test_delete_load_balancer_listener_policy_rule_value_error.
+ # Disable retries and run test_update_vpc_routing_table_all_params.
_service.disable_retries()
- self.test_delete_load_balancer_listener_policy_rule_value_error()
-
-
-class TestGetLoadBalancerListenerPolicyRule:
- """
- Test Class for get_load_balancer_listener_policy_rule
- """
+ self.test_update_vpc_routing_table_all_params()
@responses.activate
- def test_get_load_balancer_listener_policy_rule_all_params(self):
+ def test_update_vpc_routing_table_required_params(self):
"""
- get_load_balancer_listener_policy_rule()
+ test_update_vpc_routing_table_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
- mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.GET,
+ 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['advertise_routes_to'] = ['transit_gateway']
+ routing_table_patch_model['name'] = 'my-routing-table-2'
+ routing_table_patch_model['route_direct_link_ingress'] = True
+ routing_table_patch_model['route_internet_ingress'] = True
+ routing_table_patch_model['route_transit_gateway_ingress'] = True
+ routing_table_patch_model['route_vpc_zone_ingress'] = True
+
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
+ routing_table_patch = routing_table_patch_model
# Invoke method
- response = _service.get_load_balancer_listener_policy_rule(
- load_balancer_id,
- listener_id,
- policy_id,
+ 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_get_load_balancer_listener_policy_rule_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_listener_policy_rule_all_params.
+ 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_get_load_balancer_listener_policy_rule_all_params()
+ self.test_update_vpc_routing_table_required_params()
- # Disable retries and run test_get_load_balancer_listener_policy_rule_all_params.
+ # Disable retries and run test_update_vpc_routing_table_required_params.
_service.disable_retries()
- self.test_get_load_balancer_listener_policy_rule_all_params()
+ self.test_update_vpc_routing_table_required_params()
@responses.activate
- def test_get_load_balancer_listener_policy_rule_value_error(self):
+ def test_update_vpc_routing_table_value_error(self):
"""
- test_get_load_balancer_listener_policy_rule_value_error()
+ test_update_vpc_routing_table_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
- mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString')
+ mock_response = '{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": false, "route_internet_ingress": true, "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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "name": "my-vpc-routing-table-route"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}'
responses.add(
- responses.GET,
+ 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['advertise_routes_to'] = ['transit_gateway']
+ routing_table_patch_model['name'] = 'my-routing-table-2'
+ routing_table_patch_model['route_direct_link_ingress'] = True
+ routing_table_patch_model['route_internet_ingress'] = True
+ routing_table_patch_model['route_transit_gateway_ingress'] = True
+ routing_table_patch_model['route_vpc_zone_ingress'] = True
+
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
+ vpc_id = 'testString'
id = 'testString'
+ routing_table_patch = routing_table_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "policy_id": policy_id,
+ "vpc_id": vpc_id,
"id": id,
+ "routing_table_patch": routing_table_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_load_balancer_listener_policy_rule(**req_copy)
+ _service.update_vpc_routing_table(**req_copy)
- def test_get_load_balancer_listener_policy_rule_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_listener_policy_rule_value_error.
+ def test_update_vpc_routing_table_value_error_with_retries(self):
+ # Enable retries and run test_update_vpc_routing_table_value_error.
_service.enable_retries()
- self.test_get_load_balancer_listener_policy_rule_value_error()
+ self.test_update_vpc_routing_table_value_error()
- # Disable retries and run test_get_load_balancer_listener_policy_rule_value_error.
+ # Disable retries and run test_update_vpc_routing_table_value_error.
_service.disable_retries()
- self.test_get_load_balancer_listener_policy_rule_value_error()
+ self.test_update_vpc_routing_table_value_error()
-class TestUpdateLoadBalancerListenerPolicyRule:
+class TestListVpcRoutingTableRoutes:
"""
- Test Class for update_load_balancer_listener_policy_rule
+ Test Class for list_vpc_routing_table_routes
"""
@responses.activate
- def test_update_load_balancer_listener_policy_rule_all_params(self):
+ def test_list_vpc_routing_table_routes_all_params(self):
"""
- update_load_balancer_listener_policy_rule()
+ list_vpc_routing_table_routes()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
- mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a LoadBalancerListenerPolicyRulePatch model
- load_balancer_listener_policy_rule_patch_model = {}
- load_balancer_listener_policy_rule_patch_model['condition'] = 'contains'
- load_balancer_listener_policy_rule_patch_model['field'] = 'MY-APP-HEADER'
- load_balancer_listener_policy_rule_patch_model['type'] = 'body'
- load_balancer_listener_policy_rule_patch_model['value'] = 'my-example-hostname-updated'
-
# Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
- id = 'testString'
- load_balancer_listener_policy_rule_patch = load_balancer_listener_policy_rule_patch_model
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.update_load_balancer_listener_policy_rule(
- load_balancer_id,
- listener_id,
- policy_id,
- id,
- load_balancer_listener_policy_rule_patch,
+ response = _service.list_vpc_routing_table_routes(
+ vpc_id,
+ routing_table_id,
+ start=start,
+ limit=limit,
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 == load_balancer_listener_policy_rule_patch
-
- def test_update_load_balancer_listener_policy_rule_all_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_listener_policy_rule_all_params.
- _service.enable_retries()
- self.test_update_load_balancer_listener_policy_rule_all_params()
-
- # Disable retries and run test_update_load_balancer_listener_policy_rule_all_params.
- _service.disable_retries()
- self.test_update_load_balancer_listener_policy_rule_all_params()
-
- @responses.activate
- def test_update_load_balancer_listener_policy_rule_value_error(self):
- """
- test_update_load_balancer_listener_policy_rule_value_error()
- """
- # Set up mock
- url = preprocess_url('/load_balancers/testString/listeners/testString/policies/testString/rules/testString')
- mock_response = '{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/r006-97c05c26-4748-4db8-ac3f-d8a9c79a7091/policies/r006-0b00a37f-a3d7-43ca-8187-f1e88d659245/rules/r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "id": "r006-d2da2832-9751-4e29-ad1d-4b19c1c83c7b", "provisioning_status": "active", "type": "body", "value": "value"}'
- responses.add(
- responses.PATCH,
- url,
- body=mock_response,
- content_type='application/json',
- status=200,
- )
-
- # Construct a dict representation of a LoadBalancerListenerPolicyRulePatch model
- load_balancer_listener_policy_rule_patch_model = {}
- load_balancer_listener_policy_rule_patch_model['condition'] = 'contains'
- load_balancer_listener_policy_rule_patch_model['field'] = 'MY-APP-HEADER'
- load_balancer_listener_policy_rule_patch_model['type'] = 'body'
- load_balancer_listener_policy_rule_patch_model['value'] = 'my-example-hostname-updated'
-
- # Set up parameter values
- load_balancer_id = 'testString'
- listener_id = 'testString'
- policy_id = 'testString'
- id = 'testString'
- load_balancer_listener_policy_rule_patch = load_balancer_listener_policy_rule_patch_model
-
- # Pass in all but one required param and check for a ValueError
- req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "listener_id": listener_id,
- "policy_id": policy_id,
- "id": id,
- "load_balancer_listener_policy_rule_patch": load_balancer_listener_policy_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_load_balancer_listener_policy_rule(**req_copy)
+ # 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_update_load_balancer_listener_policy_rule_value_error_with_retries(self):
- # Enable retries and run test_update_load_balancer_listener_policy_rule_value_error.
+ def test_list_vpc_routing_table_routes_all_params_with_retries(self):
+ # Enable retries and run test_list_vpc_routing_table_routes_all_params.
_service.enable_retries()
- self.test_update_load_balancer_listener_policy_rule_value_error()
+ self.test_list_vpc_routing_table_routes_all_params()
- # Disable retries and run test_update_load_balancer_listener_policy_rule_value_error.
+ # Disable retries and run test_list_vpc_routing_table_routes_all_params.
_service.disable_retries()
- self.test_update_load_balancer_listener_policy_rule_value_error()
-
-
-class TestListLoadBalancerPools:
- """
- Test Class for list_load_balancer_pools
- """
+ self.test_list_vpc_routing_table_routes_all_params()
@responses.activate
- def test_list_load_balancer_pools_all_params(self):
+ def test_list_vpc_routing_table_routes_required_params(self):
"""
- list_load_balancer_pools()
+ test_list_vpc_routing_table_routes_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools')
- mock_response = '{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50046,11 +49990,13 @@ def test_list_load_balancer_pools_all_params(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
# Invoke method
- response = _service.list_load_balancer_pools(
- load_balancer_id,
+ response = _service.list_vpc_routing_table_routes(
+ vpc_id,
+ routing_table_id,
headers={},
)
@@ -50058,23 +50004,23 @@ def test_list_load_balancer_pools_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_load_balancer_pools_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_pools_all_params.
+ def test_list_vpc_routing_table_routes_required_params_with_retries(self):
+ # Enable retries and run test_list_vpc_routing_table_routes_required_params.
_service.enable_retries()
- self.test_list_load_balancer_pools_all_params()
+ self.test_list_vpc_routing_table_routes_required_params()
- # Disable retries and run test_list_load_balancer_pools_all_params.
+ # Disable retries and run test_list_vpc_routing_table_routes_required_params.
_service.disable_retries()
- self.test_list_load_balancer_pools_all_params()
+ self.test_list_vpc_routing_table_routes_required_params()
@responses.activate
- def test_list_load_balancer_pools_value_error(self):
+ def test_list_vpc_routing_table_routes_value_error(self):
"""
- test_list_load_balancer_pools_value_error()
+ test_list_vpc_routing_table_routes_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools')
- mock_response = '{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50084,40 +50030,115 @@ def test_list_load_balancer_pools_value_error(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_id,
+ "routing_table_id": routing_table_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_load_balancer_pools(**req_copy)
+ _service.list_vpc_routing_table_routes(**req_copy)
- def test_list_load_balancer_pools_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancer_pools_value_error.
+ def test_list_vpc_routing_table_routes_value_error_with_retries(self):
+ # Enable retries and run test_list_vpc_routing_table_routes_value_error.
_service.enable_retries()
- self.test_list_load_balancer_pools_value_error()
+ self.test_list_vpc_routing_table_routes_value_error()
- # Disable retries and run test_list_load_balancer_pools_value_error.
+ # Disable retries and run test_list_vpc_routing_table_routes_value_error.
_service.disable_retries()
- self.test_list_load_balancer_pools_value_error()
+ self.test_list_vpc_routing_table_routes_value_error()
+ @responses.activate
+ def test_list_vpc_routing_table_routes_with_pager_get_next(self):
+ """
+ test_list_vpc_routing_table_routes_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestCreateLoadBalancerPool:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpcRoutingTableRoutesPager(
+ client=_service,
+ vpc_id='testString',
+ routing_table_id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_vpc_routing_table_routes_with_pager_get_all(self):
+ """
+ test_list_vpc_routing_table_routes_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","id":"r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1","lifecycle_state":"stable","name":"my-vpc-routing-table-route","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VpcRoutingTableRoutesPager(
+ client=_service,
+ vpc_id='testString',
+ routing_table_id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateVpcRoutingTableRoute:
"""
- Test Class for create_load_balancer_pool
+ Test Class for create_vpc_routing_table_route
"""
@responses.activate
- def test_create_load_balancer_pool_all_params(self):
+ def test_create_vpc_routing_table_route_all_params(self):
"""
- create_load_balancer_pool()
+ create_vpc_routing_table_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools')
- mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50126,60 +50147,36 @@ def test_create_load_balancer_pool_all_params(self):
status=201,
)
- # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
- load_balancer_pool_health_monitor_prototype_model = {}
- load_balancer_pool_health_monitor_prototype_model['delay'] = 5
- load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
- load_balancer_pool_health_monitor_prototype_model['port'] = 22
- load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
- load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPrototype model
- load_balancer_pool_failsafe_policy_prototype_model = {}
- load_balancer_pool_failsafe_policy_prototype_model['action'] = 'forward'
- load_balancer_pool_failsafe_policy_prototype_model['target'] = load_balancer_pool_identity_model
-
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
- load_balancer_pool_member_prototype_model = {}
- load_balancer_pool_member_prototype_model['port'] = 80
- load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_prototype_model['weight'] = 50
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
- load_balancer_pool_session_persistence_prototype_model = {}
- load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
- load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
+ # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_prototype_model = {}
+ route_next_hop_prototype_model['address'] = '0.0.0.0'
# Set up parameter values
- load_balancer_id = 'testString'
- algorithm = 'least_connections'
- health_monitor = load_balancer_pool_health_monitor_prototype_model
- protocol = 'http'
- failsafe_policy = load_balancer_pool_failsafe_policy_prototype_model
- members = [load_balancer_pool_member_prototype_model]
- name = 'my-load-balancer-pool'
- proxy_protocol = 'disabled'
- session_persistence = load_balancer_pool_session_persistence_prototype_model
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
+ destination = '192.168.3.0/24'
+ zone = zone_identity_model
+ action = 'deliver'
+ advertise = False
+ name = 'my-vpc-routing-table-route'
+ next_hop = route_next_hop_prototype_model
+ priority = 1
# Invoke method
- response = _service.create_load_balancer_pool(
- load_balancer_id,
- algorithm,
- health_monitor,
- protocol,
- failsafe_policy=failsafe_policy,
- members=members,
+ response = _service.create_vpc_routing_table_route(
+ vpc_id,
+ routing_table_id,
+ destination,
+ zone,
+ action=action,
+ advertise=advertise,
name=name,
- proxy_protocol=proxy_protocol,
- session_persistence=session_persistence,
+ next_hop=next_hop,
+ priority=priority,
headers={},
)
@@ -50188,32 +50185,31 @@ def test_create_load_balancer_pool_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['algorithm'] == 'least_connections'
- assert req_body['health_monitor'] == load_balancer_pool_health_monitor_prototype_model
- assert req_body['protocol'] == 'http'
- assert req_body['failsafe_policy'] == load_balancer_pool_failsafe_policy_prototype_model
- assert req_body['members'] == [load_balancer_pool_member_prototype_model]
- assert req_body['name'] == 'my-load-balancer-pool'
- assert req_body['proxy_protocol'] == 'disabled'
- assert req_body['session_persistence'] == load_balancer_pool_session_persistence_prototype_model
+ assert req_body['destination'] == '192.168.3.0/24'
+ assert req_body['zone'] == zone_identity_model
+ assert req_body['action'] == 'deliver'
+ assert req_body['advertise'] == False
+ assert req_body['name'] == 'my-vpc-routing-table-route'
+ assert req_body['next_hop'] == route_next_hop_prototype_model
+ assert req_body['priority'] == 1
- def test_create_load_balancer_pool_all_params_with_retries(self):
- # Enable retries and run test_create_load_balancer_pool_all_params.
+ def test_create_vpc_routing_table_route_all_params_with_retries(self):
+ # Enable retries and run test_create_vpc_routing_table_route_all_params.
_service.enable_retries()
- self.test_create_load_balancer_pool_all_params()
+ self.test_create_vpc_routing_table_route_all_params()
- # Disable retries and run test_create_load_balancer_pool_all_params.
+ # Disable retries and run test_create_vpc_routing_table_route_all_params.
_service.disable_retries()
- self.test_create_load_balancer_pool_all_params()
+ self.test_create_vpc_routing_table_route_all_params()
@responses.activate
- def test_create_load_balancer_pool_value_error(self):
+ def test_create_vpc_routing_table_route_value_error(self):
"""
- test_create_load_balancer_pool_value_error()
+ test_create_vpc_routing_table_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools')
- mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50222,163 +50218,143 @@ def test_create_load_balancer_pool_value_error(self):
status=201,
)
- # Construct a dict representation of a LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype model
- load_balancer_pool_health_monitor_prototype_model = {}
- load_balancer_pool_health_monitor_prototype_model['delay'] = 5
- load_balancer_pool_health_monitor_prototype_model['max_retries'] = 2
- load_balancer_pool_health_monitor_prototype_model['port'] = 22
- load_balancer_pool_health_monitor_prototype_model['timeout'] = 2
- load_balancer_pool_health_monitor_prototype_model['type'] = 'tcp'
-
- # Construct a dict representation of a LoadBalancerPoolIdentityLoadBalancerPoolIdentityById model
- load_balancer_pool_identity_model = {}
- load_balancer_pool_identity_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPrototype model
- load_balancer_pool_failsafe_policy_prototype_model = {}
- load_balancer_pool_failsafe_policy_prototype_model['action'] = 'forward'
- load_balancer_pool_failsafe_policy_prototype_model['target'] = load_balancer_pool_identity_model
-
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
- load_balancer_pool_member_prototype_model = {}
- load_balancer_pool_member_prototype_model['port'] = 80
- load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_prototype_model['weight'] = 50
+ # Construct a dict representation of a ZoneIdentityByName model
+ zone_identity_model = {}
+ zone_identity_model['name'] = 'us-south-1'
- # Construct a dict representation of a LoadBalancerPoolSessionPersistencePrototype model
- load_balancer_pool_session_persistence_prototype_model = {}
- load_balancer_pool_session_persistence_prototype_model['cookie_name'] = 'my-cookie-name'
- load_balancer_pool_session_persistence_prototype_model['type'] = 'app_cookie'
+ # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_prototype_model = {}
+ route_next_hop_prototype_model['address'] = '0.0.0.0'
# Set up parameter values
- load_balancer_id = 'testString'
- algorithm = 'least_connections'
- health_monitor = load_balancer_pool_health_monitor_prototype_model
- protocol = 'http'
- failsafe_policy = load_balancer_pool_failsafe_policy_prototype_model
- members = [load_balancer_pool_member_prototype_model]
- name = 'my-load-balancer-pool'
- proxy_protocol = 'disabled'
- session_persistence = load_balancer_pool_session_persistence_prototype_model
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
+ destination = '192.168.3.0/24'
+ zone = zone_identity_model
+ action = 'deliver'
+ advertise = False
+ name = 'my-vpc-routing-table-route'
+ next_hop = route_next_hop_prototype_model
+ priority = 1
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "algorithm": algorithm,
- "health_monitor": health_monitor,
- "protocol": protocol,
+ "vpc_id": vpc_id,
+ "routing_table_id": routing_table_id,
+ "destination": destination,
+ "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_load_balancer_pool(**req_copy)
+ _service.create_vpc_routing_table_route(**req_copy)
- def test_create_load_balancer_pool_value_error_with_retries(self):
- # Enable retries and run test_create_load_balancer_pool_value_error.
+ def test_create_vpc_routing_table_route_value_error_with_retries(self):
+ # Enable retries and run test_create_vpc_routing_table_route_value_error.
_service.enable_retries()
- self.test_create_load_balancer_pool_value_error()
+ self.test_create_vpc_routing_table_route_value_error()
- # Disable retries and run test_create_load_balancer_pool_value_error.
+ # Disable retries and run test_create_vpc_routing_table_route_value_error.
_service.disable_retries()
- self.test_create_load_balancer_pool_value_error()
+ self.test_create_vpc_routing_table_route_value_error()
-class TestDeleteLoadBalancerPool:
+class TestDeleteVpcRoutingTableRoute:
"""
- Test Class for delete_load_balancer_pool
+ Test Class for delete_vpc_routing_table_route
"""
@responses.activate
- def test_delete_load_balancer_pool_all_params(self):
+ def test_delete_vpc_routing_table_route_all_params(self):
"""
- delete_load_balancer_pool()
+ delete_vpc_routing_table_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString')
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_load_balancer_pool(
- load_balancer_id,
+ response = _service.delete_vpc_routing_table_route(
+ vpc_id,
+ routing_table_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 204
- def test_delete_load_balancer_pool_all_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_pool_all_params.
+ def test_delete_vpc_routing_table_route_all_params_with_retries(self):
+ # Enable retries and run test_delete_vpc_routing_table_route_all_params.
_service.enable_retries()
- self.test_delete_load_balancer_pool_all_params()
+ self.test_delete_vpc_routing_table_route_all_params()
- # Disable retries and run test_delete_load_balancer_pool_all_params.
+ # Disable retries and run test_delete_vpc_routing_table_route_all_params.
_service.disable_retries()
- self.test_delete_load_balancer_pool_all_params()
+ self.test_delete_vpc_routing_table_route_all_params()
@responses.activate
- def test_delete_load_balancer_pool_value_error(self):
+ def test_delete_vpc_routing_table_route_value_error(self):
"""
- test_delete_load_balancer_pool_value_error()
+ test_delete_vpc_routing_table_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString')
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
responses.add(
responses.DELETE,
url,
- status=202,
+ status=204,
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_id,
+ "routing_table_id": routing_table_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_load_balancer_pool(**req_copy)
+ _service.delete_vpc_routing_table_route(**req_copy)
- def test_delete_load_balancer_pool_value_error_with_retries(self):
- # Enable retries and run test_delete_load_balancer_pool_value_error.
+ def test_delete_vpc_routing_table_route_value_error_with_retries(self):
+ # Enable retries and run test_delete_vpc_routing_table_route_value_error.
_service.enable_retries()
- self.test_delete_load_balancer_pool_value_error()
+ self.test_delete_vpc_routing_table_route_value_error()
- # Disable retries and run test_delete_load_balancer_pool_value_error.
+ # Disable retries and run test_delete_vpc_routing_table_route_value_error.
_service.disable_retries()
- self.test_delete_load_balancer_pool_value_error()
+ self.test_delete_vpc_routing_table_route_value_error()
-class TestGetLoadBalancerPool:
+class TestGetVpcRoutingTableRoute:
"""
- Test Class for get_load_balancer_pool
+ Test Class for get_vpc_routing_table_route
"""
@responses.activate
- def test_get_load_balancer_pool_all_params(self):
+ def test_get_vpc_routing_table_route_all_params(self):
"""
- get_load_balancer_pool()
+ get_vpc_routing_table_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString')
- mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50388,12 +50364,14 @@ def test_get_load_balancer_pool_all_params(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_load_balancer_pool(
- load_balancer_id,
+ response = _service.get_vpc_routing_table_route(
+ vpc_id,
+ routing_table_id,
id,
headers={},
)
@@ -50402,23 +50380,23 @@ def test_get_load_balancer_pool_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_get_load_balancer_pool_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_pool_all_params.
+ def test_get_vpc_routing_table_route_all_params_with_retries(self):
+ # Enable retries and run test_get_vpc_routing_table_route_all_params.
_service.enable_retries()
- self.test_get_load_balancer_pool_all_params()
+ self.test_get_vpc_routing_table_route_all_params()
- # Disable retries and run test_get_load_balancer_pool_all_params.
+ # Disable retries and run test_get_vpc_routing_table_route_all_params.
_service.disable_retries()
- self.test_get_load_balancer_pool_all_params()
+ self.test_get_vpc_routing_table_route_all_params()
@responses.activate
- def test_get_load_balancer_pool_value_error(self):
+ def test_get_vpc_routing_table_route_value_error(self):
"""
- test_get_load_balancer_pool_value_error()
+ test_get_vpc_routing_table_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString')
- mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50428,42 +50406,44 @@ def test_get_load_balancer_pool_value_error(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_id,
+ "routing_table_id": routing_table_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_load_balancer_pool(**req_copy)
+ _service.get_vpc_routing_table_route(**req_copy)
- def test_get_load_balancer_pool_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_pool_value_error.
+ def test_get_vpc_routing_table_route_value_error_with_retries(self):
+ # Enable retries and run test_get_vpc_routing_table_route_value_error.
_service.enable_retries()
- self.test_get_load_balancer_pool_value_error()
+ self.test_get_vpc_routing_table_route_value_error()
- # Disable retries and run test_get_load_balancer_pool_value_error.
+ # Disable retries and run test_get_vpc_routing_table_route_value_error.
_service.disable_retries()
- self.test_get_load_balancer_pool_value_error()
+ self.test_get_vpc_routing_table_route_value_error()
-class TestUpdateLoadBalancerPool:
+class TestUpdateVpcRoutingTableRoute:
"""
- Test Class for update_load_balancer_pool
+ Test Class for update_vpc_routing_table_route
"""
@responses.activate
- def test_update_load_balancer_pool_all_params(self):
+ def test_update_vpc_routing_table_route_all_params(self):
"""
- update_load_balancer_pool()
+ update_vpc_routing_table_route()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString')
- mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50472,49 +50452,29 @@ def test_update_load_balancer_pool_all_params(self):
status=200,
)
- # Construct a dict representation of a LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityById model
- load_balancer_pool_failsafe_policy_target_patch_model = {}
- load_balancer_pool_failsafe_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPatch model
- load_balancer_pool_failsafe_policy_patch_model = {}
- load_balancer_pool_failsafe_policy_patch_model['action'] = 'forward'
- load_balancer_pool_failsafe_policy_patch_model['target'] = load_balancer_pool_failsafe_policy_target_patch_model
-
- # Construct a dict representation of a LoadBalancerPoolHealthMonitorPatch model
- load_balancer_pool_health_monitor_patch_model = {}
- load_balancer_pool_health_monitor_patch_model['delay'] = 5
- load_balancer_pool_health_monitor_patch_model['max_retries'] = 2
- load_balancer_pool_health_monitor_patch_model['port'] = 22
- load_balancer_pool_health_monitor_patch_model['timeout'] = 2
- load_balancer_pool_health_monitor_patch_model['type'] = 'http'
- load_balancer_pool_health_monitor_patch_model['url_path'] = '/'
-
- # Construct a dict representation of a LoadBalancerPoolSessionPersistencePatch model
- load_balancer_pool_session_persistence_patch_model = {}
- load_balancer_pool_session_persistence_patch_model['cookie_name'] = 'my-cookie-name'
- load_balancer_pool_session_persistence_patch_model['type'] = 'app_cookie'
+ # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_patch_model = {}
+ route_next_hop_patch_model['address'] = '0.0.0.0'
- # Construct a dict representation of a LoadBalancerPoolPatch model
- load_balancer_pool_patch_model = {}
- load_balancer_pool_patch_model['algorithm'] = 'weighted_round_robin'
- load_balancer_pool_patch_model['failsafe_policy'] = load_balancer_pool_failsafe_policy_patch_model
- load_balancer_pool_patch_model['health_monitor'] = load_balancer_pool_health_monitor_patch_model
- load_balancer_pool_patch_model['name'] = 'my-load-balancer-pool'
- load_balancer_pool_patch_model['protocol'] = 'http'
- load_balancer_pool_patch_model['proxy_protocol'] = 'disabled'
- load_balancer_pool_patch_model['session_persistence'] = load_balancer_pool_session_persistence_patch_model
+ # Construct a dict representation of a RoutePatch model
+ route_patch_model = {}
+ route_patch_model['advertise'] = False
+ route_patch_model['name'] = 'my-vpc-routing-table-route'
+ route_patch_model['next_hop'] = route_next_hop_patch_model
+ route_patch_model['priority'] = 1
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
id = 'testString'
- load_balancer_pool_patch = load_balancer_pool_patch_model
+ route_patch = route_patch_model
# Invoke method
- response = _service.update_load_balancer_pool(
- load_balancer_id,
+ response = _service.update_vpc_routing_table_route(
+ vpc_id,
+ routing_table_id,
id,
- load_balancer_pool_patch,
+ route_patch,
headers={},
)
@@ -50523,25 +50483,25 @@ def test_update_load_balancer_pool_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 == load_balancer_pool_patch
+ assert req_body == route_patch
- def test_update_load_balancer_pool_all_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_pool_all_params.
+ def test_update_vpc_routing_table_route_all_params_with_retries(self):
+ # Enable retries and run test_update_vpc_routing_table_route_all_params.
_service.enable_retries()
- self.test_update_load_balancer_pool_all_params()
+ self.test_update_vpc_routing_table_route_all_params()
- # Disable retries and run test_update_load_balancer_pool_all_params.
+ # Disable retries and run test_update_vpc_routing_table_route_all_params.
_service.disable_retries()
- self.test_update_load_balancer_pool_all_params()
+ self.test_update_vpc_routing_table_route_all_params()
@responses.activate
- def test_update_load_balancer_pool_value_error(self):
+ def test_update_vpc_routing_table_route_value_error(self):
"""
- test_update_load_balancer_pool_value_error()
+ test_update_vpc_routing_table_route_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString')
- mock_response = '{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "failsafe_policy": {"action": "forward", "healthy_member_threshold_count": 0, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}}, "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "tcp"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004", "id": "r006-70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "id": "r006-7b3ac170-01f3-43d6-87ec-f0ed11ed3f60", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}'
+ url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString')
+ mock_response = '{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840/routes/r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "id": "r006-67b7b783-9a0f-41c1-a7f7-eccff87fb8f1", "lifecycle_state": "stable", "name": "my-vpc-routing-table-route", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "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,
@@ -50550,78 +50510,115 @@ def test_update_load_balancer_pool_value_error(self):
status=200,
)
- # Construct a dict representation of a LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityById model
- load_balancer_pool_failsafe_policy_target_patch_model = {}
- load_balancer_pool_failsafe_policy_target_patch_model['id'] = 'r006-70294e14-4e61-11e8-bcf4-0242ac110004'
-
- # Construct a dict representation of a LoadBalancerPoolFailsafePolicyPatch model
- load_balancer_pool_failsafe_policy_patch_model = {}
- load_balancer_pool_failsafe_policy_patch_model['action'] = 'forward'
- load_balancer_pool_failsafe_policy_patch_model['target'] = load_balancer_pool_failsafe_policy_target_patch_model
-
- # Construct a dict representation of a LoadBalancerPoolHealthMonitorPatch model
- load_balancer_pool_health_monitor_patch_model = {}
- load_balancer_pool_health_monitor_patch_model['delay'] = 5
- load_balancer_pool_health_monitor_patch_model['max_retries'] = 2
- load_balancer_pool_health_monitor_patch_model['port'] = 22
- load_balancer_pool_health_monitor_patch_model['timeout'] = 2
- load_balancer_pool_health_monitor_patch_model['type'] = 'http'
- load_balancer_pool_health_monitor_patch_model['url_path'] = '/'
-
- # Construct a dict representation of a LoadBalancerPoolSessionPersistencePatch model
- load_balancer_pool_session_persistence_patch_model = {}
- load_balancer_pool_session_persistence_patch_model['cookie_name'] = 'my-cookie-name'
- load_balancer_pool_session_persistence_patch_model['type'] = 'app_cookie'
+ # Construct a dict representation of a RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP model
+ route_next_hop_patch_model = {}
+ route_next_hop_patch_model['address'] = '0.0.0.0'
- # Construct a dict representation of a LoadBalancerPoolPatch model
- load_balancer_pool_patch_model = {}
- load_balancer_pool_patch_model['algorithm'] = 'weighted_round_robin'
- load_balancer_pool_patch_model['failsafe_policy'] = load_balancer_pool_failsafe_policy_patch_model
- load_balancer_pool_patch_model['health_monitor'] = load_balancer_pool_health_monitor_patch_model
- load_balancer_pool_patch_model['name'] = 'my-load-balancer-pool'
- load_balancer_pool_patch_model['protocol'] = 'http'
- load_balancer_pool_patch_model['proxy_protocol'] = 'disabled'
- load_balancer_pool_patch_model['session_persistence'] = load_balancer_pool_session_persistence_patch_model
+ # Construct a dict representation of a RoutePatch model
+ route_patch_model = {}
+ route_patch_model['advertise'] = False
+ route_patch_model['name'] = 'my-vpc-routing-table-route'
+ route_patch_model['next_hop'] = route_next_hop_patch_model
+ route_patch_model['priority'] = 1
# Set up parameter values
- load_balancer_id = 'testString'
+ vpc_id = 'testString'
+ routing_table_id = 'testString'
id = 'testString'
- load_balancer_pool_patch = load_balancer_pool_patch_model
+ route_patch = route_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
+ "vpc_id": vpc_id,
+ "routing_table_id": routing_table_id,
"id": id,
- "load_balancer_pool_patch": load_balancer_pool_patch,
+ "route_patch": 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.update_load_balancer_pool(**req_copy)
+ _service.update_vpc_routing_table_route(**req_copy)
- def test_update_load_balancer_pool_value_error_with_retries(self):
- # Enable retries and run test_update_load_balancer_pool_value_error.
+ def test_update_vpc_routing_table_route_value_error_with_retries(self):
+ # Enable retries and run test_update_vpc_routing_table_route_value_error.
_service.enable_retries()
- self.test_update_load_balancer_pool_value_error()
+ self.test_update_vpc_routing_table_route_value_error()
- # Disable retries and run test_update_load_balancer_pool_value_error.
+ # Disable retries and run test_update_vpc_routing_table_route_value_error.
_service.disable_retries()
- self.test_update_load_balancer_pool_value_error()
+ self.test_update_vpc_routing_table_route_value_error()
-class TestListLoadBalancerPoolMembers:
+# endregion
+##############################################################################
+# End of Service: VPCs
+##############################################################################
+
+##############################################################################
+# Start of Service: VPNGateways
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_load_balancer_pool_members
+ 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 TestListIkePolicies:
+ """
+ Test Class for list_ike_policies
"""
@responses.activate
- def test_list_load_balancer_pool_members_all_params(self):
+ def test_list_ike_policies_all_params(self):
"""
- list_load_balancer_pool_members()
+ list_ike_policies()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members')
- mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
+ url = preprocess_url('/ike_policies')
+ mock_response = '{"first": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -50631,37 +50628,42 @@ def test_list_load_balancer_pool_members_all_params(self):
)
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.list_load_balancer_pool_members(
- load_balancer_id,
- pool_id,
+ response = _service.list_ike_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_load_balancer_pool_members_all_params_with_retries(self):
- # Enable retries and run test_list_load_balancer_pool_members_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_load_balancer_pool_members_all_params()
+ self.test_list_ike_policies_all_params()
- # Disable retries and run test_list_load_balancer_pool_members_all_params.
+ # Disable retries and run test_list_ike_policies_all_params.
_service.disable_retries()
- self.test_list_load_balancer_pool_members_all_params()
+ self.test_list_ike_policies_all_params()
@responses.activate
- def test_list_load_balancer_pool_members_value_error(self):
+ def test_list_ike_policies_required_params(self):
"""
- test_list_load_balancer_pool_members_value_error()
+ test_list_ike_policies_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members')
- mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
+ url = preprocess_url('/ike_policies')
+ mock_response = '{"first": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -50670,43 +50672,138 @@ def test_list_load_balancer_pool_members_value_error(self):
status=200,
)
- # Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
+ # Invoke method
+ response = _service.list_ike_policies()
+
+ # 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.
+ _service.enable_retries()
+ self.test_list_ike_policies_required_params()
+
+ # Disable retries and run test_list_ike_policies_required_params.
+ _service.disable_retries()
+ self.test_list_ike_policies_required_params()
+
+ @responses.activate
+ def test_list_ike_policies_value_error(self):
+ """
+ test_list_ike_policies_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/ike_policies')
+ mock_response = '{"first": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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": "href"}, "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 = {
- "load_balancer_id": load_balancer_id,
- "pool_id": pool_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_load_balancer_pool_members(**req_copy)
+ _service.list_ike_policies(**req_copy)
- def test_list_load_balancer_pool_members_value_error_with_retries(self):
- # Enable retries and run test_list_load_balancer_pool_members_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_load_balancer_pool_members_value_error()
+ self.test_list_ike_policies_value_error()
- # Disable retries and run test_list_load_balancer_pool_members_value_error.
+ # Disable retries and run test_list_ike_policies_value_error.
_service.disable_retries()
- self.test_list_load_balancer_pool_members_value_error()
+ self.test_list_ike_policies_value_error()
+
+ @responses.activate
+ def test_list_ike_policies_with_pager_get_next(self):
+ """
+ test_list_ike_policies_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/ike_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
+ mock_response2 = '{"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = IkePoliciesPager(
+ client=_service,
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
-class TestCreateLoadBalancerPoolMember:
+ @responses.activate
+ def test_list_ike_policies_with_pager_get_all(self):
+ """
+ test_list_ike_policies_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/ike_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
+ mock_response2 = '{"total_count":2,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = IkePoliciesPager(
+ client=_service,
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateIkePolicy:
"""
- Test Class for create_load_balancer_pool_member
+ Test Class for create_ike_policy
"""
@responses.activate
- def test_create_load_balancer_pool_member_all_params(self):
+ def test_create_ike_policy_all_params(self):
"""
- create_load_balancer_pool_member()
+ create_ike_policy()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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,
@@ -50715,24 +50812,28 @@ def test_create_load_balancer_pool_member_all_params(self):
status=201,
)
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
- port = 80
- target = load_balancer_pool_member_target_prototype_model
- weight = 50
+ authentication_algorithm = 'sha256'
+ dh_group = 14
+ encryption_algorithm = 'aes128'
+ ike_version = 1
+ key_lifetime = 28800
+ name = 'my-ike-policy'
+ resource_group = resource_group_identity_model
# Invoke method
- response = _service.create_load_balancer_pool_member(
- load_balancer_id,
- pool_id,
- port,
- target,
- weight=weight,
+ response = _service.create_ike_policy(
+ authentication_algorithm,
+ dh_group,
+ encryption_algorithm,
+ ike_version,
+ key_lifetime=key_lifetime,
+ name=name,
+ resource_group=resource_group,
headers={},
)
@@ -50741,27 +50842,31 @@ def test_create_load_balancer_pool_member_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['port'] == 80
- assert req_body['target'] == load_balancer_pool_member_target_prototype_model
- assert req_body['weight'] == 50
+ assert req_body['authentication_algorithm'] == 'sha256'
+ 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
- def test_create_load_balancer_pool_member_all_params_with_retries(self):
- # Enable retries and run test_create_load_balancer_pool_member_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_load_balancer_pool_member_all_params()
+ self.test_create_ike_policy_all_params()
- # Disable retries and run test_create_load_balancer_pool_member_all_params.
+ # Disable retries and run test_create_ike_policy_all_params.
_service.disable_retries()
- self.test_create_load_balancer_pool_member_all_params()
+ self.test_create_ike_policy_all_params()
@responses.activate
- def test_create_load_balancer_pool_member_value_error(self):
+ def test_create_ike_policy_value_error(self):
"""
- test_create_load_balancer_pool_member_value_error()
+ test_create_ike_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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,
@@ -50770,509 +50875,515 @@ def test_create_load_balancer_pool_member_value_error(self):
status=201,
)
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+ # Construct a dict representation of a ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
- port = 80
- target = load_balancer_pool_member_target_prototype_model
- weight = 50
+ authentication_algorithm = 'sha256'
+ dh_group = 14
+ encryption_algorithm = 'aes128'
+ ike_version = 1
+ key_lifetime = 28800
+ name = 'my-ike-policy'
+ resource_group = resource_group_identity_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "pool_id": pool_id,
- "port": port,
- "target": target,
+ "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_load_balancer_pool_member(**req_copy)
+ _service.create_ike_policy(**req_copy)
- def test_create_load_balancer_pool_member_value_error_with_retries(self):
- # Enable retries and run test_create_load_balancer_pool_member_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_load_balancer_pool_member_value_error()
+ self.test_create_ike_policy_value_error()
- # Disable retries and run test_create_load_balancer_pool_member_value_error.
+ # Disable retries and run test_create_ike_policy_value_error.
_service.disable_retries()
- self.test_create_load_balancer_pool_member_value_error()
+ self.test_create_ike_policy_value_error()
-class TestReplaceLoadBalancerPoolMembers:
+class TestDeleteIkePolicy:
"""
- Test Class for replace_load_balancer_pool_members
+ Test Class for delete_ike_policy
"""
@responses.activate
- def test_replace_load_balancer_pool_members_all_params(self):
+ def test_delete_ike_policy_all_params(self):
"""
- replace_load_balancer_pool_members()
+ delete_ike_policy()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members')
- mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
+ url = preprocess_url('/ike_policies/testString')
responses.add(
- responses.PUT,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
- load_balancer_pool_member_prototype_model = {}
- load_balancer_pool_member_prototype_model['port'] = 80
- load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_prototype_model['weight'] = 50
-
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
- members = [load_balancer_pool_member_prototype_model]
+ id = 'testString'
# Invoke method
- response = _service.replace_load_balancer_pool_members(
- load_balancer_id,
- pool_id,
- members,
+ response = _service.delete_ike_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['members'] == [load_balancer_pool_member_prototype_model]
+ assert response.status_code == 204
- def test_replace_load_balancer_pool_members_all_params_with_retries(self):
- # Enable retries and run test_replace_load_balancer_pool_members_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_replace_load_balancer_pool_members_all_params()
+ self.test_delete_ike_policy_all_params()
- # Disable retries and run test_replace_load_balancer_pool_members_all_params.
+ # Disable retries and run test_delete_ike_policy_all_params.
_service.disable_retries()
- self.test_replace_load_balancer_pool_members_all_params()
+ self.test_delete_ike_policy_all_params()
@responses.activate
- def test_replace_load_balancer_pool_members_value_error(self):
+ def test_delete_ike_policy_value_error(self):
"""
- test_replace_load_balancer_pool_members_value_error()
+ test_delete_ike_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members')
- mock_response = '{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}'
+ url = preprocess_url('/ike_policies/testString')
responses.add(
- responses.PUT,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPrototype model
- load_balancer_pool_member_prototype_model = {}
- load_balancer_pool_member_prototype_model['port'] = 80
- load_balancer_pool_member_prototype_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_prototype_model['weight'] = 50
-
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
- members = [load_balancer_pool_member_prototype_model]
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "pool_id": pool_id,
- "members": members,
+ "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.replace_load_balancer_pool_members(**req_copy)
+ _service.delete_ike_policy(**req_copy)
- def test_replace_load_balancer_pool_members_value_error_with_retries(self):
- # Enable retries and run test_replace_load_balancer_pool_members_value_error.
+ 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_replace_load_balancer_pool_members_value_error()
+ self.test_delete_ike_policy_value_error()
- # Disable retries and run test_replace_load_balancer_pool_members_value_error.
+ # Disable retries and run test_delete_ike_policy_value_error.
_service.disable_retries()
- self.test_replace_load_balancer_pool_members_value_error()
+ self.test_delete_ike_policy_value_error()
-class TestDeleteLoadBalancerPoolMember:
+class TestGetIkePolicy:
"""
- Test Class for delete_load_balancer_pool_member
+ Test Class for get_ike_policy
"""
@responses.activate
- def test_delete_load_balancer_pool_member_all_params(self):
+ def test_get_ike_policy_all_params(self):
"""
- delete_load_balancer_pool_member()
+ get_ike_policy()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_load_balancer_pool_member(
- load_balancer_id,
- pool_id,
+ response = _service.get_ike_policy(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 202
+ assert response.status_code == 200
- def test_delete_load_balancer_pool_member_all_params_with_retries(self):
- # Enable retries and run test_delete_load_balancer_pool_member_all_params.
+ 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_delete_load_balancer_pool_member_all_params()
+ self.test_get_ike_policy_all_params()
- # Disable retries and run test_delete_load_balancer_pool_member_all_params.
+ # Disable retries and run test_get_ike_policy_all_params.
_service.disable_retries()
- self.test_delete_load_balancer_pool_member_all_params()
+ self.test_get_ike_policy_all_params()
@responses.activate
- def test_delete_load_balancer_pool_member_value_error(self):
+ def test_get_ike_policy_value_error(self):
"""
- test_delete_load_balancer_pool_member_value_error()
+ test_get_ike_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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.DELETE,
+ responses.GET,
url,
- status=202,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "pool_id": pool_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_load_balancer_pool_member(**req_copy)
+ _service.get_ike_policy(**req_copy)
- def test_delete_load_balancer_pool_member_value_error_with_retries(self):
- # Enable retries and run test_delete_load_balancer_pool_member_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_load_balancer_pool_member_value_error()
+ self.test_get_ike_policy_value_error()
- # Disable retries and run test_delete_load_balancer_pool_member_value_error.
+ # Disable retries and run test_get_ike_policy_value_error.
_service.disable_retries()
- self.test_delete_load_balancer_pool_member_value_error()
+ self.test_get_ike_policy_value_error()
-class TestGetLoadBalancerPoolMember:
+class TestUpdateIkePolicy:
"""
- Test Class for get_load_balancer_pool_member
+ Test Class for update_ike_policy
"""
@responses.activate
- def test_get_load_balancer_pool_member_all_params(self):
+ def test_update_ike_policy_all_params(self):
"""
- get_load_balancer_pool_member()
+ update_ike_policy()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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,
+ 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'] = 'sha256'
+ 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'] = 86400
+ ike_policy_patch_model['name'] = 'my-ike-policy'
+
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
id = 'testString'
+ ike_policy_patch = ike_policy_patch_model
# Invoke method
- response = _service.get_load_balancer_pool_member(
- load_balancer_id,
- pool_id,
+ 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_load_balancer_pool_member_all_params_with_retries(self):
- # Enable retries and run test_get_load_balancer_pool_member_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_load_balancer_pool_member_all_params()
+ self.test_update_ike_policy_all_params()
- # Disable retries and run test_get_load_balancer_pool_member_all_params.
+ # Disable retries and run test_update_ike_policy_all_params.
_service.disable_retries()
- self.test_get_load_balancer_pool_member_all_params()
+ self.test_update_ike_policy_all_params()
@responses.activate
- def test_get_load_balancer_pool_member_value_error(self):
+ def test_update_ike_policy_value_error(self):
"""
- test_get_load_balancer_pool_member_value_error()
+ test_update_ike_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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,
+ 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'] = 'sha256'
+ 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'] = 86400
+ ike_policy_patch_model['name'] = 'my-ike-policy'
+
# Set up parameter values
- load_balancer_id = 'testString'
- pool_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 = {
- "load_balancer_id": load_balancer_id,
- "pool_id": pool_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.get_load_balancer_pool_member(**req_copy)
+ _service.update_ike_policy(**req_copy)
- def test_get_load_balancer_pool_member_value_error_with_retries(self):
- # Enable retries and run test_get_load_balancer_pool_member_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_load_balancer_pool_member_value_error()
+ self.test_update_ike_policy_value_error()
- # Disable retries and run test_get_load_balancer_pool_member_value_error.
+ # Disable retries and run test_update_ike_policy_value_error.
_service.disable_retries()
- self.test_get_load_balancer_pool_member_value_error()
+ self.test_update_ike_policy_value_error()
-class TestUpdateLoadBalancerPoolMember:
+class TestListIkePolicyConnections:
"""
- Test Class for update_load_balancer_pool_member
+ Test Class for list_ike_policy_connections
"""
@responses.activate
- def test_update_load_balancer_pool_member_all_params(self):
+ def test_list_ike_policy_connections_all_params(self):
"""
- update_load_balancer_pool_member()
+ list_ike_policy_connections()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
-
- # Construct a dict representation of a LoadBalancerPoolMemberPatch model
- load_balancer_pool_member_patch_model = {}
- load_balancer_pool_member_patch_model['port'] = 80
- load_balancer_pool_member_patch_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_patch_model['weight'] = 99
-
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
id = 'testString'
- load_balancer_pool_member_patch = load_balancer_pool_member_patch_model
+ start = 'testString'
+ limit = 50
# Invoke method
- response = _service.update_load_balancer_pool_member(
- load_balancer_id,
- pool_id,
+ response = _service.list_ike_policy_connections(
id,
- load_balancer_pool_member_patch,
+ start=start,
+ limit=limit,
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 == load_balancer_pool_member_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
- def test_update_load_balancer_pool_member_all_params_with_retries(self):
- # Enable retries and run test_update_load_balancer_pool_member_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_load_balancer_pool_member_all_params()
+ self.test_list_ike_policy_connections_all_params()
- # Disable retries and run test_update_load_balancer_pool_member_all_params.
+ # Disable retries and run test_list_ike_policy_connections_all_params.
_service.disable_retries()
- self.test_update_load_balancer_pool_member_all_params()
+ self.test_list_ike_policy_connections_all_params()
@responses.activate
- def test_update_load_balancer_pool_member_value_error(self):
+ def test_list_ike_policy_connections_required_params(self):
"""
- test_update_load_balancer_pool_member_value_error()
+ test_list_ike_policy_connections_required_params()
"""
# Set up mock
- url = preprocess_url('/load_balancers/testString/pools/testString/members/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/r006-70294e14-4e61-11e8-bcf4-0242ac110004/members/r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "id": "r006-4a4b345f-cf6b-4326-8202-6d8229e9833a", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityById model
- load_balancer_pool_member_target_prototype_model = {}
- load_balancer_pool_member_target_prototype_model['id'] = '0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0'
+ # Set up parameter values
+ id = 'testString'
- # Construct a dict representation of a LoadBalancerPoolMemberPatch model
- load_balancer_pool_member_patch_model = {}
- load_balancer_pool_member_patch_model['port'] = 80
- load_balancer_pool_member_patch_model['target'] = load_balancer_pool_member_target_prototype_model
- load_balancer_pool_member_patch_model['weight'] = 99
+ # Invoke method
+ response = _service.list_ike_policy_connections(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ def test_list_ike_policy_connections_required_params_with_retries(self):
+ # Enable retries and run test_list_ike_policy_connections_required_params.
+ _service.enable_retries()
+ self.test_list_ike_policy_connections_required_params()
+
+ # Disable retries and run test_list_ike_policy_connections_required_params.
+ _service.disable_retries()
+ self.test_list_ike_policy_connections_required_params()
+
+ @responses.activate
+ def test_list_ike_policy_connections_value_error(self):
+ """
+ test_list_ike_policy_connections_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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
# Set up parameter values
- load_balancer_id = 'testString'
- pool_id = 'testString'
id = 'testString'
- load_balancer_pool_member_patch = load_balancer_pool_member_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer_id": load_balancer_id,
- "pool_id": pool_id,
"id": id,
- "load_balancer_pool_member_patch": load_balancer_pool_member_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_load_balancer_pool_member(**req_copy)
+ _service.list_ike_policy_connections(**req_copy)
- def test_update_load_balancer_pool_member_value_error_with_retries(self):
- # Enable retries and run test_update_load_balancer_pool_member_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_load_balancer_pool_member_value_error()
+ self.test_list_ike_policy_connections_value_error()
- # Disable retries and run test_update_load_balancer_pool_member_value_error.
+ # Disable retries and run test_list_ike_policy_connections_value_error.
_service.disable_retries()
- self.test_update_load_balancer_pool_member_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: LoadBalancers
-##############################################################################
-
-##############################################################################
-# Start of Service: EndpointGateways
-##############################################################################
-# region
-
-
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ self.test_list_ike_policy_connections_value_error()
- def test_new_instance(self):
+ @responses.activate
+ def test_list_ike_policy_connections_with_pager_get_next(self):
"""
- new_instance()
+ test_list_ike_policy_connections_with_pager_get_next()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
-
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up a two-page mock response
+ url = preprocess_url('/ike_policies/testString/connections')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- 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()
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = IkePolicyConnectionsPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
- def test_new_instance_required_param_none(self):
+ @responses.activate
+ def test_list_ike_policy_connections_with_pager_get_all(self):
"""
- new_instance_required_param_none()
+ test_list_ike_policy_connections_with_pager_get_all()
"""
- with pytest.raises(ValueError, match='version must be provided'):
- service = VpcV1.new_instance(
- version=None,
- )
+ # Set up a two-page mock response
+ url = preprocess_url('/ike_policies/testString/connections')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+ # Exercise the pager class for this operation
+ pager = IkePolicyConnectionsPager(
+ client=_service,
+ id='testString',
+ limit=10,
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestListEndpointGateways:
+
+class TestListIpsecPolicies:
"""
- Test Class for list_endpoint_gateways
+ Test Class for list_ipsec_policies
"""
@responses.activate
- def test_list_endpoint_gateways_all_params(self):
+ def test_list_ipsec_policies_all_params(self):
"""
- list_endpoint_gateways()
+ list_ipsec_policies()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways')
- mock_response = '{"endpoint_gateways": [{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/ipsec_policies')
+ mock_response = '{"first": {"href": "href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -51282,27 +51393,13 @@ def test_list_endpoint_gateways_all_params(self):
)
# Set up parameter values
- name = 'my-name'
start = 'testString'
limit = 50
- resource_group_id = 'testString'
- lifecycle_state = ['stable']
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
- allow_dns_resolution_binding = True
# Invoke method
- response = _service.list_endpoint_gateways(
- name=name,
+ response = _service.list_ipsec_policies(
start=start,
limit=limit,
- resource_group_id=resource_group_id,
- lifecycle_state=lifecycle_state,
- vpc_id=vpc_id,
- vpc_crn=vpc_crn,
- vpc_name=vpc_name,
- allow_dns_resolution_binding=allow_dns_resolution_binding,
headers={},
)
@@ -51312,33 +51409,26 @@ def test_list_endpoint_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 'lifecycle_state={}'.format(','.join(lifecycle_state)) 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 'allow_dns_resolution_binding={}'.format('true' if allow_dns_resolution_binding else 'false') in query_string
- def test_list_endpoint_gateways_all_params_with_retries(self):
- # Enable retries and run test_list_endpoint_gateways_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_endpoint_gateways_all_params()
+ self.test_list_ipsec_policies_all_params()
- # Disable retries and run test_list_endpoint_gateways_all_params.
+ # Disable retries and run test_list_ipsec_policies_all_params.
_service.disable_retries()
- self.test_list_endpoint_gateways_all_params()
+ self.test_list_ipsec_policies_all_params()
@responses.activate
- def test_list_endpoint_gateways_required_params(self):
+ def test_list_ipsec_policies_required_params(self):
"""
- test_list_endpoint_gateways_required_params()
+ test_list_ipsec_policies_required_params()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways')
- mock_response = '{"endpoint_gateways": [{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/ipsec_policies')
+ mock_response = '{"first": {"href": "href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -51348,29 +51438,29 @@ def test_list_endpoint_gateways_required_params(self):
)
# Invoke method
- response = _service.list_endpoint_gateways()
+ response = _service.list_ipsec_policies()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_endpoint_gateways_required_params_with_retries(self):
- # Enable retries and run test_list_endpoint_gateways_required_params.
+ 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_endpoint_gateways_required_params()
+ self.test_list_ipsec_policies_required_params()
- # Disable retries and run test_list_endpoint_gateways_required_params.
+ # Disable retries and run test_list_ipsec_policies_required_params.
_service.disable_retries()
- self.test_list_endpoint_gateways_required_params()
+ self.test_list_ipsec_policies_required_params()
@responses.activate
- def test_list_endpoint_gateways_value_error(self):
+ def test_list_ipsec_policies_value_error(self):
"""
- test_list_endpoint_gateways_value_error()
+ test_list_ipsec_policies_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways')
- mock_response = '{"endpoint_gateways": [{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/ipsec_policies')
+ mock_response = '{"first": {"href": "href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -51385,26 +51475,26 @@ def test_list_endpoint_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_endpoint_gateways(**req_copy)
+ _service.list_ipsec_policies(**req_copy)
- def test_list_endpoint_gateways_value_error_with_retries(self):
- # Enable retries and run test_list_endpoint_gateways_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_endpoint_gateways_value_error()
+ self.test_list_ipsec_policies_value_error()
- # Disable retries and run test_list_endpoint_gateways_value_error.
+ # Disable retries and run test_list_ipsec_policies_value_error.
_service.disable_retries()
- self.test_list_endpoint_gateways_value_error()
+ self.test_list_ipsec_policies_value_error()
@responses.activate
- def test_list_endpoint_gateways_with_pager_get_next(self):
+ def test_list_ipsec_policies_with_pager_get_next(self):
"""
- test_list_endpoint_gateways_with_pager_get_next()
+ test_list_ipsec_policies_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/endpoint_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/ipsec_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -51422,16 +51512,9 @@ def test_list_endpoint_gateways_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = EndpointGatewaysPager(
+ pager = IpsecPoliciesPager(
client=_service,
- name='my-name',
limit=10,
- resource_group_id='testString',
- lifecycle_state=['stable'],
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- allow_dns_resolution_binding=True,
)
while pager.has_next():
next_page = pager.get_next()
@@ -51440,14 +51523,14 @@ def test_list_endpoint_gateways_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_endpoint_gateways_with_pager_get_all(self):
+ def test_list_ipsec_policies_with_pager_get_all(self):
"""
- test_list_endpoint_gateways_with_pager_get_all()
+ test_list_ipsec_policies_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/endpoint_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
- mock_response2 = '{"endpoint_gateways":[{"allow_dns_resolution_binding":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_reasons":[{"code":"dns_resolution_binding_pending","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-endpoint-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"endpoint_gateway","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"service_endpoint":"my-cloudant-instance.appdomain.cloud","service_endpoints":["my-cloudant-instance.appdomain.cloud"],"target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","name":"my-private-path-service-gateway","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"private_path_service_gateway"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ url = preprocess_url('/ipsec_policies')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"ipsec_policies":[{"authentication_algorithm":"disabled","connections":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","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"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -51464,35 +51547,28 @@ def test_list_endpoint_gateways_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = EndpointGatewaysPager(
+ pager = IpsecPoliciesPager(
client=_service,
- name='my-name',
limit=10,
- resource_group_id='testString',
- lifecycle_state=['stable'],
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- allow_dns_resolution_binding=True,
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestCreateEndpointGateway:
+class TestCreateIpsecPolicy:
"""
- Test Class for create_endpoint_gateway
+ Test Class for create_ipsec_policy
"""
@responses.activate
- def test_create_endpoint_gateway_all_params(self):
+ def test_create_ipsec_policy_all_params(self):
"""
- create_endpoint_gateway()
+ create_ipsec_policy()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways')
- mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/ipsec_policies')
+ mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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,
@@ -51501,45 +51577,26 @@ def test_create_endpoint_gateway_all_params(self):
status=201,
)
- # Construct a dict representation of a EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype model
- endpoint_gateway_target_prototype_model = {}
- endpoint_gateway_target_prototype_model['name'] = 'ibm-ntp-server'
- endpoint_gateway_target_prototype_model['resource_type'] = 'provider_infrastructure_service'
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a EndpointGatewayReservedIPReservedIPIdentityById model
- endpoint_gateway_reserved_ip_model = {}
- endpoint_gateway_reserved_ip_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
-
# 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
-
# Set up parameter values
- target = endpoint_gateway_target_prototype_model
- vpc = vpc_identity_model
- allow_dns_resolution_binding = True
- ips = [endpoint_gateway_reserved_ip_model]
- name = 'testString'
+ authentication_algorithm = 'disabled'
+ encryption_algorithm = 'aes128'
+ pfs = 'disabled'
+ key_lifetime = 3600
+ name = 'my-ipsec-policy'
resource_group = resource_group_identity_model
- security_groups = [security_group_identity_model]
# Invoke method
- response = _service.create_endpoint_gateway(
- target,
- vpc,
- allow_dns_resolution_binding=allow_dns_resolution_binding,
- ips=ips,
+ response = _service.create_ipsec_policy(
+ authentication_algorithm,
+ encryption_algorithm,
+ pfs,
+ key_lifetime=key_lifetime,
name=name,
resource_group=resource_group,
- security_groups=security_groups,
headers={},
)
@@ -51548,102 +51605,344 @@ def test_create_endpoint_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['target'] == endpoint_gateway_target_prototype_model
- assert req_body['vpc'] == vpc_identity_model
- assert req_body['allow_dns_resolution_binding'] == True
- assert req_body['ips'] == [endpoint_gateway_reserved_ip_model]
- assert req_body['name'] == 'testString'
+ assert req_body['authentication_algorithm'] == 'disabled'
+ 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 req_body['security_groups'] == [security_group_identity_model]
- def test_create_endpoint_gateway_all_params_with_retries(self):
- # Enable retries and run test_create_endpoint_gateway_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_endpoint_gateway_all_params()
+ self.test_create_ipsec_policy_all_params()
- # Disable retries and run test_create_endpoint_gateway_all_params.
+ # Disable retries and run test_create_ipsec_policy_all_params.
+ _service.disable_retries()
+ self.test_create_ipsec_policy_all_params()
+
+ @responses.activate
+ def test_create_ipsec_policy_value_error(self):
+ """
+ test_create_ipsec_policy_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/ipsec_policies')
+ mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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 ResourceGroupIdentityById model
+ resource_group_identity_model = {}
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ # Set up parameter values
+ authentication_algorithm = 'disabled'
+ 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 = {
+ "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_ipsec_policy(**req_copy)
+
+ 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_ipsec_policy_value_error()
+
+ # Disable retries and run test_create_ipsec_policy_value_error.
+ _service.disable_retries()
+ self.test_create_ipsec_policy_value_error()
+
+
+class TestDeleteIpsecPolicy:
+ """
+ Test Class for delete_ipsec_policy
+ """
+
+ @responses.activate
+ def test_delete_ipsec_policy_all_params(self):
+ """
+ delete_ipsec_policy()
+ """
+ # Set up mock
+ url = preprocess_url('/ipsec_policies/testString')
+ responses.add(
+ responses.DELETE,
+ url,
+ status=204,
+ )
+
+ # Set up parameter values
+ id = 'testString'
+
+ # Invoke method
+ response = _service.delete_ipsec_policy(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 204
+
+ 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_ipsec_policy_all_params()
+
+ # Disable retries and run test_delete_ipsec_policy_all_params.
+ _service.disable_retries()
+ self.test_delete_ipsec_policy_all_params()
+
+ @responses.activate
+ def test_delete_ipsec_policy_value_error(self):
+ """
+ test_delete_ipsec_policy_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/ipsec_policies/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_ipsec_policy(**req_copy)
+
+ 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_ipsec_policy_value_error()
+
+ # Disable retries and run test_delete_ipsec_policy_value_error.
+ _service.disable_retries()
+ self.test_delete_ipsec_policy_value_error()
+
+
+class TestGetIpsecPolicy:
+ """
+ Test Class for get_ipsec_policy
+ """
+
+ @responses.activate
+ def test_get_ipsec_policy_all_params(self):
+ """
+ get_ipsec_policy()
+ """
+ # Set up mock
+ url = preprocess_url('/ipsec_policies/testString')
+ mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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'
+
+ # Invoke method
+ response = _service.get_ipsec_policy(
+ id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ 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_ipsec_policy_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": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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'] = 'disabled'
+ 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_create_endpoint_gateway_all_params()
+ self.test_update_ipsec_policy_all_params()
@responses.activate
- def test_create_endpoint_gateway_value_error(self):
+ def test_update_ipsec_policy_value_error(self):
"""
- test_create_endpoint_gateway_value_error()
+ test_update_ipsec_policy_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways')
- mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/ipsec_policies/testString')
+ mock_response = '{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "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,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype model
- endpoint_gateway_target_prototype_model = {}
- endpoint_gateway_target_prototype_model['name'] = 'ibm-ntp-server'
- endpoint_gateway_target_prototype_model['resource_type'] = 'provider_infrastructure_service'
-
- # Construct a dict representation of a VPCIdentityById model
- vpc_identity_model = {}
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
-
- # Construct a dict representation of a EndpointGatewayReservedIPReservedIPIdentityById model
- endpoint_gateway_reserved_ip_model = {}
- endpoint_gateway_reserved_ip_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
-
- # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # Construct a dict representation of a IPsecPolicyPatch model
+ i_psec_policy_patch_model = {}
+ i_psec_policy_patch_model['authentication_algorithm'] = 'disabled'
+ 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
- target = endpoint_gateway_target_prototype_model
- vpc = vpc_identity_model
- allow_dns_resolution_binding = True
- ips = [endpoint_gateway_reserved_ip_model]
- name = 'testString'
- resource_group = resource_group_identity_model
- security_groups = [security_group_identity_model]
+ 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 = {
- "target": target,
- "vpc": vpc,
+ "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.create_endpoint_gateway(**req_copy)
+ _service.update_ipsec_policy(**req_copy)
- def test_create_endpoint_gateway_value_error_with_retries(self):
- # Enable retries and run test_create_endpoint_gateway_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_create_endpoint_gateway_value_error()
+ self.test_update_ipsec_policy_value_error()
- # Disable retries and run test_create_endpoint_gateway_value_error.
+ # Disable retries and run test_update_ipsec_policy_value_error.
_service.disable_retries()
- self.test_create_endpoint_gateway_value_error()
+ self.test_update_ipsec_policy_value_error()
-class TestListEndpointGatewayIps:
+class TestListIpsecPolicyConnections:
"""
- Test Class for list_endpoint_gateway_ips
+ Test Class for list_ipsec_policy_connections
"""
@responses.activate
- def test_list_endpoint_gateway_ips_all_params(self):
+ def test_list_ipsec_policy_connections_all_params(self):
"""
- list_endpoint_gateway_ips()
+ list_ipsec_policy_connections()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -51653,17 +51952,15 @@ def test_list_endpoint_gateway_ips_all_params(self):
)
# Set up parameter values
- endpoint_gateway_id = 'testString'
+ id = 'testString'
start = 'testString'
limit = 50
- sort = 'name'
# Invoke method
- response = _service.list_endpoint_gateway_ips(
- endpoint_gateway_id,
+ response = _service.list_ipsec_policy_connections(
+ id,
start=start,
limit=limit,
- sort=sort,
headers={},
)
@@ -51675,25 +51972,24 @@ def test_list_endpoint_gateway_ips_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 'sort={}'.format(sort) in query_string
- def test_list_endpoint_gateway_ips_all_params_with_retries(self):
- # Enable retries and run test_list_endpoint_gateway_ips_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_list_endpoint_gateway_ips_all_params()
+ self.test_list_ipsec_policy_connections_all_params()
- # Disable retries and run test_list_endpoint_gateway_ips_all_params.
+ # Disable retries and run test_list_ipsec_policy_connections_all_params.
_service.disable_retries()
- self.test_list_endpoint_gateway_ips_all_params()
+ self.test_list_ipsec_policy_connections_all_params()
@responses.activate
- def test_list_endpoint_gateway_ips_required_params(self):
+ def test_list_ipsec_policy_connections_required_params(self):
"""
- test_list_endpoint_gateway_ips_required_params()
+ test_list_ipsec_policy_connections_required_params()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -51703,11 +51999,11 @@ def test_list_endpoint_gateway_ips_required_params(self):
)
# Set up parameter values
- endpoint_gateway_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.list_endpoint_gateway_ips(
- endpoint_gateway_id,
+ response = _service.list_ipsec_policy_connections(
+ id,
headers={},
)
@@ -51715,23 +52011,23 @@ def test_list_endpoint_gateway_ips_required_params(self):
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_endpoint_gateway_ips_required_params_with_retries(self):
- # Enable retries and run test_list_endpoint_gateway_ips_required_params.
+ def test_list_ipsec_policy_connections_required_params_with_retries(self):
+ # Enable retries and run test_list_ipsec_policy_connections_required_params.
_service.enable_retries()
- self.test_list_endpoint_gateway_ips_required_params()
+ self.test_list_ipsec_policy_connections_required_params()
- # Disable retries and run test_list_endpoint_gateway_ips_required_params.
+ # Disable retries and run test_list_ipsec_policy_connections_required_params.
_service.disable_retries()
- self.test_list_endpoint_gateway_ips_required_params()
+ self.test_list_ipsec_policy_connections_required_params()
@responses.activate
- def test_list_endpoint_gateway_ips_value_error(self):
+ def test_list_ipsec_policy_connections_value_error(self):
"""
- test_list_endpoint_gateway_ips_value_error()
+ test_list_ipsec_policy_connections_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString/ips')
- mock_response = '{"first": {"href": "href"}, "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -51741,35 +52037,35 @@ def test_list_endpoint_gateway_ips_value_error(self):
)
# Set up parameter values
- endpoint_gateway_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "endpoint_gateway_id": endpoint_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_endpoint_gateway_ips(**req_copy)
+ _service.list_ipsec_policy_connections(**req_copy)
- def test_list_endpoint_gateway_ips_value_error_with_retries(self):
- # Enable retries and run test_list_endpoint_gateway_ips_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_list_endpoint_gateway_ips_value_error()
+ self.test_list_ipsec_policy_connections_value_error()
- # Disable retries and run test_list_endpoint_gateway_ips_value_error.
+ # Disable retries and run test_list_ipsec_policy_connections_value_error.
_service.disable_retries()
- self.test_list_endpoint_gateway_ips_value_error()
+ self.test_list_ipsec_policy_connections_value_error()
@responses.activate
- def test_list_endpoint_gateway_ips_with_pager_get_next(self):
+ def test_list_ipsec_policy_connections_with_pager_get_next(self):
"""
- test_list_endpoint_gateway_ips_with_pager_get_next()
+ test_list_ipsec_policy_connections_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/endpoint_gateways/testString/ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ url = preprocess_url('/ipsec_policies/testString/connections')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
responses.add(
responses.GET,
url,
@@ -51787,11 +52083,10 @@ def test_list_endpoint_gateway_ips_with_pager_get_next(self):
# Exercise the pager class for this operation
all_results = []
- pager = EndpointGatewayIpsPager(
+ pager = IpsecPolicyConnectionsPager(
client=_service,
- endpoint_gateway_id='testString',
+ id='testString',
limit=10,
- sort='name',
)
while pager.has_next():
next_page = pager.get_next()
@@ -51800,14 +52095,14 @@ def test_list_endpoint_gateway_ips_with_pager_get_next(self):
assert len(all_results) == 2
@responses.activate
- def test_list_endpoint_gateway_ips_with_pager_get_all(self):
+ def test_list_ipsec_policy_connections_with_pager_get_all(self):
"""
- test_list_endpoint_gateway_ips_with_pager_get_all()
+ test_list_ipsec_policy_connections_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/endpoint_gateways/testString/ips')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","id":"r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}'
+ url = preprocess_url('/ipsec_policies/testString/connections')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
responses.add(
responses.GET,
url,
@@ -51824,317 +52119,462 @@ def test_list_endpoint_gateway_ips_with_pager_get_all(self):
)
# Exercise the pager class for this operation
- pager = EndpointGatewayIpsPager(
+ pager = IpsecPolicyConnectionsPager(
client=_service,
- endpoint_gateway_id='testString',
+ id='testString',
limit=10,
- sort='name',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestRemoveEndpointGatewayIp:
+class TestListVpnGateways:
"""
- Test Class for remove_endpoint_gateway_ip
+ Test Class for list_vpn_gateways
"""
@responses.activate
- def test_remove_endpoint_gateway_ip_all_params(self):
+ def test_list_vpn_gateways_all_params(self):
"""
- remove_endpoint_gateway_ip()
+ list_vpn_gateways()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString/ips/testString')
+ url = preprocess_url('/vpn_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- endpoint_gateway_id = 'testString'
- id = 'testString'
+ start = 'testString'
+ limit = 50
+ resource_group_id = 'testString'
+ sort = 'name'
+ mode = 'policy'
# Invoke method
- response = _service.remove_endpoint_gateway_ip(
- endpoint_gateway_id,
- id,
+ response = _service.list_vpn_gateways(
+ start=start,
+ limit=limit,
+ resource_group_id=resource_group_id,
+ sort=sort,
+ mode=mode,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ 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 'sort={}'.format(sort) in query_string
+ assert 'mode={}'.format(mode) in query_string
- def test_remove_endpoint_gateway_ip_all_params_with_retries(self):
- # Enable retries and run test_remove_endpoint_gateway_ip_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_remove_endpoint_gateway_ip_all_params()
+ self.test_list_vpn_gateways_all_params()
- # Disable retries and run test_remove_endpoint_gateway_ip_all_params.
+ # Disable retries and run test_list_vpn_gateways_all_params.
_service.disable_retries()
- self.test_remove_endpoint_gateway_ip_all_params()
+ self.test_list_vpn_gateways_all_params()
@responses.activate
- def test_remove_endpoint_gateway_ip_value_error(self):
+ def test_list_vpn_gateways_required_params(self):
"""
- test_remove_endpoint_gateway_ip_value_error()
+ test_list_vpn_gateways_required_params()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString/ips/testString')
+ url = preprocess_url('/vpn_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}]}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Set up parameter values
- endpoint_gateway_id = 'testString'
- id = 'testString'
+ # Invoke method
+ response = _service.list_vpn_gateways()
+
+ # 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.
+ _service.enable_retries()
+ self.test_list_vpn_gateways_required_params()
+
+ # Disable retries and run test_list_vpn_gateways_required_params.
+ _service.disable_retries()
+ self.test_list_vpn_gateways_required_params()
+
+ @responses.activate
+ def test_list_vpn_gateways_value_error(self):
+ """
+ test_list_vpn_gateways_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/vpn_gateways')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}]}'
+ 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 = {
- "endpoint_gateway_id": endpoint_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.remove_endpoint_gateway_ip(**req_copy)
+ _service.list_vpn_gateways(**req_copy)
- def test_remove_endpoint_gateway_ip_value_error_with_retries(self):
- # Enable retries and run test_remove_endpoint_gateway_ip_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_remove_endpoint_gateway_ip_value_error()
+ self.test_list_vpn_gateways_value_error()
- # Disable retries and run test_remove_endpoint_gateway_ip_value_error.
+ # Disable retries and run test_list_vpn_gateways_value_error.
_service.disable_retries()
- self.test_remove_endpoint_gateway_ip_value_error()
+ self.test_list_vpn_gateways_value_error()
+ @responses.activate
+ def test_list_vpn_gateways_with_pager_get_next(self):
+ """
+ test_list_vpn_gateways_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
-class TestGetEndpointGatewayIp:
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpnGatewaysPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ sort='name',
+ mode='policy',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_vpn_gateways_with_pager_get_all(self):
+ """
+ test_list_vpn_gateways_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_gateways')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","name":"my-vpn-gateway-connection","resource_type":"vpn_gateway_connection"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"0717-ddf51bec-3424-11e8-b467-0ed5f89f718b","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","members":[{"health_reasons":[{"code":"cannot_reserve_ip_address","message":"IP address exhaustion (release addresses on the VPN\'s subnet).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}],"health_state":"ok","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"public_ip":{"address":"192.168.3.4"},"role":"active"}],"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","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"policy"}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VpnGatewaysPager(
+ client=_service,
+ limit=10,
+ resource_group_id='testString',
+ sort='name',
+ mode='policy',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateVpnGateway:
"""
- Test Class for get_endpoint_gateway_ip
+ Test Class for create_vpn_gateway
"""
@responses.activate
- def test_get_endpoint_gateway_ip_all_params(self):
+ def test_create_vpn_gateway_all_params(self):
"""
- get_endpoint_gateway_ip()
+ create_vpn_gateway()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
responses.add(
- responses.GET,
+ 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 SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-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
- endpoint_gateway_id = 'testString'
- id = 'testString'
+ vpn_gateway_prototype = vpn_gateway_prototype_model
# Invoke method
- response = _service.get_endpoint_gateway_ip(
- endpoint_gateway_id,
- id,
+ response = _service.create_vpn_gateway(
+ vpn_gateway_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 == vpn_gateway_prototype
- def test_get_endpoint_gateway_ip_all_params_with_retries(self):
- # Enable retries and run test_get_endpoint_gateway_ip_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_get_endpoint_gateway_ip_all_params()
+ self.test_create_vpn_gateway_all_params()
- # Disable retries and run test_get_endpoint_gateway_ip_all_params.
+ # Disable retries and run test_create_vpn_gateway_all_params.
_service.disable_retries()
- self.test_get_endpoint_gateway_ip_all_params()
+ self.test_create_vpn_gateway_all_params()
@responses.activate
- def test_get_endpoint_gateway_ip_value_error(self):
+ def test_create_vpn_gateway_value_error(self):
"""
- test_get_endpoint_gateway_ip_value_error()
+ test_create_vpn_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
responses.add(
- responses.GET,
+ 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 SubnetIdentityById model
+ subnet_identity_model = {}
+ subnet_identity_model['id'] = '0717-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
- endpoint_gateway_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 = {
- "endpoint_gateway_id": endpoint_gateway_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.get_endpoint_gateway_ip(**req_copy)
+ _service.create_vpn_gateway(**req_copy)
- def test_get_endpoint_gateway_ip_value_error_with_retries(self):
- # Enable retries and run test_get_endpoint_gateway_ip_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_get_endpoint_gateway_ip_value_error()
+ self.test_create_vpn_gateway_value_error()
- # Disable retries and run test_get_endpoint_gateway_ip_value_error.
+ # Disable retries and run test_create_vpn_gateway_value_error.
_service.disable_retries()
- self.test_get_endpoint_gateway_ip_value_error()
+ self.test_create_vpn_gateway_value_error()
-class TestAddEndpointGatewayIp:
+class TestDeleteVpnGateway:
"""
- Test Class for add_endpoint_gateway_ip
+ Test Class for delete_vpn_gateway
"""
@responses.activate
- def test_add_endpoint_gateway_ip_all_params(self):
+ def test_delete_vpn_gateway_all_params(self):
"""
- add_endpoint_gateway_ip()
+ delete_vpn_gateway()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/vpn_gateways/testString')
responses.add(
- responses.PUT,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=202,
)
# Set up parameter values
- endpoint_gateway_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.add_endpoint_gateway_ip(
- endpoint_gateway_id,
+ response = _service.delete_vpn_gateway(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 201
+ assert response.status_code == 202
- def test_add_endpoint_gateway_ip_all_params_with_retries(self):
- # Enable retries and run test_add_endpoint_gateway_ip_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_add_endpoint_gateway_ip_all_params()
+ self.test_delete_vpn_gateway_all_params()
- # Disable retries and run test_add_endpoint_gateway_ip_all_params.
+ # Disable retries and run test_delete_vpn_gateway_all_params.
_service.disable_retries()
- self.test_add_endpoint_gateway_ip_all_params()
+ self.test_delete_vpn_gateway_all_params()
@responses.activate
- def test_add_endpoint_gateway_ip_value_error(self):
+ def test_delete_vpn_gateway_value_error(self):
"""
- test_add_endpoint_gateway_ip_value_error()
+ test_delete_vpn_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}'
+ url = preprocess_url('/vpn_gateways/testString')
responses.add(
- responses.PUT,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=202,
)
# Set up parameter values
- endpoint_gateway_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "endpoint_gateway_id": endpoint_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.add_endpoint_gateway_ip(**req_copy)
+ _service.delete_vpn_gateway(**req_copy)
- def test_add_endpoint_gateway_ip_value_error_with_retries(self):
- # Enable retries and run test_add_endpoint_gateway_ip_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_add_endpoint_gateway_ip_value_error()
+ self.test_delete_vpn_gateway_value_error()
- # Disable retries and run test_add_endpoint_gateway_ip_value_error.
+ # Disable retries and run test_delete_vpn_gateway_value_error.
_service.disable_retries()
- self.test_add_endpoint_gateway_ip_value_error()
+ self.test_delete_vpn_gateway_value_error()
-class TestDeleteEndpointGateway:
+class TestGetVpnGateway:
"""
- Test Class for delete_endpoint_gateway
+ Test Class for get_vpn_gateway
"""
@responses.activate
- def test_delete_endpoint_gateway_all_params(self):
+ def test_get_vpn_gateway_all_params(self):
"""
- delete_endpoint_gateway()
+ get_vpn_gateway()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString')
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
id = 'testString'
# Invoke method
- response = _service.delete_endpoint_gateway(
+ response = _service.get_vpn_gateway(
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 200
- def test_delete_endpoint_gateway_all_params_with_retries(self):
- # Enable retries and run test_delete_endpoint_gateway_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_delete_endpoint_gateway_all_params()
+ self.test_get_vpn_gateway_all_params()
- # Disable retries and run test_delete_endpoint_gateway_all_params.
+ # Disable retries and run test_get_vpn_gateway_all_params.
_service.disable_retries()
- self.test_delete_endpoint_gateway_all_params()
+ self.test_get_vpn_gateway_all_params()
@responses.activate
- def test_delete_endpoint_gateway_value_error(self):
+ def test_get_vpn_gateway_value_error(self):
"""
- test_delete_endpoint_gateway_value_error()
+ test_get_vpn_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString')
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
@@ -52147,1233 +52587,1237 @@ def test_delete_endpoint_gateway_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_endpoint_gateway(**req_copy)
+ _service.get_vpn_gateway(**req_copy)
- def test_delete_endpoint_gateway_value_error_with_retries(self):
- # Enable retries and run test_delete_endpoint_gateway_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_delete_endpoint_gateway_value_error()
+ self.test_get_vpn_gateway_value_error()
- # Disable retries and run test_delete_endpoint_gateway_value_error.
+ # Disable retries and run test_get_vpn_gateway_value_error.
_service.disable_retries()
- self.test_delete_endpoint_gateway_value_error()
+ self.test_get_vpn_gateway_value_error()
-class TestGetEndpointGateway:
+class TestUpdateVpnGateway:
"""
- Test Class for get_endpoint_gateway
+ Test Class for update_vpn_gateway
"""
@responses.activate
- def test_get_endpoint_gateway_all_params(self):
+ def test_update_vpn_gateway_all_params(self):
"""
- get_endpoint_gateway()
+ update_vpn_gateway()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString')
- mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
responses.add(
- responses.GET,
+ 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-updated'
+
# Set up parameter values
id = 'testString'
+ vpn_gateway_patch = vpn_gateway_patch_model
# Invoke method
- response = _service.get_endpoint_gateway(
+ response = _service.update_vpn_gateway(
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_get_endpoint_gateway_all_params_with_retries(self):
- # Enable retries and run test_get_endpoint_gateway_all_params.
+ 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_get_endpoint_gateway_all_params()
+ self.test_update_vpn_gateway_all_params()
- # Disable retries and run test_get_endpoint_gateway_all_params.
+ # Disable retries and run test_update_vpn_gateway_all_params.
_service.disable_retries()
- self.test_get_endpoint_gateway_all_params()
+ self.test_update_vpn_gateway_all_params()
@responses.activate
- def test_get_endpoint_gateway_value_error(self):
+ def test_update_vpn_gateway_value_error(self):
"""
- test_get_endpoint_gateway_value_error()
+ test_update_vpn_gateway_value_error()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString')
- mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "name": "my-vpn-gateway-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "0717-ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN\'s subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "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", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "policy"}'
responses.add(
- responses.GET,
+ 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-updated'
+
# 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.get_endpoint_gateway(**req_copy)
+ _service.update_vpn_gateway(**req_copy)
- def test_get_endpoint_gateway_value_error_with_retries(self):
- # Enable retries and run test_get_endpoint_gateway_value_error.
+ 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_get_endpoint_gateway_value_error()
+ self.test_update_vpn_gateway_value_error()
- # Disable retries and run test_get_endpoint_gateway_value_error.
+ # Disable retries and run test_update_vpn_gateway_value_error.
_service.disable_retries()
- self.test_get_endpoint_gateway_value_error()
+ self.test_update_vpn_gateway_value_error()
-class TestUpdateEndpointGateway:
+class TestListVpnGatewayConnections:
"""
- Test Class for update_endpoint_gateway
+ Test Class for list_vpn_gateway_connections
"""
@responses.activate
- def test_update_endpoint_gateway_all_params(self):
+ def test_list_vpn_gateway_connections_all_params(self):
"""
- update_endpoint_gateway()
+ list_vpn_gateway_connections()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString')
- mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a EndpointGatewayPatch model
- endpoint_gateway_patch_model = {}
- endpoint_gateway_patch_model['allow_dns_resolution_binding'] = False
- endpoint_gateway_patch_model['name'] = 'my-endpoint-gateway'
-
# Set up parameter values
- id = 'testString'
- endpoint_gateway_patch = endpoint_gateway_patch_model
+ vpn_gateway_id = 'testString'
+ start = 'testString'
+ limit = 50
+ status = 'down'
# Invoke method
- response = _service.update_endpoint_gateway(
- id,
- endpoint_gateway_patch,
+ response = _service.list_vpn_gateway_connections(
+ vpn_gateway_id,
+ start=start,
+ limit=limit,
+ status=status,
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 == endpoint_gateway_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 'status={}'.format(status) in query_string
- def test_update_endpoint_gateway_all_params_with_retries(self):
- # Enable retries and run test_update_endpoint_gateway_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_update_endpoint_gateway_all_params()
+ self.test_list_vpn_gateway_connections_all_params()
- # Disable retries and run test_update_endpoint_gateway_all_params.
+ # Disable retries and run test_list_vpn_gateway_connections_all_params.
_service.disable_retries()
- self.test_update_endpoint_gateway_all_params()
+ self.test_list_vpn_gateway_connections_all_params()
@responses.activate
- def test_update_endpoint_gateway_value_error(self):
+ def test_list_vpn_gateway_connections_required_params(self):
"""
- test_update_endpoint_gateway_value_error()
+ test_list_vpn_gateway_connections_required_params()
"""
# Set up mock
- url = preprocess_url('/endpoint_gateways/testString')
- mock_response = '{"allow_dns_resolution_binding": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "id": "r006-7610ebfb-f5dc-4d42-bc18-287d47f7a5b0", "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
- responses.PATCH,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
status=200,
)
- # Construct a dict representation of a EndpointGatewayPatch model
- endpoint_gateway_patch_model = {}
- endpoint_gateway_patch_model['allow_dns_resolution_binding'] = False
- endpoint_gateway_patch_model['name'] = 'my-endpoint-gateway'
+ # 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_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_vpn_gateway_connections_required_params()
+
+ # Disable retries and run test_list_vpn_gateway_connections_required_params.
+ _service.disable_retries()
+ self.test_list_vpn_gateway_connections_required_params()
+
+ @responses.activate
+ def test_list_vpn_gateway_connections_value_error(self):
+ """
+ test_list_vpn_gateway_connections_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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
# Set up parameter values
- id = 'testString'
- endpoint_gateway_patch = endpoint_gateway_patch_model
+ vpn_gateway_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "id": id,
- "endpoint_gateway_patch": endpoint_gateway_patch,
+ "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.update_endpoint_gateway(**req_copy)
+ _service.list_vpn_gateway_connections(**req_copy)
- def test_update_endpoint_gateway_value_error_with_retries(self):
- # Enable retries and run test_update_endpoint_gateway_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_update_endpoint_gateway_value_error()
+ self.test_list_vpn_gateway_connections_value_error()
- # Disable retries and run test_update_endpoint_gateway_value_error.
+ # Disable retries and run test_list_vpn_gateway_connections_value_error.
_service.disable_retries()
- self.test_update_endpoint_gateway_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: EndpointGateways
-##############################################################################
-
-##############################################################################
-# Start of Service: FlowLogCollectors
-##############################################################################
-# region
-
-
-class TestNewInstance:
- """
- Test Class for new_instance
- """
+ self.test_list_vpn_gateway_connections_value_error()
- def test_new_instance(self):
+ @responses.activate
+ def test_list_vpn_gateway_connections_with_pager_get_next(self):
"""
- new_instance()
+ test_list_vpn_gateway_connections_with_pager_get_next()
"""
- os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth'
-
- service = VpcV1.new_instance(
- version=version,
- service_name='TEST_SERVICE',
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_gateways/testString/connections')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
)
- 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',
- )
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpnGatewayConnectionsPager(
+ client=_service,
+ vpn_gateway_id='testString',
+ limit=10,
+ status='down',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
- def test_new_instance_without_required_params(self):
+ @responses.activate
+ def test_list_vpn_gateway_connections_with_pager_get_all(self):
"""
- new_instance_without_required_params()
+ test_list_vpn_gateway_connections_with_pager_get_all()
"""
- with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''):
- service = VpcV1.new_instance()
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_gateways/testString/connections')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ mock_response2 = '{"total_count":2,"limit":1,"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},"establish_mode":"bidirectional","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","id":"0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c","ike_policy":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","id":"r006-e98f46a3-1e4e-4195-b4e5-b8155192689d","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/r006-51eae621-dbbc-4c47-b623-b57a43c19876","id":"r006-51eae621-dbbc-4c47-b623-b57a43c19876","name":"my-ipsec-policy","resource_type":"ipsec_policy"},"mode":"policy","name":"my-vpn-gateway-connection","psk":"lkj14b1oi0alcniejkso","resource_type":"vpn_gateway_connection","status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}],"distribute_traffic":true,"local":{"ike_identities":[{"type":"fqdn","value":"my-service.example.com"}]},"peer":{"ike_identity":{"type":"fqdn","value":"my-service.example.com"},"type":"address","address":"192.0.2.5"},"routing_protocol":"none","tunnels":[{"public_ip":{"address":"192.168.3.4"},"status":"down","status_reasons":[{"code":"cannot_authenticate_connection","message":"Failed to authenticate a connection because of mismatched IKE ID and PSK.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}]}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
- 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,
- )
+ # Exercise the pager class for this operation
+ pager = VpnGatewayConnectionsPager(
+ client=_service,
+ vpn_gateway_id='testString',
+ limit=10,
+ status='down',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
-class TestListFlowLogCollectors:
+class TestCreateVpnGatewayConnection:
"""
- Test Class for list_flow_log_collectors
+ Test Class for create_vpn_gateway_connection
"""
@responses.activate
- def test_list_flow_log_collectors_all_params(self):
+ def test_create_vpn_gateway_connection_all_params(self):
"""
- list_flow_log_collectors()
+ create_vpn_gateway_connection()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors')
- mock_response = '{"first": {"href": "href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
responses.add(
- responses.GET,
+ responses.POST,
url,
body=mock_response,
content_type='application/json',
- status=200,
+ 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'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
+
+ # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
+
+ # Construct a dict representation of a VPNGatewayConnectionIKEIdentityPrototypeVPNGatewayConnectionIKEIdentityFQDN model
+ vpn_gateway_connection_ike_identity_prototype_model = {}
+ vpn_gateway_connection_ike_identity_prototype_model['type'] = 'fqdn'
+ vpn_gateway_connection_ike_identity_prototype_model['value'] = 'my-service.example.com'
+
+ # Construct a dict representation of a VPNGatewayConnectionStaticRouteModeLocalPrototype model
+ vpn_gateway_connection_static_route_mode_local_prototype_model = {}
+ vpn_gateway_connection_static_route_mode_local_prototype_model['ike_identities'] = [vpn_gateway_connection_ike_identity_prototype_model]
+
+ # Construct a dict representation of a VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress model
+ vpn_gateway_connection_static_route_mode_peer_prototype_model = {}
+ vpn_gateway_connection_static_route_mode_peer_prototype_model['ike_identity'] = vpn_gateway_connection_ike_identity_prototype_model
+ vpn_gateway_connection_static_route_mode_peer_prototype_model['address'] = '192.0.2.5'
+
+ # 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['establish_mode'] = 'bidirectional'
+ 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-gateway-connection'
+ vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso'
+ vpn_gateway_connection_prototype_model['distribute_traffic'] = False
+ vpn_gateway_connection_prototype_model['local'] = vpn_gateway_connection_static_route_mode_local_prototype_model
+ vpn_gateway_connection_prototype_model['peer'] = vpn_gateway_connection_static_route_mode_peer_prototype_model
+ vpn_gateway_connection_prototype_model['routing_protocol'] = 'none'
+
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
- name = 'my-name'
- vpc_id = 'testString'
- vpc_crn = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_name = 'my-vpc'
- target_id = 'testString'
- target_resource_type = 'testString'
+ vpn_gateway_id = 'testString'
+ vpn_gateway_connection_prototype = vpn_gateway_connection_prototype_model
# Invoke method
- response = _service.list_flow_log_collectors(
- 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,
+ response = _service.create_vpn_gateway_connection(
+ vpn_gateway_id,
+ vpn_gateway_connection_prototype,
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 'target.id={}'.format(target_id) in query_string
- assert 'target.resource_type={}'.format(target_resource_type) in query_string
+ # 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 == vpn_gateway_connection_prototype
+
+ 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_vpn_gateway_connection_all_params()
+
+ # Disable retries and run test_create_vpn_gateway_connection_all_params.
+ _service.disable_retries()
+ self.test_create_vpn_gateway_connection_all_params()
+
+ @responses.activate
+ def test_create_vpn_gateway_connection_value_error(self):
+ """
+ test_create_vpn_gateway_connection_value_error()
+ """
+ # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
+ responses.add(
+ responses.POST,
+ 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'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
+
+ # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
+
+ # Construct a dict representation of a VPNGatewayConnectionIKEIdentityPrototypeVPNGatewayConnectionIKEIdentityFQDN model
+ vpn_gateway_connection_ike_identity_prototype_model = {}
+ vpn_gateway_connection_ike_identity_prototype_model['type'] = 'fqdn'
+ vpn_gateway_connection_ike_identity_prototype_model['value'] = 'my-service.example.com'
+
+ # Construct a dict representation of a VPNGatewayConnectionStaticRouteModeLocalPrototype model
+ vpn_gateway_connection_static_route_mode_local_prototype_model = {}
+ vpn_gateway_connection_static_route_mode_local_prototype_model['ike_identities'] = [vpn_gateway_connection_ike_identity_prototype_model]
+
+ # Construct a dict representation of a VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress model
+ vpn_gateway_connection_static_route_mode_peer_prototype_model = {}
+ vpn_gateway_connection_static_route_mode_peer_prototype_model['ike_identity'] = vpn_gateway_connection_ike_identity_prototype_model
+ vpn_gateway_connection_static_route_mode_peer_prototype_model['address'] = '192.0.2.5'
+
+ # 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['establish_mode'] = 'bidirectional'
+ 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-gateway-connection'
+ vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso'
+ vpn_gateway_connection_prototype_model['distribute_traffic'] = False
+ vpn_gateway_connection_prototype_model['local'] = vpn_gateway_connection_static_route_mode_local_prototype_model
+ vpn_gateway_connection_prototype_model['peer'] = vpn_gateway_connection_static_route_mode_peer_prototype_model
+ 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
- def test_list_flow_log_collectors_all_params_with_retries(self):
- # Enable retries and run test_list_flow_log_collectors_all_params.
+ # 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)
+
+ 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_list_flow_log_collectors_all_params()
+ self.test_create_vpn_gateway_connection_value_error()
- # Disable retries and run test_list_flow_log_collectors_all_params.
+ # Disable retries and run test_create_vpn_gateway_connection_value_error.
_service.disable_retries()
- self.test_list_flow_log_collectors_all_params()
+ self.test_create_vpn_gateway_connection_value_error()
+
+
+class TestDeleteVpnGatewayConnection:
+ """
+ Test Class for delete_vpn_gateway_connection
+ """
@responses.activate
- def test_list_flow_log_collectors_required_params(self):
+ def test_delete_vpn_gateway_connection_all_params(self):
"""
- test_list_flow_log_collectors_required_params()
+ delete_vpn_gateway_connection()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors')
- mock_response = '{"first": {"href": "href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
+ # Set up parameter values
+ vpn_gateway_id = 'testString'
+ id = 'testString'
+
# Invoke method
- response = _service.list_flow_log_collectors()
+ response = _service.delete_vpn_gateway_connection(
+ vpn_gateway_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_flow_log_collectors_required_params_with_retries(self):
- # Enable retries and run test_list_flow_log_collectors_required_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_list_flow_log_collectors_required_params()
+ self.test_delete_vpn_gateway_connection_all_params()
- # Disable retries and run test_list_flow_log_collectors_required_params.
+ # Disable retries and run test_delete_vpn_gateway_connection_all_params.
_service.disable_retries()
- self.test_list_flow_log_collectors_required_params()
+ self.test_delete_vpn_gateway_connection_all_params()
@responses.activate
- def test_list_flow_log_collectors_value_error(self):
+ def test_delete_vpn_gateway_connection_value_error(self):
"""
- test_list_flow_log_collectors_value_error()
+ test_delete_vpn_gateway_connection_value_error()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors')
- mock_response = '{"first": {"href": "href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ 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.list_flow_log_collectors(**req_copy)
+ _service.delete_vpn_gateway_connection(**req_copy)
- def test_list_flow_log_collectors_value_error_with_retries(self):
- # Enable retries and run test_list_flow_log_collectors_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_list_flow_log_collectors_value_error()
+ self.test_delete_vpn_gateway_connection_value_error()
- # Disable retries and run test_list_flow_log_collectors_value_error.
+ # Disable retries and run test_delete_vpn_gateway_connection_value_error.
_service.disable_retries()
- self.test_list_flow_log_collectors_value_error()
+ self.test_delete_vpn_gateway_connection_value_error()
+
+
+class TestGetVpnGatewayConnection:
+ """
+ Test Class for get_vpn_gateway_connection
+ """
@responses.activate
- def test_list_flow_log_collectors_with_pager_get_next(self):
+ def test_get_vpn_gateway_connection_all_params(self):
"""
- test_list_flow_log_collectors_with_pager_get_next()
+ get_vpn_gateway_connection()
"""
- # Set up a two-page mock response
- url = preprocess_url('/flow_log_collectors')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
responses.add(
responses.GET,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- all_results = []
- pager = FlowLogCollectorsPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- target_id='testString',
- target_resource_type='testString',
+ # Set up parameter values
+ vpn_gateway_id = 'testString'
+ id = 'testString'
+
+ # Invoke method
+ response = _service.get_vpn_gateway_connection(
+ vpn_gateway_id,
+ id,
+ headers={},
)
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
+
+ # Check for correct operation
+ 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.
+ _service.enable_retries()
+ self.test_get_vpn_gateway_connection_all_params()
+
+ # Disable retries and run test_get_vpn_gateway_connection_all_params.
+ _service.disable_retries()
+ self.test_get_vpn_gateway_connection_all_params()
@responses.activate
- def test_list_flow_log_collectors_with_pager_get_all(self):
+ def test_get_vpn_gateway_connection_value_error(self):
"""
- test_list_flow_log_collectors_with_pager_get_all()
+ test_get_vpn_gateway_connection_value_error()
"""
- # Set up a two-page mock response
- url = preprocess_url('/flow_log_collectors')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- mock_response2 = '{"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","id":"r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
responses.add(
responses.GET,
url,
- body=mock_response2,
+ body=mock_response,
content_type='application/json',
status=200,
)
- # Exercise the pager class for this operation
- pager = FlowLogCollectorsPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- name='my-name',
- vpc_id='testString',
- vpc_crn='crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b',
- vpc_name='my-vpc',
- target_id='testString',
- target_resource_type='testString',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # 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)
+
+ 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_vpn_gateway_connection_value_error()
+
+ # Disable retries and run test_get_vpn_gateway_connection_value_error.
+ _service.disable_retries()
+ self.test_get_vpn_gateway_connection_value_error()
-class TestCreateFlowLogCollector:
+class TestUpdateVpnGatewayConnection:
"""
- Test Class for create_flow_log_collector
+ Test Class for update_vpn_gateway_connection
"""
@responses.activate
- def test_create_flow_log_collector_all_params(self):
+ def test_update_vpn_gateway_connection_all_params(self):
"""
- create_flow_log_collector()
+ update_vpn_gateway_connection()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors')
- mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
- legacy_cloud_object_storage_bucket_identity_model = {}
- legacy_cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+ # 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 FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityById model
- flow_log_collector_target_prototype_model = {}
- flow_log_collector_target_prototype_model['id'] = '0717-d54eb633-98ea-459d-aa00-6a8e780175a7'
+ # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById model
+ vpn_gateway_connection_ike_policy_patch_model = {}
+ vpn_gateway_connection_ike_policy_patch_model['id'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
+
+ # Construct a dict representation of a VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch model
+ vpn_gateway_connection_peer_patch_model = {}
+ vpn_gateway_connection_peer_patch_model['address'] = '192.0.2.5'
+
+ # Construct a dict representation of a VPNGatewayConnectionPatch 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['distribute_traffic'] = True
+ vpn_gateway_connection_patch_model['establish_mode'] = 'bidirectional'
+ 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-gateway-connection'
+ vpn_gateway_connection_patch_model['peer'] = vpn_gateway_connection_peer_patch_model
+ vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso'
# Set up parameter values
- storage_bucket = legacy_cloud_object_storage_bucket_identity_model
- target = flow_log_collector_target_prototype_model
- active = False
- name = 'my-flow-log-collector'
- resource_group = resource_group_identity_model
+ vpn_gateway_id = 'testString'
+ id = 'testString'
+ vpn_gateway_connection_patch = vpn_gateway_connection_patch_model
# Invoke method
- response = _service.create_flow_log_collector(
- storage_bucket,
- target,
- active=active,
- name=name,
- resource_group=resource_group,
+ 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 == 201
+ assert response.status_code == 200
# Validate body params
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body['storage_bucket'] == legacy_cloud_object_storage_bucket_identity_model
- assert req_body['target'] == flow_log_collector_target_prototype_model
- assert req_body['active'] == False
- assert req_body['name'] == 'my-flow-log-collector'
- assert req_body['resource_group'] == resource_group_identity_model
+ assert req_body == vpn_gateway_connection_patch
- def test_create_flow_log_collector_all_params_with_retries(self):
- # Enable retries and run test_create_flow_log_collector_all_params.
+ 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_create_flow_log_collector_all_params()
+ self.test_update_vpn_gateway_connection_all_params()
- # Disable retries and run test_create_flow_log_collector_all_params.
+ # Disable retries and run test_update_vpn_gateway_connection_all_params.
_service.disable_retries()
- self.test_create_flow_log_collector_all_params()
+ self.test_update_vpn_gateway_connection_all_params()
@responses.activate
- def test_create_flow_log_collector_value_error(self):
+ def test_update_vpn_gateway_connection_value_error(self):
"""
- test_create_flow_log_collector_value_error()
+ test_update_vpn_gateway_connection_value_error()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors')
- mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ 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}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/0717-ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "id": "0717-52f69dc3-6a5c-4bcf-b264-e7fae279b15c", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "id": "r006-e98f46a3-1e4e-4195-b4e5-b8155192689d", "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/r006-51eae621-dbbc-4c47-b623-b57a43c19876", "id": "r006-51eae621-dbbc-4c47-b623-b57a43c19876", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-gateway-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": true, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "192.0.2.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}'
responses.add(
- responses.POST,
+ responses.PATCH,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model
- legacy_cloud_object_storage_bucket_identity_model = {}
- legacy_cloud_object_storage_bucket_identity_model['name'] = 'bucket-27200-lwx4cfvcue'
+ # 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 FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityById model
- flow_log_collector_target_prototype_model = {}
- flow_log_collector_target_prototype_model['id'] = '0717-d54eb633-98ea-459d-aa00-6a8e780175a7'
+ # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById model
+ vpn_gateway_connection_ike_policy_patch_model = {}
+ vpn_gateway_connection_ike_policy_patch_model['id'] = 'r006-e98f46a3-1e4e-4195-b4e5-b8155192689d'
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # 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'] = 'r006-51eae621-dbbc-4c47-b623-b57a43c19876'
+
+ # Construct a dict representation of a VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch model
+ vpn_gateway_connection_peer_patch_model = {}
+ vpn_gateway_connection_peer_patch_model['address'] = '192.0.2.5'
+
+ # Construct a dict representation of a VPNGatewayConnectionPatch 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['distribute_traffic'] = True
+ vpn_gateway_connection_patch_model['establish_mode'] = 'bidirectional'
+ 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-gateway-connection'
+ vpn_gateway_connection_patch_model['peer'] = vpn_gateway_connection_peer_patch_model
+ vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso'
# Set up parameter values
- storage_bucket = legacy_cloud_object_storage_bucket_identity_model
- target = flow_log_collector_target_prototype_model
- active = False
- name = 'my-flow-log-collector'
- resource_group = resource_group_identity_model
+ 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 = {
- "storage_bucket": storage_bucket,
- "target": target,
+ "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.create_flow_log_collector(**req_copy)
+ _service.update_vpn_gateway_connection(**req_copy)
- def test_create_flow_log_collector_value_error_with_retries(self):
- # Enable retries and run test_create_flow_log_collector_value_error.
+ 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_create_flow_log_collector_value_error()
+ self.test_update_vpn_gateway_connection_value_error()
- # Disable retries and run test_create_flow_log_collector_value_error.
+ # Disable retries and run test_update_vpn_gateway_connection_value_error.
_service.disable_retries()
- self.test_create_flow_log_collector_value_error()
+ self.test_update_vpn_gateway_connection_value_error()
-class TestDeleteFlowLogCollector:
+class TestListVpnGatewayConnectionsLocalCidrs:
"""
- Test Class for delete_flow_log_collector
+ Test Class for list_vpn_gateway_connections_local_cidrs
"""
@responses.activate
- def test_delete_flow_log_collector_all_params(self):
+ def test_list_vpn_gateway_connections_local_cidrs_all_params(self):
"""
- delete_flow_log_collector()
+ list_vpn_gateway_connections_local_cidrs()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors/testString')
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs')
+ mock_response = '{"cidrs": ["192.0.2.0/24"]}'
responses.add(
- responses.DELETE,
+ 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_flow_log_collector(
+ response = _service.list_vpn_gateway_connections_local_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_flow_log_collector_all_params_with_retries(self):
- # Enable retries and run test_delete_flow_log_collector_all_params.
+ def test_list_vpn_gateway_connections_local_cidrs_all_params_with_retries(self):
+ # Enable retries and run test_list_vpn_gateway_connections_local_cidrs_all_params.
_service.enable_retries()
- self.test_delete_flow_log_collector_all_params()
+ self.test_list_vpn_gateway_connections_local_cidrs_all_params()
- # Disable retries and run test_delete_flow_log_collector_all_params.
+ # Disable retries and run test_list_vpn_gateway_connections_local_cidrs_all_params.
_service.disable_retries()
- self.test_delete_flow_log_collector_all_params()
+ self.test_list_vpn_gateway_connections_local_cidrs_all_params()
@responses.activate
- def test_delete_flow_log_collector_value_error(self):
+ def test_list_vpn_gateway_connections_local_cidrs_value_error(self):
"""
- test_delete_flow_log_collector_value_error()
+ test_list_vpn_gateway_connections_local_cidrs_value_error()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors/testString')
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs')
+ mock_response = '{"cidrs": ["192.0.2.0/24"]}'
responses.add(
- responses.DELETE,
+ 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_flow_log_collector(**req_copy)
+ _service.list_vpn_gateway_connections_local_cidrs(**req_copy)
- def test_delete_flow_log_collector_value_error_with_retries(self):
- # Enable retries and run test_delete_flow_log_collector_value_error.
+ def test_list_vpn_gateway_connections_local_cidrs_value_error_with_retries(self):
+ # Enable retries and run test_list_vpn_gateway_connections_local_cidrs_value_error.
_service.enable_retries()
- self.test_delete_flow_log_collector_value_error()
+ self.test_list_vpn_gateway_connections_local_cidrs_value_error()
- # Disable retries and run test_delete_flow_log_collector_value_error.
+ # Disable retries and run test_list_vpn_gateway_connections_local_cidrs_value_error.
_service.disable_retries()
- self.test_delete_flow_log_collector_value_error()
+ self.test_list_vpn_gateway_connections_local_cidrs_value_error()
-class TestGetFlowLogCollector:
+class TestRemoveVpnGatewayConnectionsLocalCidr:
"""
- Test Class for get_flow_log_collector
+ Test Class for remove_vpn_gateway_connections_local_cidr
"""
@responses.activate
- def test_get_flow_log_collector_all_params(self):
+ def test_remove_vpn_gateway_connections_local_cidr_all_params(self):
"""
- get_flow_log_collector()
+ remove_vpn_gateway_connections_local_cidr()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors/testString')
- mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
responses.add(
- responses.GET,
+ 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 = '192.168.1.0/24'
# Invoke method
- response = _service.get_flow_log_collector(
+ response = _service.remove_vpn_gateway_connections_local_cidr(
+ vpn_gateway_id,
id,
+ cidr,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_flow_log_collector_all_params_with_retries(self):
- # Enable retries and run test_get_flow_log_collector_all_params.
+ def test_remove_vpn_gateway_connections_local_cidr_all_params_with_retries(self):
+ # Enable retries and run test_remove_vpn_gateway_connections_local_cidr_all_params.
_service.enable_retries()
- self.test_get_flow_log_collector_all_params()
+ self.test_remove_vpn_gateway_connections_local_cidr_all_params()
- # Disable retries and run test_get_flow_log_collector_all_params.
+ # Disable retries and run test_remove_vpn_gateway_connections_local_cidr_all_params.
_service.disable_retries()
- self.test_get_flow_log_collector_all_params()
+ self.test_remove_vpn_gateway_connections_local_cidr_all_params()
@responses.activate
- def test_get_flow_log_collector_value_error(self):
+ def test_remove_vpn_gateway_connections_local_cidr_value_error(self):
"""
- test_get_flow_log_collector_value_error()
+ test_remove_vpn_gateway_connections_local_cidr_value_error()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors/testString')
- mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
responses.add(
- responses.GET,
+ 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 = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpn_gateway_id": vpn_gateway_id,
"id": id,
+ "cidr": cidr,
}
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_flow_log_collector(**req_copy)
+ _service.remove_vpn_gateway_connections_local_cidr(**req_copy)
- def test_get_flow_log_collector_value_error_with_retries(self):
- # Enable retries and run test_get_flow_log_collector_value_error.
+ def test_remove_vpn_gateway_connections_local_cidr_value_error_with_retries(self):
+ # Enable retries and run test_remove_vpn_gateway_connections_local_cidr_value_error.
_service.enable_retries()
- self.test_get_flow_log_collector_value_error()
+ self.test_remove_vpn_gateway_connections_local_cidr_value_error()
- # Disable retries and run test_get_flow_log_collector_value_error.
+ # Disable retries and run test_remove_vpn_gateway_connections_local_cidr_value_error.
_service.disable_retries()
- self.test_get_flow_log_collector_value_error()
+ self.test_remove_vpn_gateway_connections_local_cidr_value_error()
-class TestUpdateFlowLogCollector:
+class TestCheckVpnGatewayConnectionsLocalCidr:
"""
- Test Class for update_flow_log_collector
+ Test Class for check_vpn_gateway_connections_local_cidr
"""
@responses.activate
- def test_update_flow_log_collector_all_params(self):
+ def test_check_vpn_gateway_connections_local_cidr_all_params(self):
"""
- update_flow_log_collector()
+ check_vpn_gateway_connections_local_cidr()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors/testString')
- mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
responses.add(
- responses.PATCH,
+ responses.GET,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a FlowLogCollectorPatch model
- flow_log_collector_patch_model = {}
- flow_log_collector_patch_model['active'] = False
- flow_log_collector_patch_model['name'] = 'my-flow-log-collector'
-
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
- flow_log_collector_patch = flow_log_collector_patch_model
+ cidr = '192.168.1.0/24'
# Invoke method
- response = _service.update_flow_log_collector(
+ response = _service.check_vpn_gateway_connections_local_cidr(
+ vpn_gateway_id,
id,
- flow_log_collector_patch,
+ cidr,
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 == flow_log_collector_patch
+ assert response.status_code == 204
- def test_update_flow_log_collector_all_params_with_retries(self):
- # Enable retries and run test_update_flow_log_collector_all_params.
+ def test_check_vpn_gateway_connections_local_cidr_all_params_with_retries(self):
+ # Enable retries and run test_check_vpn_gateway_connections_local_cidr_all_params.
_service.enable_retries()
- self.test_update_flow_log_collector_all_params()
+ self.test_check_vpn_gateway_connections_local_cidr_all_params()
- # Disable retries and run test_update_flow_log_collector_all_params.
+ # Disable retries and run test_check_vpn_gateway_connections_local_cidr_all_params.
_service.disable_retries()
- self.test_update_flow_log_collector_all_params()
+ self.test_check_vpn_gateway_connections_local_cidr_all_params()
@responses.activate
- def test_update_flow_log_collector_value_error(self):
+ def test_check_vpn_gateway_connections_local_cidr_value_error(self):
"""
- test_update_flow_log_collector_value_error()
+ test_check_vpn_gateway_connections_local_cidr_value_error()
"""
# Set up mock
- url = preprocess_url('/flow_log_collectors/testString')
- mock_response = '{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "id": "r006-ad0cded3-53a3-4d4a-9809-8c59b50d2b80", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
responses.add(
- responses.PATCH,
+ responses.GET,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
- # Construct a dict representation of a FlowLogCollectorPatch model
- flow_log_collector_patch_model = {}
- flow_log_collector_patch_model['active'] = False
- flow_log_collector_patch_model['name'] = 'my-flow-log-collector'
-
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
- flow_log_collector_patch = flow_log_collector_patch_model
+ cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpn_gateway_id": vpn_gateway_id,
"id": id,
- "flow_log_collector_patch": flow_log_collector_patch,
+ "cidr": cidr,
}
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_flow_log_collector(**req_copy)
+ _service.check_vpn_gateway_connections_local_cidr(**req_copy)
- def test_update_flow_log_collector_value_error_with_retries(self):
- # Enable retries and run test_update_flow_log_collector_value_error.
+ def test_check_vpn_gateway_connections_local_cidr_value_error_with_retries(self):
+ # Enable retries and run test_check_vpn_gateway_connections_local_cidr_value_error.
_service.enable_retries()
- self.test_update_flow_log_collector_value_error()
+ self.test_check_vpn_gateway_connections_local_cidr_value_error()
- # Disable retries and run test_update_flow_log_collector_value_error.
+ # Disable retries and run test_check_vpn_gateway_connections_local_cidr_value_error.
_service.disable_retries()
- self.test_update_flow_log_collector_value_error()
-
-
-# endregion
-##############################################################################
-# End of Service: FlowLogCollectors
-##############################################################################
-
-##############################################################################
-# Start of Service: PrivatePathServiceGateways
-##############################################################################
-# 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,
- )
+ self.test_check_vpn_gateway_connections_local_cidr_value_error()
-class TestListPrivatePathServiceGateways:
+class TestAddVpnGatewayConnectionsLocalCidr:
"""
- Test Class for list_private_path_service_gateways
+ Test Class for add_vpn_gateway_connections_local_cidr
"""
@responses.activate
- def test_list_private_path_service_gateways_all_params(self):
+ def test_add_vpn_gateway_connections_local_cidr_all_params(self):
"""
- list_private_path_service_gateways()
+ add_vpn_gateway_connections_local_cidr()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}], "total_count": 132}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
responses.add(
- responses.GET,
+ responses.PUT,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=201,
)
# Set up parameter values
- start = 'testString'
- limit = 50
- resource_group_id = 'testString'
+ vpn_gateway_id = 'testString'
+ id = 'testString'
+ cidr = '192.168.1.0/24'
# Invoke method
- response = _service.list_private_path_service_gateways(
- start=start,
- limit=limit,
- resource_group_id=resource_group_id,
+ response = _service.add_vpn_gateway_connections_local_cidr(
+ vpn_gateway_id,
+ id,
+ cidr,
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 response.status_code == 201
- def test_list_private_path_service_gateways_all_params_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateways_all_params.
+ def test_add_vpn_gateway_connections_local_cidr_all_params_with_retries(self):
+ # Enable retries and run test_add_vpn_gateway_connections_local_cidr_all_params.
_service.enable_retries()
- self.test_list_private_path_service_gateways_all_params()
+ self.test_add_vpn_gateway_connections_local_cidr_all_params()
- # Disable retries and run test_list_private_path_service_gateways_all_params.
+ # Disable retries and run test_add_vpn_gateway_connections_local_cidr_all_params.
_service.disable_retries()
- self.test_list_private_path_service_gateways_all_params()
+ self.test_add_vpn_gateway_connections_local_cidr_all_params()
@responses.activate
- def test_list_private_path_service_gateways_required_params(self):
+ def test_add_vpn_gateway_connections_local_cidr_value_error(self):
"""
- test_list_private_path_service_gateways_required_params()
+ test_add_vpn_gateway_connections_local_cidr_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}], "total_count": 132}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/local/cidrs/192.168.1.0%2F24')
responses.add(
- responses.GET,
+ responses.PUT,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=201,
)
- # Invoke method
- response = _service.list_private_path_service_gateways()
-
- # Check for correct operation
- assert len(responses.calls) == 1
- assert response.status_code == 200
-
- def test_list_private_path_service_gateways_required_params_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateways_required_params.
- _service.enable_retries()
- self.test_list_private_path_service_gateways_required_params()
-
- # Disable retries and run test_list_private_path_service_gateways_required_params.
- _service.disable_retries()
- self.test_list_private_path_service_gateways_required_params()
-
- @responses.activate
- def test_list_private_path_service_gateways_value_error(self):
- """
- test_list_private_path_service_gateways_value_error()
- """
- # Set up mock
- url = preprocess_url('/private_path_service_gateways')
- mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}], "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 = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpn_gateway_id": vpn_gateway_id,
+ "id": id,
+ "cidr": cidr,
}
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_private_path_service_gateways(**req_copy)
+ _service.add_vpn_gateway_connections_local_cidr(**req_copy)
- def test_list_private_path_service_gateways_value_error_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateways_value_error.
+ def test_add_vpn_gateway_connections_local_cidr_value_error_with_retries(self):
+ # Enable retries and run test_add_vpn_gateway_connections_local_cidr_value_error.
_service.enable_retries()
- self.test_list_private_path_service_gateways_value_error()
+ self.test_add_vpn_gateway_connections_local_cidr_value_error()
- # Disable retries and run test_list_private_path_service_gateways_value_error.
+ # Disable retries and run test_add_vpn_gateway_connections_local_cidr_value_error.
_service.disable_retries()
- self.test_list_private_path_service_gateways_value_error()
-
- @responses.activate
- def test_list_private_path_service_gateways_with_pager_get_next(self):
- """
- test_list_private_path_service_gateways_with_pager_get_next()
- """
- # Set up a two-page mock response
- url = preprocess_url('/private_path_service_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
- mock_response2 = '{"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- all_results = []
- pager = PrivatePathServiceGatewaysPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- )
- while pager.has_next():
- next_page = pager.get_next()
- assert next_page is not None
- all_results.extend(next_page)
- assert len(all_results) == 2
-
- @responses.activate
- def test_list_private_path_service_gateways_with_pager_get_all(self):
- """
- test_list_private_path_service_gateways_with_pager_get_all()
- """
- # Set up a two-page mock response
- url = preprocess_url('/private_path_service_gateways')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
- mock_response2 = '{"private_path_service_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5","default_access_policy":"deny","endpoint_gateway_binding_auto_delete":true,"endpoint_gateway_binding_auto_delete_timeout":1,"endpoint_gateway_count":0,"href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","lifecycle_state":"stable","load_balancer":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727","name":"my-load-balancer","resource_type":"load_balancer"},"name":"my-private-path-service-gateway","published":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"private_path_service_gateway","service_endpoints":["*.example.com"],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zonal_affinity":true}],"total_count":2,"limit":1}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
- responses.add(
- responses.GET,
- url,
- body=mock_response2,
- content_type='application/json',
- status=200,
- )
-
- # Exercise the pager class for this operation
- pager = PrivatePathServiceGatewaysPager(
- client=_service,
- limit=10,
- resource_group_id='testString',
- )
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ self.test_add_vpn_gateway_connections_local_cidr_value_error()
-class TestCreatePrivatePathServiceGateway:
+class TestListVpnGatewayConnectionsPeerCidrs:
"""
- Test Class for create_private_path_service_gateway
+ Test Class for list_vpn_gateway_connections_peer_cidrs
"""
@responses.activate
- def test_create_private_path_service_gateway_all_params(self):
+ def test_list_vpn_gateway_connections_peer_cidrs_all_params(self):
"""
- create_private_path_service_gateway()
+ list_vpn_gateway_connections_peer_cidrs()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs')
+ mock_response = '{"cidrs": ["192.0.2.0/24"]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
# Set up parameter values
- load_balancer = load_balancer_identity_model
- service_endpoints = ['*.example.com']
- default_access_policy = 'deny'
- name = 'my-private-path-service-gateway'
- resource_group = resource_group_identity_model
- zonal_affinity = False
+ vpn_gateway_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.create_private_path_service_gateway(
- load_balancer,
- service_endpoints,
- default_access_policy=default_access_policy,
- name=name,
- resource_group=resource_group,
- zonal_affinity=zonal_affinity,
+ response = _service.list_vpn_gateway_connections_peer_cidrs(
+ vpn_gateway_id,
+ id,
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['load_balancer'] == load_balancer_identity_model
- assert req_body['service_endpoints'] == ['*.example.com']
- assert req_body['default_access_policy'] == 'deny'
- assert req_body['name'] == 'my-private-path-service-gateway'
- assert req_body['resource_group'] == resource_group_identity_model
- assert req_body['zonal_affinity'] == False
+ assert response.status_code == 200
- def test_create_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_create_private_path_service_gateway_all_params.
+ def test_list_vpn_gateway_connections_peer_cidrs_all_params_with_retries(self):
+ # Enable retries and run test_list_vpn_gateway_connections_peer_cidrs_all_params.
_service.enable_retries()
- self.test_create_private_path_service_gateway_all_params()
+ self.test_list_vpn_gateway_connections_peer_cidrs_all_params()
- # Disable retries and run test_create_private_path_service_gateway_all_params.
+ # Disable retries and run test_list_vpn_gateway_connections_peer_cidrs_all_params.
_service.disable_retries()
- self.test_create_private_path_service_gateway_all_params()
+ self.test_list_vpn_gateway_connections_peer_cidrs_all_params()
@responses.activate
- def test_create_private_path_service_gateway_value_error(self):
+ def test_list_vpn_gateway_connections_peer_cidrs_value_error(self):
"""
- test_create_private_path_service_gateway_value_error()
+ test_list_vpn_gateway_connections_peer_cidrs_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs')
+ mock_response = '{"cidrs": ["192.0.2.0/24"]}'
responses.add(
- responses.POST,
+ responses.GET,
url,
body=mock_response,
content_type='application/json',
- status=201,
+ status=200,
)
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a ResourceGroupIdentityById model
- resource_group_identity_model = {}
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
-
# Set up parameter values
- load_balancer = load_balancer_identity_model
- service_endpoints = ['*.example.com']
- default_access_policy = 'deny'
- name = 'my-private-path-service-gateway'
- resource_group = resource_group_identity_model
- zonal_affinity = False
+ vpn_gateway_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "load_balancer": load_balancer,
- "service_endpoints": service_endpoints,
+ "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.create_private_path_service_gateway(**req_copy)
+ _service.list_vpn_gateway_connections_peer_cidrs(**req_copy)
- def test_create_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_create_private_path_service_gateway_value_error.
+ def test_list_vpn_gateway_connections_peer_cidrs_value_error_with_retries(self):
+ # Enable retries and run test_list_vpn_gateway_connections_peer_cidrs_value_error.
_service.enable_retries()
- self.test_create_private_path_service_gateway_value_error()
+ self.test_list_vpn_gateway_connections_peer_cidrs_value_error()
- # Disable retries and run test_create_private_path_service_gateway_value_error.
+ # Disable retries and run test_list_vpn_gateway_connections_peer_cidrs_value_error.
_service.disable_retries()
- self.test_create_private_path_service_gateway_value_error()
+ self.test_list_vpn_gateway_connections_peer_cidrs_value_error()
-class TestDeletePrivatePathServiceGateway:
+class TestRemoveVpnGatewayConnectionsPeerCidr:
"""
- Test Class for delete_private_path_service_gateway
+ Test Class for remove_vpn_gateway_connections_peer_cidr
"""
@responses.activate
- def test_delete_private_path_service_gateway_all_params(self):
+ def test_remove_vpn_gateway_connections_peer_cidr_all_params(self):
"""
- delete_private_path_service_gateway()
+ remove_vpn_gateway_connections_peer_cidr()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString')
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
responses.add(
responses.DELETE,
url,
@@ -53381,11 +53825,15 @@ def test_delete_private_path_service_gateway_all_params(self):
)
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
+ cidr = '192.168.1.0/24'
# Invoke method
- response = _service.delete_private_path_service_gateway(
+ response = _service.remove_vpn_gateway_connections_peer_cidr(
+ vpn_gateway_id,
id,
+ cidr,
headers={},
)
@@ -53393,22 +53841,22 @@ def test_delete_private_path_service_gateway_all_params(self):
assert len(responses.calls) == 1
assert response.status_code == 204
- def test_delete_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_delete_private_path_service_gateway_all_params.
+ def test_remove_vpn_gateway_connections_peer_cidr_all_params_with_retries(self):
+ # Enable retries and run test_remove_vpn_gateway_connections_peer_cidr_all_params.
_service.enable_retries()
- self.test_delete_private_path_service_gateway_all_params()
+ self.test_remove_vpn_gateway_connections_peer_cidr_all_params()
- # Disable retries and run test_delete_private_path_service_gateway_all_params.
+ # Disable retries and run test_remove_vpn_gateway_connections_peer_cidr_all_params.
_service.disable_retries()
- self.test_delete_private_path_service_gateway_all_params()
+ self.test_remove_vpn_gateway_connections_peer_cidr_all_params()
@responses.activate
- def test_delete_private_path_service_gateway_value_error(self):
+ def test_remove_vpn_gateway_connections_peer_cidr_value_error(self):
"""
- test_delete_private_path_service_gateway_value_error()
+ test_remove_vpn_gateway_connections_peer_cidr_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString')
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
responses.add(
responses.DELETE,
url,
@@ -53416,231 +53864,267 @@ def test_delete_private_path_service_gateway_value_error(self):
)
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
+ cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpn_gateway_id": vpn_gateway_id,
"id": id,
+ "cidr": cidr,
}
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_private_path_service_gateway(**req_copy)
+ _service.remove_vpn_gateway_connections_peer_cidr(**req_copy)
- def test_delete_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_delete_private_path_service_gateway_value_error.
+ def test_remove_vpn_gateway_connections_peer_cidr_value_error_with_retries(self):
+ # Enable retries and run test_remove_vpn_gateway_connections_peer_cidr_value_error.
_service.enable_retries()
- self.test_delete_private_path_service_gateway_value_error()
+ self.test_remove_vpn_gateway_connections_peer_cidr_value_error()
- # Disable retries and run test_delete_private_path_service_gateway_value_error.
+ # Disable retries and run test_remove_vpn_gateway_connections_peer_cidr_value_error.
_service.disable_retries()
- self.test_delete_private_path_service_gateway_value_error()
+ self.test_remove_vpn_gateway_connections_peer_cidr_value_error()
-class TestGetPrivatePathServiceGateway:
+class TestCheckVpnGatewayConnectionsPeerCidr:
"""
- Test Class for get_private_path_service_gateway
+ Test Class for check_vpn_gateway_connections_peer_cidr
"""
@responses.activate
- def test_get_private_path_service_gateway_all_params(self):
+ def test_check_vpn_gateway_connections_peer_cidr_all_params(self):
"""
- get_private_path_service_gateway()
+ check_vpn_gateway_connections_peer_cidr()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
responses.add(
responses.GET,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
+ cidr = '192.168.1.0/24'
# Invoke method
- response = _service.get_private_path_service_gateway(
+ response = _service.check_vpn_gateway_connections_peer_cidr(
+ vpn_gateway_id,
id,
+ cidr,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 200
+ assert response.status_code == 204
- def test_get_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_get_private_path_service_gateway_all_params.
+ def test_check_vpn_gateway_connections_peer_cidr_all_params_with_retries(self):
+ # Enable retries and run test_check_vpn_gateway_connections_peer_cidr_all_params.
_service.enable_retries()
- self.test_get_private_path_service_gateway_all_params()
+ self.test_check_vpn_gateway_connections_peer_cidr_all_params()
- # Disable retries and run test_get_private_path_service_gateway_all_params.
+ # Disable retries and run test_check_vpn_gateway_connections_peer_cidr_all_params.
_service.disable_retries()
- self.test_get_private_path_service_gateway_all_params()
+ self.test_check_vpn_gateway_connections_peer_cidr_all_params()
@responses.activate
- def test_get_private_path_service_gateway_value_error(self):
+ def test_check_vpn_gateway_connections_peer_cidr_value_error(self):
"""
- test_get_private_path_service_gateway_value_error()
+ test_check_vpn_gateway_connections_peer_cidr_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
responses.add(
responses.GET,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=204,
)
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
+ cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpn_gateway_id": vpn_gateway_id,
"id": id,
+ "cidr": cidr,
}
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_private_path_service_gateway(**req_copy)
+ _service.check_vpn_gateway_connections_peer_cidr(**req_copy)
- def test_get_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_get_private_path_service_gateway_value_error.
+ def test_check_vpn_gateway_connections_peer_cidr_value_error_with_retries(self):
+ # Enable retries and run test_check_vpn_gateway_connections_peer_cidr_value_error.
_service.enable_retries()
- self.test_get_private_path_service_gateway_value_error()
+ self.test_check_vpn_gateway_connections_peer_cidr_value_error()
- # Disable retries and run test_get_private_path_service_gateway_value_error.
+ # Disable retries and run test_check_vpn_gateway_connections_peer_cidr_value_error.
_service.disable_retries()
- self.test_get_private_path_service_gateway_value_error()
+ self.test_check_vpn_gateway_connections_peer_cidr_value_error()
-class TestUpdatePrivatePathServiceGateway:
+class TestAddVpnGatewayConnectionsPeerCidr:
"""
- Test Class for update_private_path_service_gateway
+ Test Class for add_vpn_gateway_connections_peer_cidr
"""
@responses.activate
- def test_update_private_path_service_gateway_all_params(self):
+ def test_add_vpn_gateway_connections_peer_cidr_all_params(self):
"""
- update_private_path_service_gateway()
+ add_vpn_gateway_connections_peer_cidr()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
responses.add(
- responses.PATCH,
+ responses.PUT,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a PrivatePathServiceGatewayPatch model
- private_path_service_gateway_patch_model = {}
- private_path_service_gateway_patch_model['default_access_policy'] = 'deny'
- private_path_service_gateway_patch_model['load_balancer'] = load_balancer_identity_model
- private_path_service_gateway_patch_model['name'] = 'my-private-path-service-gateway'
- private_path_service_gateway_patch_model['zonal_affinity'] = True
-
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
- private_path_service_gateway_patch = private_path_service_gateway_patch_model
+ cidr = '192.168.1.0/24'
# Invoke method
- response = _service.update_private_path_service_gateway(
+ response = _service.add_vpn_gateway_connections_peer_cidr(
+ vpn_gateway_id,
id,
- private_path_service_gateway_patch,
+ cidr,
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 == private_path_service_gateway_patch
+ assert response.status_code == 201
- def test_update_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_update_private_path_service_gateway_all_params.
+ def test_add_vpn_gateway_connections_peer_cidr_all_params_with_retries(self):
+ # Enable retries and run test_add_vpn_gateway_connections_peer_cidr_all_params.
_service.enable_retries()
- self.test_update_private_path_service_gateway_all_params()
+ self.test_add_vpn_gateway_connections_peer_cidr_all_params()
- # Disable retries and run test_update_private_path_service_gateway_all_params.
+ # Disable retries and run test_add_vpn_gateway_connections_peer_cidr_all_params.
_service.disable_retries()
- self.test_update_private_path_service_gateway_all_params()
+ self.test_add_vpn_gateway_connections_peer_cidr_all_params()
@responses.activate
- def test_update_private_path_service_gateway_value_error(self):
+ def test_add_vpn_gateway_connections_peer_cidr_value_error(self):
"""
- test_update_private_path_service_gateway_value_error()
+ test_add_vpn_gateway_connections_peer_cidr_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString')
- mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r006-7268d425-59b7-48fd-9735-81a7271657d5", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": true}'
+ url = preprocess_url('/vpn_gateways/testString/connections/testString/peer/cidrs/192.168.1.0%2F24')
responses.add(
- responses.PATCH,
+ responses.PUT,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=201,
)
- # Construct a dict representation of a LoadBalancerIdentityById model
- load_balancer_identity_model = {}
- load_balancer_identity_model['id'] = 'r006-dd754295-e9e0-4c9d-bf6c-58fbc59e5727'
-
- # Construct a dict representation of a PrivatePathServiceGatewayPatch model
- private_path_service_gateway_patch_model = {}
- private_path_service_gateway_patch_model['default_access_policy'] = 'deny'
- private_path_service_gateway_patch_model['load_balancer'] = load_balancer_identity_model
- private_path_service_gateway_patch_model['name'] = 'my-private-path-service-gateway'
- private_path_service_gateway_patch_model['zonal_affinity'] = True
-
# Set up parameter values
+ vpn_gateway_id = 'testString'
id = 'testString'
- private_path_service_gateway_patch = private_path_service_gateway_patch_model
+ cidr = '192.168.1.0/24'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
+ "vpn_gateway_id": vpn_gateway_id,
"id": id,
- "private_path_service_gateway_patch": private_path_service_gateway_patch,
+ "cidr": cidr,
}
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_private_path_service_gateway(**req_copy)
+ _service.add_vpn_gateway_connections_peer_cidr(**req_copy)
- def test_update_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_update_private_path_service_gateway_value_error.
+ def test_add_vpn_gateway_connections_peer_cidr_value_error_with_retries(self):
+ # Enable retries and run test_add_vpn_gateway_connections_peer_cidr_value_error.
_service.enable_retries()
- self.test_update_private_path_service_gateway_value_error()
+ self.test_add_vpn_gateway_connections_peer_cidr_value_error()
- # Disable retries and run test_update_private_path_service_gateway_value_error.
+ # Disable retries and run test_add_vpn_gateway_connections_peer_cidr_value_error.
_service.disable_retries()
- self.test_update_private_path_service_gateway_value_error()
+ self.test_add_vpn_gateway_connections_peer_cidr_value_error()
-class TestListPrivatePathServiceGatewayAccountPolicies:
+# endregion
+##############################################################################
+# End of Service: VPNGateways
+##############################################################################
+
+##############################################################################
+# Start of Service: VPNServers
+##############################################################################
+# region
+
+
+class TestNewInstance:
"""
- Test Class for list_private_path_service_gateway_account_policies
+ 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_private_path_service_gateway_account_policies_all_params(self):
+ def test_list_vpn_servers_all_params(self):
"""
- list_private_path_service_gateway_account_policies()
+ list_vpn_servers()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response = '{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpn_servers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -53650,17 +54134,19 @@ def test_list_private_path_service_gateway_account_policies_all_params(self):
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ name = 'my-name'
start = 'testString'
limit = 50
- account_id = 'bb1b52262f7441a586f49068482f1e60'
+ resource_group_id = 'testString'
+ sort = 'name'
# Invoke method
- response = _service.list_private_path_service_gateway_account_policies(
- private_path_service_gateway_id,
+ response = _service.list_vpn_servers(
+ name=name,
start=start,
limit=limit,
- account_id=account_id,
+ resource_group_id=resource_group_id,
+ sort=sort,
headers={},
)
@@ -53670,27 +54156,29 @@ def test_list_private_path_service_gateway_account_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 'name={}'.format(name) in query_string
assert 'start={}'.format(start) in query_string
assert 'limit={}'.format(limit) in query_string
- assert 'account.id={}'.format(account_id) in query_string
+ assert 'resource_group.id={}'.format(resource_group_id) in query_string
+ assert 'sort={}'.format(sort) in query_string
- def test_list_private_path_service_gateway_account_policies_all_params_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateway_account_policies_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_private_path_service_gateway_account_policies_all_params()
+ self.test_list_vpn_servers_all_params()
- # Disable retries and run test_list_private_path_service_gateway_account_policies_all_params.
+ # Disable retries and run test_list_vpn_servers_all_params.
_service.disable_retries()
- self.test_list_private_path_service_gateway_account_policies_all_params()
+ self.test_list_vpn_servers_all_params()
@responses.activate
- def test_list_private_path_service_gateway_account_policies_required_params(self):
+ def test_list_vpn_servers_required_params(self):
"""
- test_list_private_path_service_gateway_account_policies_required_params()
+ test_list_vpn_servers_required_params()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response = '{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpn_servers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -53699,36 +54187,30 @@ def test_list_private_path_service_gateway_account_policies_required_params(self
status=200,
)
- # Set up parameter values
- private_path_service_gateway_id = 'testString'
-
# Invoke method
- response = _service.list_private_path_service_gateway_account_policies(
- private_path_service_gateway_id,
- headers={},
- )
+ response = _service.list_vpn_servers()
# Check for correct operation
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_private_path_service_gateway_account_policies_required_params_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateway_account_policies_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_private_path_service_gateway_account_policies_required_params()
+ self.test_list_vpn_servers_required_params()
- # Disable retries and run test_list_private_path_service_gateway_account_policies_required_params.
+ # Disable retries and run test_list_vpn_servers_required_params.
_service.disable_retries()
- self.test_list_private_path_service_gateway_account_policies_required_params()
+ self.test_list_vpn_servers_required_params()
@responses.activate
- def test_list_private_path_service_gateway_account_policies_value_error(self):
+ def test_list_vpn_servers_value_error(self):
"""
- test_list_private_path_service_gateway_account_policies_value_error()
+ test_list_vpn_servers_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response = '{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ url = preprocess_url('/vpn_servers')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}'
responses.add(
responses.GET,
url,
@@ -53737,36 +54219,32 @@ def test_list_private_path_service_gateway_account_policies_value_error(self):
status=200,
)
- # Set up parameter values
- private_path_service_gateway_id = 'testString'
-
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_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_private_path_service_gateway_account_policies(**req_copy)
+ _service.list_vpn_servers(**req_copy)
- def test_list_private_path_service_gateway_account_policies_value_error_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateway_account_policies_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_private_path_service_gateway_account_policies_value_error()
+ self.test_list_vpn_servers_value_error()
- # Disable retries and run test_list_private_path_service_gateway_account_policies_value_error.
+ # Disable retries and run test_list_vpn_servers_value_error.
_service.disable_retries()
- self.test_list_private_path_service_gateway_account_policies_value_error()
+ self.test_list_vpn_servers_value_error()
@responses.activate
- def test_list_private_path_service_gateway_account_policies_with_pager_get_next(self):
+ def test_list_vpn_servers_with_pager_get_next(self):
"""
- test_list_private_path_service_gateway_account_policies_with_pager_get_next()
+ test_list_vpn_servers_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
+ url = preprocess_url('/vpn_servers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -53784,11 +54262,12 @@ def test_list_private_path_service_gateway_account_policies_with_pager_get_next(
# Exercise the pager class for this operation
all_results = []
- pager = PrivatePathServiceGatewayAccountPoliciesPager(
+ pager = VpnServersPager(
client=_service,
- private_path_service_gateway_id='testString',
+ name='my-name',
limit=10,
- account_id='bb1b52262f7441a586f49068482f1e60',
+ resource_group_id='testString',
+ sort='name',
)
while pager.has_next():
next_page = pager.get_next()
@@ -53797,419 +54276,753 @@ def test_list_private_path_service_gateway_account_policies_with_pager_get_next(
assert len(all_results) == 2
@responses.activate
- def test_list_private_path_service_gateway_account_policies_with_pager_get_all(self):
+ def test_list_vpn_servers_with_pager_get_all(self):
+ """
+ test_list_vpn_servers_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_servers')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ mock_response2 = '{"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","enable_split_tunneling":true,"health_reasons":[{"code":"cannot_access_server_certificate","message":"Failed to get VPN server\'s server certificate from Secrets Manager.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}],"health_state":"ok","hostname":"a8506291.us-south.vpn-server.appdomain.cloud","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","id":"r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"tcp","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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VpnServersPager(
+ client=_service,
+ name='my-name',
+ limit=10,
+ resource_group_id='testString',
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateVpnServer:
+ """
+ Test Class for create_vpn_server
+ """
+
+ @responses.activate
+ def test_create_vpn_server_all_params(self):
+ """
+ create_vpn_server()
+ """
+ # Set up mock
+ url = preprocess_url('/vpn_servers')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 CertificateInstanceIdentityByCRN model
+ certificate_instance_identity_model = {}
+ certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Set up parameter values
+ 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_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={},
+ )
+
+ # 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['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_server_all_params_with_retries(self):
+ # Enable retries and run test_create_vpn_server_all_params.
+ _service.enable_retries()
+ self.test_create_vpn_server_all_params()
+
+ # Disable retries and run test_create_vpn_server_all_params.
+ _service.disable_retries()
+ self.test_create_vpn_server_all_params()
+
+ @responses.activate
+ def test_create_vpn_server_value_error(self):
+ """
+ test_create_vpn_server_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/vpn_servers')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 CertificateInstanceIdentityByCRN model
+ certificate_instance_identity_model = {}
+ certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # 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'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ # Set up parameter values
+ 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 = {
+ "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_server(**req_copy)
+
+ 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_server_value_error()
+
+ # Disable retries and run test_create_vpn_server_value_error.
+ _service.disable_retries()
+ self.test_create_vpn_server_value_error()
+
+
+class TestDeleteVpnServer:
+ """
+ Test Class for delete_vpn_server
+ """
+
+ @responses.activate
+ def test_delete_vpn_server_all_params(self):
"""
- test_list_private_path_service_gateway_account_policies_with_pager_get_all()
+ delete_vpn_server()
"""
- # Set up a two-page mock response
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"account_policies":[{"access_policy":"deny","account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c","id":"r006-7268d425-59b7-48fd-9735-81a7271657d5","resource_type":"private_path_service_gateway_account_policy"}]}'
- responses.add(
- responses.GET,
- url,
- body=mock_response1,
- content_type='application/json',
- status=200,
- )
+ # Set up mock
+ url = preprocess_url('/vpn_servers/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response2,
- content_type='application/json',
- status=200,
+ status=202,
)
- # Exercise the pager class for this operation
- pager = PrivatePathServiceGatewayAccountPoliciesPager(
- client=_service,
- private_path_service_gateway_id='testString',
- limit=10,
- account_id='bb1b52262f7441a586f49068482f1e60',
+ # Set up parameter values
+ id = 'testString'
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+
+ # Invoke method
+ response = _service.delete_vpn_server(
+ id,
+ if_match=if_match,
+ headers={},
)
- all_results = pager.get_all()
- assert all_results is not None
- assert len(all_results) == 2
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 202
-class TestCreatePrivatePathServiceGatewayAccountPolicy:
- """
- Test Class for create_private_path_service_gateway_account_policy
- """
+ 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_server_all_params()
+
+ # Disable retries and run test_delete_vpn_server_all_params.
+ _service.disable_retries()
+ self.test_delete_vpn_server_all_params()
@responses.activate
- def test_create_private_path_service_gateway_account_policy_all_params(self):
+ def test_delete_vpn_server_required_params(self):
"""
- create_private_path_service_gateway_account_policy()
+ test_delete_vpn_server_required_params()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
+ url = preprocess_url('/vpn_servers/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=202,
)
- # Construct a dict representation of a AccountIdentityById model
- account_identity_model = {}
- account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
-
# Set up parameter values
- private_path_service_gateway_id = 'testString'
- access_policy = 'deny'
- account = account_identity_model
+ id = 'testString'
# Invoke method
- response = _service.create_private_path_service_gateway_account_policy(
- private_path_service_gateway_id,
- access_policy,
- account,
+ response = _service.delete_vpn_server(
+ id,
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['access_policy'] == 'deny'
- assert req_body['account'] == account_identity_model
+ assert response.status_code == 202
- def test_create_private_path_service_gateway_account_policy_all_params_with_retries(self):
- # Enable retries and run test_create_private_path_service_gateway_account_policy_all_params.
+ 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_create_private_path_service_gateway_account_policy_all_params()
+ self.test_delete_vpn_server_required_params()
- # Disable retries and run test_create_private_path_service_gateway_account_policy_all_params.
+ # Disable retries and run test_delete_vpn_server_required_params.
_service.disable_retries()
- self.test_create_private_path_service_gateway_account_policy_all_params()
+ self.test_delete_vpn_server_required_params()
@responses.activate
- def test_create_private_path_service_gateway_account_policy_value_error(self):
+ def test_delete_vpn_server_value_error(self):
"""
- test_create_private_path_service_gateway_account_policy_value_error()
+ test_delete_vpn_server_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies')
- mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
+ url = preprocess_url('/vpn_servers/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=201,
+ status=202,
)
- # Construct a dict representation of a AccountIdentityById model
- account_identity_model = {}
- account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
-
# Set up parameter values
- private_path_service_gateway_id = 'testString'
- access_policy = 'deny'
- account = account_identity_model
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_gateway_id,
- "access_policy": access_policy,
- "account": account,
+ "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_private_path_service_gateway_account_policy(**req_copy)
+ _service.delete_vpn_server(**req_copy)
- def test_create_private_path_service_gateway_account_policy_value_error_with_retries(self):
- # Enable retries and run test_create_private_path_service_gateway_account_policy_value_error.
+ 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_create_private_path_service_gateway_account_policy_value_error()
+ self.test_delete_vpn_server_value_error()
- # Disable retries and run test_create_private_path_service_gateway_account_policy_value_error.
+ # Disable retries and run test_delete_vpn_server_value_error.
_service.disable_retries()
- self.test_create_private_path_service_gateway_account_policy_value_error()
+ self.test_delete_vpn_server_value_error()
-class TestDeletePrivatePathServiceGatewayAccountPolicy:
+class TestGetVpnServer:
"""
- Test Class for delete_private_path_service_gateway_account_policy
+ Test Class for get_vpn_server
"""
@responses.activate
- def test_delete_private_path_service_gateway_account_policy_all_params(self):
+ def test_get_vpn_server_all_params(self):
"""
- delete_private_path_service_gateway_account_policy()
+ get_vpn_server()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
+ url = preprocess_url('/vpn_servers/testString')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.delete_private_path_service_gateway_account_policy(
- private_path_service_gateway_id,
+ response = _service.get_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_delete_private_path_service_gateway_account_policy_all_params_with_retries(self):
- # Enable retries and run test_delete_private_path_service_gateway_account_policy_all_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_delete_private_path_service_gateway_account_policy_all_params()
+ self.test_get_vpn_server_all_params()
- # Disable retries and run test_delete_private_path_service_gateway_account_policy_all_params.
+ # Disable retries and run test_get_vpn_server_all_params.
_service.disable_retries()
- self.test_delete_private_path_service_gateway_account_policy_all_params()
+ self.test_get_vpn_server_all_params()
@responses.activate
- def test_delete_private_path_service_gateway_account_policy_value_error(self):
+ def test_get_vpn_server_value_error(self):
"""
- test_delete_private_path_service_gateway_account_policy_value_error()
+ test_get_vpn_server_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
+ url = preprocess_url('/vpn_servers/testString')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.DELETE,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_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_private_path_service_gateway_account_policy(**req_copy)
+ _service.get_vpn_server(**req_copy)
- def test_delete_private_path_service_gateway_account_policy_value_error_with_retries(self):
- # Enable retries and run test_delete_private_path_service_gateway_account_policy_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_delete_private_path_service_gateway_account_policy_value_error()
+ self.test_get_vpn_server_value_error()
- # Disable retries and run test_delete_private_path_service_gateway_account_policy_value_error.
+ # Disable retries and run test_get_vpn_server_value_error.
_service.disable_retries()
- self.test_delete_private_path_service_gateway_account_policy_value_error()
+ self.test_get_vpn_server_value_error()
-class TestGetPrivatePathServiceGatewayAccountPolicy:
+class TestUpdateVpnServer:
"""
- Test Class for get_private_path_service_gateway_account_policy
+ Test Class for update_vpn_server
"""
@responses.activate
- def test_get_private_path_service_gateway_account_policy_all_params(self):
+ def test_update_vpn_server_all_params(self):
"""
- get_private_path_service_gateway_account_policy()
+ update_vpn_server()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
- mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
+ url = preprocess_url('/vpn_servers/testString')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
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/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-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-updated'
+ vpn_server_patch_model['port'] = 443
+ vpn_server_patch_model['protocol'] = 'tcp'
+ vpn_server_patch_model['subnets'] = [subnet_identity_model]
+
+ # Set up parameter values
+ id = 'testString'
+ vpn_server_patch = vpn_server_patch_model
+ if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"'
+
+ # Invoke method
+ 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 == 200
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body == vpn_server_patch
+
+ 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_update_vpn_server_all_params()
+
+ # Disable retries and run test_update_vpn_server_all_params.
+ _service.disable_retries()
+ self.test_update_vpn_server_all_params()
+
+ @responses.activate
+ def test_update_vpn_server_required_params(self):
+ """
+ test_update_vpn_server_required_params()
+ """
+ # Set up mock
+ url = preprocess_url('/vpn_servers/testString')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-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 CertificateInstanceIdentityByCRN model
+ certificate_instance_identity_model = {}
+ certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-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-updated'
+ vpn_server_patch_model['port'] = 443
+ vpn_server_patch_model['protocol'] = 'tcp'
+ vpn_server_patch_model['subnets'] = [subnet_identity_model]
+
# Set up parameter values
- private_path_service_gateway_id = 'testString'
id = 'testString'
+ vpn_server_patch = vpn_server_patch_model
# Invoke method
- response = _service.get_private_path_service_gateway_account_policy(
- private_path_service_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 == 200
+ # Validate body params
+ req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
+ assert req_body == vpn_server_patch
- def test_get_private_path_service_gateway_account_policy_all_params_with_retries(self):
- # Enable retries and run test_get_private_path_service_gateway_account_policy_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_get_private_path_service_gateway_account_policy_all_params()
+ self.test_update_vpn_server_required_params()
- # Disable retries and run test_get_private_path_service_gateway_account_policy_all_params.
+ # Disable retries and run test_update_vpn_server_required_params.
_service.disable_retries()
- self.test_get_private_path_service_gateway_account_policy_all_params()
+ self.test_update_vpn_server_required_params()
@responses.activate
- def test_get_private_path_service_gateway_account_policy_value_error(self):
+ def test_update_vpn_server_value_error(self):
"""
- test_get_private_path_service_gateway_account_policy_value_error()
+ test_update_vpn_server_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
- mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
+ url = preprocess_url('/vpn_servers/testString')
+ mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34: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/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server\'s server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "id": "r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "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/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-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/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-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/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-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/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}'
responses.add(
- responses.GET,
+ responses.PATCH,
url,
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/aa2432b1fa4d4ace891e9b80fc104e34: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'] = '0717-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-updated'
+ vpn_server_patch_model['port'] = 443
+ vpn_server_patch_model['protocol'] = 'tcp'
+ vpn_server_patch_model['subnets'] = [subnet_identity_model]
+
# Set up parameter values
- private_path_service_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 = {
- "private_path_service_gateway_id": private_path_service_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.get_private_path_service_gateway_account_policy(**req_copy)
+ _service.update_vpn_server(**req_copy)
- def test_get_private_path_service_gateway_account_policy_value_error_with_retries(self):
- # Enable retries and run test_get_private_path_service_gateway_account_policy_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_get_private_path_service_gateway_account_policy_value_error()
+ self.test_update_vpn_server_value_error()
- # Disable retries and run test_get_private_path_service_gateway_account_policy_value_error.
+ # Disable retries and run test_update_vpn_server_value_error.
_service.disable_retries()
- self.test_get_private_path_service_gateway_account_policy_value_error()
+ self.test_update_vpn_server_value_error()
-class TestUpdatePrivatePathServiceGatewayAccountPolicy:
+class TestGetVpnServerClientConfiguration:
"""
- Test Class for update_private_path_service_gateway_account_policy
+ Test Class for get_vpn_server_client_configuration
"""
@responses.activate
- def test_update_private_path_service_gateway_account_policy_all_params(self):
+ def test_get_vpn_server_client_configuration_all_params(self):
"""
- update_private_path_service_gateway_account_policy()
+ get_vpn_server_client_configuration()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
- mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
+ 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.PATCH,
+ responses.GET,
url,
body=mock_response,
- content_type='application/json',
+ content_type='text/plain',
status=200,
)
- # Construct a dict representation of a PrivatePathServiceGatewayAccountPolicyPatch model
- private_path_service_gateway_account_policy_patch_model = {}
- private_path_service_gateway_account_policy_patch_model['access_policy'] = 'review'
-
# Set up parameter values
- private_path_service_gateway_id = 'testString'
id = 'testString'
- private_path_service_gateway_account_policy_patch = private_path_service_gateway_account_policy_patch_model
# Invoke method
- response = _service.update_private_path_service_gateway_account_policy(
- private_path_service_gateway_id,
+ response = _service.get_vpn_server_client_configuration(
id,
- private_path_service_gateway_account_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 == private_path_service_gateway_account_policy_patch
- def test_update_private_path_service_gateway_account_policy_all_params_with_retries(self):
- # Enable retries and run test_update_private_path_service_gateway_account_policy_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_update_private_path_service_gateway_account_policy_all_params()
+ self.test_get_vpn_server_client_configuration_all_params()
- # Disable retries and run test_update_private_path_service_gateway_account_policy_all_params.
+ # Disable retries and run test_get_vpn_server_client_configuration_all_params.
_service.disable_retries()
- self.test_update_private_path_service_gateway_account_policy_all_params()
+ self.test_get_vpn_server_client_configuration_all_params()
@responses.activate
- def test_update_private_path_service_gateway_account_policy_value_error(self):
+ def test_get_vpn_server_client_configuration_value_error(self):
"""
- test_update_private_path_service_gateway_account_policy_value_error()
+ test_get_vpn_server_client_configuration_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/account_policies/testString')
- mock_response = '{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r006-7268d425-59b7-48fd-9735-81a7271657d5", "resource_type": "private_path_service_gateway_account_policy"}'
+ 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.PATCH,
+ responses.GET,
url,
body=mock_response,
- content_type='application/json',
+ content_type='text/plain',
status=200,
)
- # Construct a dict representation of a PrivatePathServiceGatewayAccountPolicyPatch model
- private_path_service_gateway_account_policy_patch_model = {}
- private_path_service_gateway_account_policy_patch_model['access_policy'] = 'review'
-
# Set up parameter values
- private_path_service_gateway_id = 'testString'
id = 'testString'
- private_path_service_gateway_account_policy_patch = private_path_service_gateway_account_policy_patch_model
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_gateway_id,
"id": id,
- "private_path_service_gateway_account_policy_patch": private_path_service_gateway_account_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_private_path_service_gateway_account_policy(**req_copy)
+ _service.get_vpn_server_client_configuration(**req_copy)
- def test_update_private_path_service_gateway_account_policy_value_error_with_retries(self):
- # Enable retries and run test_update_private_path_service_gateway_account_policy_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_update_private_path_service_gateway_account_policy_value_error()
+ self.test_get_vpn_server_client_configuration_value_error()
- # Disable retries and run test_update_private_path_service_gateway_account_policy_value_error.
+ # Disable retries and run test_get_vpn_server_client_configuration_value_error.
_service.disable_retries()
- self.test_update_private_path_service_gateway_account_policy_value_error()
+ self.test_get_vpn_server_client_configuration_value_error()
-class TestListPrivatePathServiceGatewayEndpointGatewayBindings:
+class TestListVpnServerClients:
"""
- Test Class for list_private_path_service_gateway_endpoint_gateway_bindings
+ Test Class for list_vpn_server_clients
"""
@responses.activate
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params(self):
+ def test_list_vpn_server_clients_all_params(self):
"""
- list_private_path_service_gateway_endpoint_gateway_bindings()
+ list_vpn_server_clients()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
- mock_response = '{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -54219,19 +55032,17 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params(
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
start = 'testString'
limit = 50
- status = 'abandoned'
- account_id = 'bb1b52262f7441a586f49068482f1e60'
+ sort = 'created_at'
# Invoke method
- response = _service.list_private_path_service_gateway_endpoint_gateway_bindings(
- private_path_service_gateway_id,
+ response = _service.list_vpn_server_clients(
+ vpn_server_id,
start=start,
limit=limit,
- status=status,
- account_id=account_id,
+ sort=sort,
headers={},
)
@@ -54243,26 +55054,25 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params(
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
- assert 'account.id={}'.format(account_id) in query_string
-
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params.
+ assert 'sort={}'.format(sort) in query_string
+
+ 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_list_private_path_service_gateway_endpoint_gateway_bindings_all_params()
+ self.test_list_vpn_server_clients_all_params()
- # Disable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params.
+ # Disable retries and run test_list_vpn_server_clients_all_params.
_service.disable_retries()
- self.test_list_private_path_service_gateway_endpoint_gateway_bindings_all_params()
+ self.test_list_vpn_server_clients_all_params()
@responses.activate
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params(self):
+ def test_list_vpn_server_clients_required_params(self):
"""
- test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params()
+ test_list_vpn_server_clients_required_params()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
- mock_response = '{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -54272,11 +55082,11 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_required_pa
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
# Invoke method
- response = _service.list_private_path_service_gateway_endpoint_gateway_bindings(
- private_path_service_gateway_id,
+ response = _service.list_vpn_server_clients(
+ vpn_server_id,
headers={},
)
@@ -54284,23 +55094,23 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_required_pa
assert len(responses.calls) == 1
assert response.status_code == 200
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params.
+ 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_private_path_service_gateway_endpoint_gateway_bindings_required_params()
+ self.test_list_vpn_server_clients_required_params()
- # Disable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params.
+ # Disable retries and run test_list_vpn_server_clients_required_params.
_service.disable_retries()
- self.test_list_private_path_service_gateway_endpoint_gateway_bindings_required_params()
+ self.test_list_vpn_server_clients_required_params()
@responses.activate
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error(self):
+ def test_list_vpn_server_clients_value_error(self):
"""
- test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error()
+ test_list_vpn_server_clients_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
- mock_response = '{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
+ 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "total_count": 132}'
responses.add(
responses.GET,
url,
@@ -54310,35 +55120,35 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_gateway_id,
+ "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.list_private_path_service_gateway_endpoint_gateway_bindings(**req_copy)
+ _service.list_vpn_server_clients(**req_copy)
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error_with_retries(self):
- # Enable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_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_list_private_path_service_gateway_endpoint_gateway_bindings_value_error()
+ self.test_list_vpn_server_clients_value_error()
- # Disable retries and run test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error.
+ # Disable retries and run test_list_vpn_server_clients_value_error.
_service.disable_retries()
- self.test_list_private_path_service_gateway_endpoint_gateway_bindings_value_error()
+ self.test_list_vpn_server_clients_value_error()
@responses.activate
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_next(self):
+ def test_list_vpn_server_clients_with_pager_get_next(self):
"""
- test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_next()
+ test_list_vpn_server_clients_with_pager_get_next()
"""
# Set up a two-page mock response
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
+ url = preprocess_url('/vpn_servers/testString/clients')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -54356,12 +55166,11 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_
# Exercise the pager class for this operation
all_results = []
- pager = PrivatePathServiceGatewayEndpointGatewayBindingsPager(
+ pager = VpnServerClientsPager(
client=_service,
- private_path_service_gateway_id='testString',
+ vpn_server_id='testString',
limit=10,
- status='abandoned',
- account_id='bb1b52262f7441a586f49068482f1e60',
+ sort='created_at',
)
while pager.has_next():
next_page = pager.get_next()
@@ -54370,14 +55179,14 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_
assert len(all_results) == 2
@responses.activate
- def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_all(self):
+ def test_list_vpn_server_clients_with_pager_get_all(self):
"""
- test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_get_all()
+ test_list_vpn_server_clients_with_pager_get_all()
"""
# Set up a two-page mock response
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings')
- mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
- mock_response2 = '{"total_count":2,"limit":1,"endpoint_gateway_bindings":[{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"created_at":"2019-01-01T12:00:00.000Z","expiration_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","id":"r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0","lifecycle_state":"stable","resource_type":"private_path_service_gateway_endpoint_gateway_binding","status":"abandoned"}]}'
+ url = preprocess_url('/vpn_servers/testString/clients')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6","id":"r006-b37832e2-7abe-4b20-a292-c70b007569c6","remote_ip":{"address":"192.168.3.4"},"remote_port":22,"resource_type":"vpn_server_client","status":"connected","username":"username"}],"total_count":2,"limit":1}'
responses.add(
responses.GET,
url,
@@ -54394,588 +55203,827 @@ def test_list_private_path_service_gateway_endpoint_gateway_bindings_with_pager_
)
# Exercise the pager class for this operation
- pager = PrivatePathServiceGatewayEndpointGatewayBindingsPager(
+ pager = VpnServerClientsPager(
client=_service,
- private_path_service_gateway_id='testString',
+ vpn_server_id='testString',
limit=10,
- status='abandoned',
- account_id='bb1b52262f7441a586f49068482f1e60',
+ sort='created_at',
)
all_results = pager.get_all()
assert all_results is not None
assert len(all_results) == 2
-class TestGetPrivatePathServiceGatewayEndpointGatewayBinding:
+class TestDeleteVpnServerClient:
"""
- Test Class for get_private_path_service_gateway_endpoint_gateway_binding
+ Test Class for delete_vpn_server_client
"""
@responses.activate
- def test_get_private_path_service_gateway_endpoint_gateway_binding_all_params(self):
+ def test_delete_vpn_server_client_all_params(self):
"""
- get_private_path_service_gateway_endpoint_gateway_binding()
+ delete_vpn_server_client()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString')
- mock_response = '{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}'
+ url = preprocess_url('/vpn_servers/testString/clients/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.get_private_path_service_gateway_endpoint_gateway_binding(
- private_path_service_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_get_private_path_service_gateway_endpoint_gateway_binding_all_params_with_retries(self):
- # Enable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_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_get_private_path_service_gateway_endpoint_gateway_binding_all_params()
+ self.test_delete_vpn_server_client_all_params()
- # Disable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_all_params.
+ # Disable retries and run test_delete_vpn_server_client_all_params.
_service.disable_retries()
- self.test_get_private_path_service_gateway_endpoint_gateway_binding_all_params()
+ self.test_delete_vpn_server_client_all_params()
@responses.activate
- def test_get_private_path_service_gateway_endpoint_gateway_binding_value_error(self):
+ def test_delete_vpn_server_client_value_error(self):
"""
- test_get_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ test_delete_vpn_server_client_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString')
- mock_response = '{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r006-7268d425-59b7-48fd-9735-81a7271657d5/endpoint_gateway_bindings/r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "id": "r006-7c30adc3-083d-46a1-a72c-d0ca8654a1d0", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}'
+ url = preprocess_url('/vpn_servers/testString/clients/testString')
responses.add(
- responses.GET,
+ responses.DELETE,
url,
- body=mock_response,
- content_type='application/json',
- status=200,
+ status=202,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_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.get_private_path_service_gateway_endpoint_gateway_binding(**req_copy)
+ _service.delete_vpn_server_client(**req_copy)
- def test_get_private_path_service_gateway_endpoint_gateway_binding_value_error_with_retries(self):
- # Enable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_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_get_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ self.test_delete_vpn_server_client_value_error()
- # Disable retries and run test_get_private_path_service_gateway_endpoint_gateway_binding_value_error.
+ # Disable retries and run test_delete_vpn_server_client_value_error.
_service.disable_retries()
- self.test_get_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ self.test_delete_vpn_server_client_value_error()
-class TestDenyPrivatePathServiceGatewayEndpointGatewayBinding:
+class TestGetVpnServerClient:
"""
- Test Class for deny_private_path_service_gateway_endpoint_gateway_binding
+ Test Class for get_vpn_server_client
"""
@responses.activate
- def test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params(self):
+ def test_get_vpn_server_client_all_params(self):
"""
- deny_private_path_service_gateway_endpoint_gateway_binding()
+ get_vpn_server_client()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/deny')
+ 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
id = 'testString'
- set_account_policy = True
# Invoke method
- response = _service.deny_private_path_service_gateway_endpoint_gateway_binding(
- private_path_service_gateway_id,
+ response = _service.get_vpn_server_client(
+ vpn_server_id,
id,
- set_account_policy=set_account_policy,
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['set_account_policy'] == True
+ assert response.status_code == 200
- def test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params_with_retries(self):
- # Enable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_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_deny_private_path_service_gateway_endpoint_gateway_binding_all_params()
+ self.test_get_vpn_server_client_all_params()
- # Disable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params.
+ # Disable retries and run test_get_vpn_server_client_all_params.
_service.disable_retries()
- self.test_deny_private_path_service_gateway_endpoint_gateway_binding_all_params()
+ self.test_get_vpn_server_client_all_params()
@responses.activate
- def test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params(self):
+ def test_get_vpn_server_client_value_error(self):
"""
- test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params()
+ test_get_vpn_server_client_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/deny')
+ 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/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/clients/r006-b37832e2-7abe-4b20-a292-c70b007569c6", "id": "r006-b37832e2-7abe-4b20-a292-c70b007569c6", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Set up parameter values
+ vpn_server_id = 'testString'
+ id = 'testString'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "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.get_vpn_server_client(**req_copy)
+
+ 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_get_vpn_server_client_value_error()
+
+ # Disable retries and run test_get_vpn_server_client_value_error.
+ _service.disable_retries()
+ self.test_get_vpn_server_client_value_error()
+
+
+class TestDisconnectVpnClient:
+ """
+ Test Class for disconnect_vpn_client
+ """
+
+ @responses.activate
+ def test_disconnect_vpn_client_all_params(self):
+ """
+ disconnect_vpn_client()
+ """
+ # Set up mock
+ url = preprocess_url('/vpn_servers/testString/clients/testString/disconnect')
responses.add(
responses.POST,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
id = 'testString'
# Invoke method
- response = _service.deny_private_path_service_gateway_endpoint_gateway_binding(
- private_path_service_gateway_id,
+ response = _service.disconnect_vpn_client(
+ vpn_server_id,
id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 202
- def test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params_with_retries(self):
- # Enable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_required_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_deny_private_path_service_gateway_endpoint_gateway_binding_required_params()
+ self.test_disconnect_vpn_client_all_params()
- # Disable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params.
+ # Disable retries and run test_disconnect_vpn_client_all_params.
_service.disable_retries()
- self.test_deny_private_path_service_gateway_endpoint_gateway_binding_required_params()
+ self.test_disconnect_vpn_client_all_params()
@responses.activate
- def test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error(self):
+ def test_disconnect_vpn_client_value_error(self):
"""
- test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ test_disconnect_vpn_client_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/deny')
+ url = preprocess_url('/vpn_servers/testString/clients/testString/disconnect')
responses.add(
responses.POST,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_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.deny_private_path_service_gateway_endpoint_gateway_binding(**req_copy)
+ _service.disconnect_vpn_client(**req_copy)
- def test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error_with_retries(self):
- # Enable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error.
+ 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_deny_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ self.test_disconnect_vpn_client_value_error()
- # Disable retries and run test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error.
+ # Disable retries and run test_disconnect_vpn_client_value_error.
_service.disable_retries()
- self.test_deny_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ self.test_disconnect_vpn_client_value_error()
-class TestPermitPrivatePathServiceGatewayEndpointGatewayBinding:
+class TestListVpnServerRoutes:
"""
- Test Class for permit_private_path_service_gateway_endpoint_gateway_binding
+ Test Class for list_vpn_server_routes
"""
@responses.activate
- def test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params(self):
+ def test_list_vpn_server_routes_all_params(self):
"""
- permit_private_path_service_gateway_endpoint_gateway_binding()
+ list_vpn_server_routes()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/permit')
+ url = preprocess_url('/vpn_servers/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
- id = 'testString'
- set_account_policy = True
+ vpn_server_id = 'testString'
+ start = 'testString'
+ limit = 50
+ sort = 'name'
# Invoke method
- response = _service.permit_private_path_service_gateway_endpoint_gateway_binding(
- private_path_service_gateway_id,
- id,
- set_account_policy=set_account_policy,
+ 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 == 204
- # Validate body params
- req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
- assert req_body['set_account_policy'] == True
+ 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_permit_private_path_service_gateway_endpoint_gateway_binding_all_params_with_retries(self):
- # Enable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params.
+ 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_permit_private_path_service_gateway_endpoint_gateway_binding_all_params()
+ self.test_list_vpn_server_routes_all_params()
- # Disable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params.
+ # Disable retries and run test_list_vpn_server_routes_all_params.
_service.disable_retries()
- self.test_permit_private_path_service_gateway_endpoint_gateway_binding_all_params()
+ self.test_list_vpn_server_routes_all_params()
@responses.activate
- def test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params(self):
+ def test_list_vpn_server_routes_required_params(self):
"""
- test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params()
+ test_list_vpn_server_routes_required_params()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/permit')
+ url = preprocess_url('/vpn_servers/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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'
+
+ # Invoke method
+ response = _service.list_vpn_server_routes(
+ vpn_server_id,
+ headers={},
+ )
+
+ # Check for correct operation
+ assert len(responses.calls) == 1
+ assert response.status_code == 200
+
+ 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_list_vpn_server_routes_required_params()
+
+ # Disable retries and run test_list_vpn_server_routes_required_params.
+ _service.disable_retries()
+ self.test_list_vpn_server_routes_required_params()
+
+ @responses.activate
+ def test_list_vpn_server_routes_value_error(self):
+ """
+ test_list_vpn_server_routes_value_error()
+ """
+ # Set up mock
+ url = preprocess_url('/vpn_servers/testString/routes')
+ mock_response = '{"first": {"href": "href"}, "limit": 20, "next": {"href": "href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "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'
+
+ # Pass in all but one required param and check for a ValueError
+ req_param_dict = {
+ "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.list_vpn_server_routes(**req_copy)
+
+ 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_list_vpn_server_routes_value_error()
+
+ # Disable retries and run test_list_vpn_server_routes_value_error.
+ _service.disable_retries()
+ self.test_list_vpn_server_routes_value_error()
+
+ @responses.activate
+ def test_list_vpn_server_routes_with_pager_get_next(self):
+ """
+ test_list_vpn_server_routes_with_pager_get_next()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_servers/testString/routes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ all_results = []
+ pager = VpnServerRoutesPager(
+ client=_service,
+ vpn_server_id='testString',
+ limit=10,
+ sort='name',
+ )
+ while pager.has_next():
+ next_page = pager.get_next()
+ assert next_page is not None
+ all_results.extend(next_page)
+ assert len(all_results) == 2
+
+ @responses.activate
+ def test_list_vpn_server_routes_with_pager_get_all(self):
+ """
+ test_list_vpn_server_routes_with_pager_get_all()
+ """
+ # Set up a two-page mock response
+ url = preprocess_url('/vpn_servers/testString/routes')
+ mock_response1 = '{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
+ mock_response2 = '{"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","health_reasons":[{"code":"internal_error","message":"Internal error (contact IBM support).","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"r006-1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}'
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response1,
+ content_type='application/json',
+ status=200,
+ )
+ responses.add(
+ responses.GET,
+ url,
+ body=mock_response2,
+ content_type='application/json',
+ status=200,
+ )
+
+ # Exercise the pager class for this operation
+ pager = VpnServerRoutesPager(
+ client=_service,
+ vpn_server_id='testString',
+ limit=10,
+ sort='name',
+ )
+ all_results = pager.get_all()
+ assert all_results is not None
+ assert len(all_results) == 2
+
+
+class TestCreateVpnServerRoute:
+ """
+ Test Class for create_vpn_server_route
+ """
+
+ @responses.activate
+ def test_create_vpn_server_route_all_params(self):
+ """
+ create_vpn_server_route()
+ """
+ # Set up mock
+ 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
responses.add(
responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
# Set up parameter values
- private_path_service_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.permit_private_path_service_gateway_endpoint_gateway_binding(
- private_path_service_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 == 204
+ 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_permit_private_path_service_gateway_endpoint_gateway_binding_required_params_with_retries(self):
- # Enable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_required_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_permit_private_path_service_gateway_endpoint_gateway_binding_required_params()
+ self.test_create_vpn_server_route_all_params()
- # Disable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params.
+ # Disable retries and run test_create_vpn_server_route_all_params.
_service.disable_retries()
- self.test_permit_private_path_service_gateway_endpoint_gateway_binding_required_params()
+ self.test_create_vpn_server_route_all_params()
@responses.activate
- def test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error(self):
+ def test_create_vpn_server_route_value_error(self):
"""
- test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ test_create_vpn_server_route_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/endpoint_gateway_bindings/testString/permit')
+ 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
responses.add(
responses.POST,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=201,
)
# Set up parameter values
- private_path_service_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 = {
- "private_path_service_gateway_id": private_path_service_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.permit_private_path_service_gateway_endpoint_gateway_binding(**req_copy)
+ _service.create_vpn_server_route(**req_copy)
- def test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error_with_retries(self):
- # Enable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_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_permit_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ self.test_create_vpn_server_route_value_error()
- # Disable retries and run test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error.
+ # Disable retries and run test_create_vpn_server_route_value_error.
_service.disable_retries()
- self.test_permit_private_path_service_gateway_endpoint_gateway_binding_value_error()
+ self.test_create_vpn_server_route_value_error()
-class TestPublishPrivatePathServiceGateway:
+class TestDeleteVpnServerRoute:
"""
- Test Class for publish_private_path_service_gateway
+ Test Class for delete_vpn_server_route
"""
@responses.activate
- def test_publish_private_path_service_gateway_all_params(self):
+ def test_delete_vpn_server_route_all_params(self):
"""
- publish_private_path_service_gateway()
+ delete_vpn_server_route()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/publish')
+ url = preprocess_url('/vpn_servers/testString/routes/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.publish_private_path_service_gateway(
- private_path_service_gateway_id,
+ response = _service.delete_vpn_server_route(
+ vpn_server_id,
+ id,
headers={},
)
# Check for correct operation
assert len(responses.calls) == 1
- assert response.status_code == 204
+ assert response.status_code == 202
- def test_publish_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_publish_private_path_service_gateway_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_publish_private_path_service_gateway_all_params()
+ self.test_delete_vpn_server_route_all_params()
- # Disable retries and run test_publish_private_path_service_gateway_all_params.
+ # Disable retries and run test_delete_vpn_server_route_all_params.
_service.disable_retries()
- self.test_publish_private_path_service_gateway_all_params()
+ self.test_delete_vpn_server_route_all_params()
@responses.activate
- def test_publish_private_path_service_gateway_value_error(self):
+ def test_delete_vpn_server_route_value_error(self):
"""
- test_publish_private_path_service_gateway_value_error()
+ test_delete_vpn_server_route_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/publish')
+ url = preprocess_url('/vpn_servers/testString/routes/testString')
responses.add(
- responses.POST,
+ responses.DELETE,
url,
- status=204,
+ status=202,
)
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_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.publish_private_path_service_gateway(**req_copy)
+ _service.delete_vpn_server_route(**req_copy)
- def test_publish_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_publish_private_path_service_gateway_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_publish_private_path_service_gateway_value_error()
+ self.test_delete_vpn_server_route_value_error()
- # Disable retries and run test_publish_private_path_service_gateway_value_error.
+ # Disable retries and run test_delete_vpn_server_route_value_error.
_service.disable_retries()
- self.test_publish_private_path_service_gateway_value_error()
+ self.test_delete_vpn_server_route_value_error()
-class TestRevokeAccountForPrivatePathServiceGateway:
+class TestGetVpnServerRoute:
"""
- Test Class for revoke_account_for_private_path_service_gateway
+ Test Class for get_vpn_server_route
"""
@responses.activate
- def test_revoke_account_for_private_path_service_gateway_all_params(self):
+ def test_get_vpn_server_route_all_params(self):
"""
- revoke_account_for_private_path_service_gateway()
+ get_vpn_server_route()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/revoke_account')
+ 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Construct a dict representation of a AccountIdentityById model
- account_identity_model = {}
- account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
-
# Set up parameter values
- private_path_service_gateway_id = 'testString'
- account = account_identity_model
+ vpn_server_id = 'testString'
+ id = 'testString'
# Invoke method
- response = _service.revoke_account_for_private_path_service_gateway(
- private_path_service_gateway_id,
- account,
+ response = _service.get_vpn_server_route(
+ vpn_server_id,
+ id,
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['account'] == account_identity_model
+ assert response.status_code == 200
- def test_revoke_account_for_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_revoke_account_for_private_path_service_gateway_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_revoke_account_for_private_path_service_gateway_all_params()
+ self.test_get_vpn_server_route_all_params()
- # Disable retries and run test_revoke_account_for_private_path_service_gateway_all_params.
+ # Disable retries and run test_get_vpn_server_route_all_params.
_service.disable_retries()
- self.test_revoke_account_for_private_path_service_gateway_all_params()
+ self.test_get_vpn_server_route_all_params()
@responses.activate
- def test_revoke_account_for_private_path_service_gateway_value_error(self):
+ def test_get_vpn_server_route_value_error(self):
"""
- test_revoke_account_for_private_path_service_gateway_value_error()
+ test_get_vpn_server_route_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/revoke_account')
+ 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
responses.add(
- responses.POST,
+ responses.GET,
url,
- status=204,
+ body=mock_response,
+ content_type='application/json',
+ status=200,
)
- # Construct a dict representation of a AccountIdentityById model
- account_identity_model = {}
- account_identity_model['id'] = 'bb1b52262f7441a586f49068482f1e60'
-
# Set up parameter values
- private_path_service_gateway_id = 'testString'
- account = account_identity_model
+ vpn_server_id = 'testString'
+ id = 'testString'
# Pass in all but one required param and check for a ValueError
req_param_dict = {
- "private_path_service_gateway_id": private_path_service_gateway_id,
- "account": account,
+ "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.revoke_account_for_private_path_service_gateway(**req_copy)
+ _service.get_vpn_server_route(**req_copy)
- def test_revoke_account_for_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_revoke_account_for_private_path_service_gateway_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_revoke_account_for_private_path_service_gateway_value_error()
+ self.test_get_vpn_server_route_value_error()
- # Disable retries and run test_revoke_account_for_private_path_service_gateway_value_error.
+ # Disable retries and run test_get_vpn_server_route_value_error.
_service.disable_retries()
- self.test_revoke_account_for_private_path_service_gateway_value_error()
+ self.test_get_vpn_server_route_value_error()
-class TestUnpublishPrivatePathServiceGateway:
+class TestUpdateVpnServerRoute:
"""
- Test Class for unpublish_private_path_service_gateway
+ Test Class for update_vpn_server_route
"""
@responses.activate
- def test_unpublish_private_path_service_gateway_all_params(self):
+ def test_update_vpn_server_route_all_params(self):
"""
- unpublish_private_path_service_gateway()
+ update_vpn_server_route()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/unpublish')
+ 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
responses.add(
- responses.POST,
+ 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-server-route-updated'
+
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
+ id = 'testString'
+ vpn_server_route_patch = vpn_server_route_patch_model
# Invoke method
- response = _service.unpublish_private_path_service_gateway(
- private_path_service_gateway_id,
+ response = _service.update_vpn_server_route(
+ vpn_server_id,
+ id,
+ 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_unpublish_private_path_service_gateway_all_params_with_retries(self):
- # Enable retries and run test_unpublish_private_path_service_gateway_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_unpublish_private_path_service_gateway_all_params()
+ self.test_update_vpn_server_route_all_params()
- # Disable retries and run test_unpublish_private_path_service_gateway_all_params.
+ # Disable retries and run test_update_vpn_server_route_all_params.
_service.disable_retries()
- self.test_unpublish_private_path_service_gateway_all_params()
+ self.test_update_vpn_server_route_all_params()
@responses.activate
- def test_unpublish_private_path_service_gateway_value_error(self):
+ def test_update_vpn_server_route_value_error(self):
"""
- test_unpublish_private_path_service_gateway_value_error()
+ test_update_vpn_server_route_value_error()
"""
# Set up mock
- url = preprocess_url('/private_path_service_gateways/testString/unpublish')
+ 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", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-4ec65fe4-e68f-44ff-bc94-c9caf6123b5f/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}'
responses.add(
- responses.POST,
+ 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-server-route-updated'
+
# Set up parameter values
- private_path_service_gateway_id = 'testString'
+ vpn_server_id = 'testString'
+ id = '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 = {
- "private_path_service_gateway_id": private_path_service_gateway_id,
+ "vpn_server_id": vpn_server_id,
+ "id": id,
+ "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.unpublish_private_path_service_gateway(**req_copy)
+ _service.update_vpn_server_route(**req_copy)
- def test_unpublish_private_path_service_gateway_value_error_with_retries(self):
- # Enable retries and run test_unpublish_private_path_service_gateway_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_unpublish_private_path_service_gateway_value_error()
+ self.test_update_vpn_server_route_value_error()
- # Disable retries and run test_unpublish_private_path_service_gateway_value_error.
+ # Disable retries and run test_update_vpn_server_route_value_error.
_service.disable_retries()
- self.test_unpublish_private_path_service_gateway_value_error()
+ self.test_update_vpn_server_route_value_error()
# endregion
##############################################################################
-# End of Service: PrivatePathServiceGateways
+# End of Service: VPNServers
##############################################################################
@@ -56193,7 +57241,240 @@ def test_bare_metal_server_serialization(self):
bare_metal_server_cpu_model['socket_count'] = 4
bare_metal_server_cpu_model['threads_per_core'] = 2
+ bare_metal_server_disk_allowed_use_model = {} # BareMetalServerDiskAllowedUse
+ bare_metal_server_disk_allowed_use_model['api_version'] = '2025-03-31'
+ bare_metal_server_disk_allowed_use_model['bare_metal_server'] = 'true'
+
+ bare_metal_server_disk_model = {} # BareMetalServerDisk
+ bare_metal_server_disk_model['allowed_use'] = bare_metal_server_disk_allowed_use_model
+ bare_metal_server_disk_model['created_at'] = '2024-10-23T06:09:15Z'
+ bare_metal_server_disk_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
+ bare_metal_server_disk_model['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
+ bare_metal_server_disk_model['interface_type'] = 'sata'
+ bare_metal_server_disk_model['name'] = 'my-bare-metal-server-disk'
+ bare_metal_server_disk_model['resource_type'] = 'bare_metal_server_disk'
+ bare_metal_server_disk_model['size'] = 960
+
+ bare_metal_server_firmware_model = {} # BareMetalServerFirmware
+ bare_metal_server_firmware_model['update'] = 'none'
+
+ bare_metal_server_health_reason_model = {} # BareMetalServerHealthReason
+ bare_metal_server_health_reason_model['code'] = 'reservation_expired'
+ bare_metal_server_health_reason_model['message'] = 'The reservation cannot be used because it has expired.'
+ bare_metal_server_health_reason_model['more_info'] = 'https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons'
+
+ bare_metal_server_lifecycle_reason_model = {} # BareMetalServerLifecycleReason
+ bare_metal_server_lifecycle_reason_model['code'] = 'resource_suspended_by_provider'
+ bare_metal_server_lifecycle_reason_model['message'] = 'The resource has been suspended. Contact IBM support with the CRN for next steps.'
+ bare_metal_server_lifecycle_reason_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#resource-suspension'
+
+ bare_metal_server_metadata_service_model = {} # BareMetalServerMetadataService
+ bare_metal_server_metadata_service_model['enabled'] = True
+ bare_metal_server_metadata_service_model['protocol'] = 'https'
+
+ reserved_ip_reference_model = {} # ReservedIPReference
+ reserved_ip_reference_model['address'] = '10.0.1.5'
+ reserved_ip_reference_model['deleted'] = deleted_model
+ reserved_ip_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+ reserved_ip_reference_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+ reserved_ip_reference_model['name'] = 'my-reserved-ip-z1'
+ reserved_ip_reference_model['resource_type'] = 'subnet_reserved_ip'
+
+ subnet_reference_model = {} # SubnetReference
+ subnet_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ subnet_reference_model['deleted'] = deleted_model
+ subnet_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ subnet_reference_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+ subnet_reference_model['name'] = 'my-subnet'
+ subnet_reference_model['resource_type'] = 'subnet'
+
+ virtual_network_interface_reference_attachment_context_model = {} # VirtualNetworkInterfaceReferenceAttachmentContext
+ virtual_network_interface_reference_attachment_context_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
+ virtual_network_interface_reference_attachment_context_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
+ virtual_network_interface_reference_attachment_context_model['id'] = '0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
+ virtual_network_interface_reference_attachment_context_model['name'] = 'my-virtual-network-interface'
+ virtual_network_interface_reference_attachment_context_model['resource_type'] = 'virtual_network_interface'
+
+ bare_metal_server_network_attachment_reference_model = {} # BareMetalServerNetworkAttachmentReference
+ bare_metal_server_network_attachment_reference_model['deleted'] = deleted_model
+ bare_metal_server_network_attachment_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
+ bare_metal_server_network_attachment_reference_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
+ bare_metal_server_network_attachment_reference_model['name'] = 'my-bare-metal-server-network-attachment'
+ bare_metal_server_network_attachment_reference_model['primary_ip'] = reserved_ip_reference_model
+ bare_metal_server_network_attachment_reference_model['resource_type'] = 'bare_metal_server_network_attachment'
+ bare_metal_server_network_attachment_reference_model['subnet'] = subnet_reference_model
+ bare_metal_server_network_attachment_reference_model['virtual_network_interface'] = virtual_network_interface_reference_attachment_context_model
+
+ network_interface_bare_metal_server_context_reference_model = {} # NetworkInterfaceBareMetalServerContextReference
+ network_interface_bare_metal_server_context_reference_model['deleted'] = deleted_model
+ network_interface_bare_metal_server_context_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
+ network_interface_bare_metal_server_context_reference_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
+ network_interface_bare_metal_server_context_reference_model['name'] = 'my-primary-network-interface'
+ network_interface_bare_metal_server_context_reference_model['primary_ip'] = reserved_ip_reference_model
+ network_interface_bare_metal_server_context_reference_model['resource_type'] = 'network_interface'
+ network_interface_bare_metal_server_context_reference_model['subnet'] = subnet_reference_model
+
+ bare_metal_server_profile_reference_model = {} # BareMetalServerProfileReference
+ bare_metal_server_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_server/profiles/bx2-metal-192x768'
+ bare_metal_server_profile_reference_model['name'] = 'bx2-metal-192x768'
+ bare_metal_server_profile_reference_model['resource_type'] = 'bare_metal_server_profile'
+
+ reservation_reference_model = {} # ReservationReference
+ reservation_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+ reservation_reference_model['deleted'] = deleted_model
+ reservation_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+ reservation_reference_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
+ reservation_reference_model['name'] = 'my-reservation'
+ reservation_reference_model['resource_type'] = 'reservation'
+
+ bare_metal_server_reservation_affinity_model = {} # BareMetalServerReservationAffinity
+ bare_metal_server_reservation_affinity_model['policy'] = 'disabled'
+ bare_metal_server_reservation_affinity_model['pool'] = [reservation_reference_model]
+
+ 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'] = 'Default'
+
+ bare_metal_server_status_reason_model = {} # BareMetalServerStatusReason
+ bare_metal_server_status_reason_model['code'] = 'cannot_start_capacity'
+ bare_metal_server_status_reason_model['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.'
+ bare_metal_server_status_reason_model['more_info'] = 'https://console.bluemix.net/docs/iaas/bare_metal_server.html'
+
+ bare_metal_server_trusted_platform_module_model = {} # BareMetalServerTrustedPlatformModule
+ bare_metal_server_trusted_platform_module_model['enabled'] = False
+ bare_metal_server_trusted_platform_module_model['mode'] = 'disabled'
+ bare_metal_server_trusted_platform_module_model['supported_modes'] = ['disabled', 'tpm_2']
+
+ vpc_reference_model = {} # VPCReference
+ vpc_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_reference_model['deleted'] = deleted_model
+ vpc_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_reference_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_reference_model['name'] = 'my-vpc'
+ vpc_reference_model['resource_type'] = 'vpc'
+
+ zone_reference_model = {} # ZoneReference
+ zone_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1'
+ zone_reference_model['name'] = 'us-south-1'
+
+ # Construct a json representation of a BareMetalServer model
+ bare_metal_server_model_json = {}
+ bare_metal_server_model_json['bandwidth'] = 20000
+ bare_metal_server_model_json['boot_target'] = bare_metal_server_boot_target_model
+ bare_metal_server_model_json['cpu'] = bare_metal_server_cpu_model
+ bare_metal_server_model_json['created_at'] = '2019-01-01T12:00:00Z'
+ bare_metal_server_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304'
+ bare_metal_server_model_json['disks'] = [bare_metal_server_disk_model]
+ bare_metal_server_model_json['enable_secure_boot'] = False
+ bare_metal_server_model_json['firmware'] = bare_metal_server_firmware_model
+ bare_metal_server_model_json['health_reasons'] = [bare_metal_server_health_reason_model]
+ bare_metal_server_model_json['health_state'] = 'ok'
+ bare_metal_server_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304'
+ bare_metal_server_model_json['id'] = '0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304'
+ bare_metal_server_model_json['lifecycle_reasons'] = [bare_metal_server_lifecycle_reason_model]
+ bare_metal_server_model_json['lifecycle_state'] = 'stable'
+ bare_metal_server_model_json['memory'] = 1536
+ bare_metal_server_model_json['metadata_service'] = bare_metal_server_metadata_service_model
+ bare_metal_server_model_json['name'] = 'my-bare-metal-server'
+ bare_metal_server_model_json['network_attachments'] = [bare_metal_server_network_attachment_reference_model]
+ bare_metal_server_model_json['network_interfaces'] = [network_interface_bare_metal_server_context_reference_model]
+ bare_metal_server_model_json['primary_network_attachment'] = bare_metal_server_network_attachment_reference_model
+ bare_metal_server_model_json['primary_network_interface'] = network_interface_bare_metal_server_context_reference_model
+ bare_metal_server_model_json['profile'] = bare_metal_server_profile_reference_model
+ bare_metal_server_model_json['reservation'] = reservation_reference_model
+ bare_metal_server_model_json['reservation_affinity'] = bare_metal_server_reservation_affinity_model
+ bare_metal_server_model_json['resource_group'] = resource_group_reference_model
+ bare_metal_server_model_json['resource_type'] = 'bare_metal_server'
+ bare_metal_server_model_json['status'] = 'deleting'
+ bare_metal_server_model_json['status_reasons'] = [bare_metal_server_status_reason_model]
+ bare_metal_server_model_json['trusted_platform_module'] = bare_metal_server_trusted_platform_module_model
+ bare_metal_server_model_json['vpc'] = vpc_reference_model
+ bare_metal_server_model_json['zone'] = zone_reference_model
+
+ # Construct a model instance of BareMetalServer by calling from_dict on the json representation
+ bare_metal_server_model = BareMetalServer.from_dict(bare_metal_server_model_json)
+ assert bare_metal_server_model != False
+
+ # Construct a model instance of BareMetalServer by calling from_dict on the json representation
+ bare_metal_server_model_dict = BareMetalServer.from_dict(bare_metal_server_model_json).__dict__
+ bare_metal_server_model2 = BareMetalServer(**bare_metal_server_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_model == bare_metal_server_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_model_json2 = bare_metal_server_model.to_dict()
+ assert bare_metal_server_model_json2 == bare_metal_server_model_json
+
+
+class TestModel_BareMetalServerCPU:
+ """
+ Test Class for BareMetalServerCPU
+ """
+
+ def test_bare_metal_server_cpu_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerCPU
+ """
+
+ # Construct a json representation of a BareMetalServerCPU model
+ bare_metal_server_cpu_model_json = {}
+ bare_metal_server_cpu_model_json['architecture'] = 'amd64'
+ bare_metal_server_cpu_model_json['core_count'] = 80
+ bare_metal_server_cpu_model_json['socket_count'] = 4
+ bare_metal_server_cpu_model_json['threads_per_core'] = 2
+
+ # Construct a model instance of BareMetalServerCPU by calling from_dict on the json representation
+ bare_metal_server_cpu_model = BareMetalServerCPU.from_dict(bare_metal_server_cpu_model_json)
+ assert bare_metal_server_cpu_model != False
+
+ # Construct a model instance of BareMetalServerCPU by calling from_dict on the json representation
+ bare_metal_server_cpu_model_dict = BareMetalServerCPU.from_dict(bare_metal_server_cpu_model_json).__dict__
+ bare_metal_server_cpu_model2 = BareMetalServerCPU(**bare_metal_server_cpu_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_cpu_model == bare_metal_server_cpu_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_cpu_model_json2 = bare_metal_server_cpu_model.to_dict()
+ assert bare_metal_server_cpu_model_json2 == bare_metal_server_cpu_model_json
+
+
+class TestModel_BareMetalServerCollection:
+ """
+ Test Class for BareMetalServerCollection
+ """
+
+ def test_bare_metal_server_collection_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerCollection
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ deleted_model = {} # Deleted
+ deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
+
+ bare_metal_server_boot_target_model = {} # BareMetalServerBootTargetBareMetalServerDiskReference
+ bare_metal_server_boot_target_model['deleted'] = deleted_model
+ bare_metal_server_boot_target_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
+ bare_metal_server_boot_target_model['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
+ bare_metal_server_boot_target_model['name'] = 'my-bare-metal-server-disk'
+ bare_metal_server_boot_target_model['resource_type'] = 'bare_metal_server_disk'
+
+ bare_metal_server_cpu_model = {} # BareMetalServerCPU
+ bare_metal_server_cpu_model['architecture'] = 'amd64'
+ bare_metal_server_cpu_model['core_count'] = 96
+ bare_metal_server_cpu_model['socket_count'] = 4
+ bare_metal_server_cpu_model['threads_per_core'] = 2
+
+ bare_metal_server_disk_allowed_use_model = {} # BareMetalServerDiskAllowedUse
+ bare_metal_server_disk_allowed_use_model['api_version'] = '2025-03-31'
+ bare_metal_server_disk_allowed_use_model['bare_metal_server'] = 'true'
+
bare_metal_server_disk_model = {} # BareMetalServerDisk
+ bare_metal_server_disk_model['allowed_use'] = bare_metal_server_disk_allowed_use_model
bare_metal_server_disk_model['created_at'] = '2024-10-23T06:09:15Z'
bare_metal_server_disk_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
bare_metal_server_disk_model['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
@@ -56215,223 +57496,9 @@ def test_bare_metal_server_serialization(self):
bare_metal_server_lifecycle_reason_model['message'] = 'The resource has been suspended. Contact IBM support with the CRN for next steps.'
bare_metal_server_lifecycle_reason_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#resource-suspension'
- reserved_ip_reference_model = {} # ReservedIPReference
- reserved_ip_reference_model['address'] = '10.0.1.5'
- reserved_ip_reference_model['deleted'] = deleted_model
- reserved_ip_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
- reserved_ip_reference_model['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
- reserved_ip_reference_model['name'] = 'my-reserved-ip-z1'
- reserved_ip_reference_model['resource_type'] = 'subnet_reserved_ip'
-
- subnet_reference_model = {} # SubnetReference
- subnet_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- subnet_reference_model['deleted'] = deleted_model
- subnet_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- subnet_reference_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- subnet_reference_model['name'] = 'my-subnet'
- subnet_reference_model['resource_type'] = 'subnet'
-
- virtual_network_interface_reference_attachment_context_model = {} # VirtualNetworkInterfaceReferenceAttachmentContext
- virtual_network_interface_reference_attachment_context_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
- virtual_network_interface_reference_attachment_context_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
- virtual_network_interface_reference_attachment_context_model['id'] = '0717-54eb57ee-86f2-4796-90bb-d7874e0831ef'
- virtual_network_interface_reference_attachment_context_model['name'] = 'my-virtual-network-interface'
- virtual_network_interface_reference_attachment_context_model['resource_type'] = 'virtual_network_interface'
-
- bare_metal_server_network_attachment_reference_model = {} # BareMetalServerNetworkAttachmentReference
- bare_metal_server_network_attachment_reference_model['deleted'] = deleted_model
- bare_metal_server_network_attachment_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
- bare_metal_server_network_attachment_reference_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
- bare_metal_server_network_attachment_reference_model['name'] = 'my-bare-metal-server-network-attachment'
- bare_metal_server_network_attachment_reference_model['primary_ip'] = reserved_ip_reference_model
- bare_metal_server_network_attachment_reference_model['resource_type'] = 'bare_metal_server_network_attachment'
- bare_metal_server_network_attachment_reference_model['subnet'] = subnet_reference_model
- bare_metal_server_network_attachment_reference_model['virtual_network_interface'] = virtual_network_interface_reference_attachment_context_model
-
- network_interface_bare_metal_server_context_reference_model = {} # NetworkInterfaceBareMetalServerContextReference
- network_interface_bare_metal_server_context_reference_model['deleted'] = deleted_model
- network_interface_bare_metal_server_context_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
- network_interface_bare_metal_server_context_reference_model['id'] = '0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6'
- network_interface_bare_metal_server_context_reference_model['name'] = 'my-primary-network-interface'
- network_interface_bare_metal_server_context_reference_model['primary_ip'] = reserved_ip_reference_model
- network_interface_bare_metal_server_context_reference_model['resource_type'] = 'network_interface'
- network_interface_bare_metal_server_context_reference_model['subnet'] = subnet_reference_model
-
- bare_metal_server_profile_reference_model = {} # BareMetalServerProfileReference
- bare_metal_server_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_server/profiles/bx2-metal-192x768'
- bare_metal_server_profile_reference_model['name'] = 'bx2-metal-192x768'
- bare_metal_server_profile_reference_model['resource_type'] = 'bare_metal_server_profile'
-
- reservation_reference_model = {} # ReservationReference
- reservation_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- reservation_reference_model['deleted'] = deleted_model
- reservation_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- reservation_reference_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
- reservation_reference_model['name'] = 'my-reservation'
- reservation_reference_model['resource_type'] = 'reservation'
-
- bare_metal_server_reservation_affinity_model = {} # BareMetalServerReservationAffinity
- bare_metal_server_reservation_affinity_model['policy'] = 'disabled'
- bare_metal_server_reservation_affinity_model['pool'] = [reservation_reference_model]
-
- 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'] = 'Default'
-
- bare_metal_server_status_reason_model = {} # BareMetalServerStatusReason
- bare_metal_server_status_reason_model['code'] = 'cannot_start_capacity'
- bare_metal_server_status_reason_model['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.'
- bare_metal_server_status_reason_model['more_info'] = 'https://console.bluemix.net/docs/iaas/bare_metal_server.html'
-
- bare_metal_server_trusted_platform_module_model = {} # BareMetalServerTrustedPlatformModule
- bare_metal_server_trusted_platform_module_model['enabled'] = False
- bare_metal_server_trusted_platform_module_model['mode'] = 'disabled'
- bare_metal_server_trusted_platform_module_model['supported_modes'] = ['disabled', 'tpm_2']
-
- vpc_reference_model = {} # VPCReference
- vpc_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_reference_model['deleted'] = deleted_model
- vpc_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_reference_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
- vpc_reference_model['name'] = 'my-vpc'
- vpc_reference_model['resource_type'] = 'vpc'
-
- zone_reference_model = {} # ZoneReference
- zone_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1'
- zone_reference_model['name'] = 'us-south-1'
-
- # Construct a json representation of a BareMetalServer model
- bare_metal_server_model_json = {}
- bare_metal_server_model_json['bandwidth'] = 20000
- bare_metal_server_model_json['boot_target'] = bare_metal_server_boot_target_model
- bare_metal_server_model_json['cpu'] = bare_metal_server_cpu_model
- bare_metal_server_model_json['created_at'] = '2019-01-01T12:00:00Z'
- bare_metal_server_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304'
- bare_metal_server_model_json['disks'] = [bare_metal_server_disk_model]
- bare_metal_server_model_json['enable_secure_boot'] = False
- bare_metal_server_model_json['firmware'] = bare_metal_server_firmware_model
- bare_metal_server_model_json['health_reasons'] = [bare_metal_server_health_reason_model]
- bare_metal_server_model_json['health_state'] = 'ok'
- bare_metal_server_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304'
- bare_metal_server_model_json['id'] = '0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304'
- bare_metal_server_model_json['lifecycle_reasons'] = [bare_metal_server_lifecycle_reason_model]
- bare_metal_server_model_json['lifecycle_state'] = 'stable'
- bare_metal_server_model_json['memory'] = 1536
- bare_metal_server_model_json['name'] = 'my-bare-metal-server'
- bare_metal_server_model_json['network_attachments'] = [bare_metal_server_network_attachment_reference_model]
- bare_metal_server_model_json['network_interfaces'] = [network_interface_bare_metal_server_context_reference_model]
- bare_metal_server_model_json['primary_network_attachment'] = bare_metal_server_network_attachment_reference_model
- bare_metal_server_model_json['primary_network_interface'] = network_interface_bare_metal_server_context_reference_model
- bare_metal_server_model_json['profile'] = bare_metal_server_profile_reference_model
- bare_metal_server_model_json['reservation'] = reservation_reference_model
- bare_metal_server_model_json['reservation_affinity'] = bare_metal_server_reservation_affinity_model
- bare_metal_server_model_json['resource_group'] = resource_group_reference_model
- bare_metal_server_model_json['resource_type'] = 'bare_metal_server'
- bare_metal_server_model_json['status'] = 'deleting'
- bare_metal_server_model_json['status_reasons'] = [bare_metal_server_status_reason_model]
- bare_metal_server_model_json['trusted_platform_module'] = bare_metal_server_trusted_platform_module_model
- bare_metal_server_model_json['vpc'] = vpc_reference_model
- bare_metal_server_model_json['zone'] = zone_reference_model
-
- # Construct a model instance of BareMetalServer by calling from_dict on the json representation
- bare_metal_server_model = BareMetalServer.from_dict(bare_metal_server_model_json)
- assert bare_metal_server_model != False
-
- # Construct a model instance of BareMetalServer by calling from_dict on the json representation
- bare_metal_server_model_dict = BareMetalServer.from_dict(bare_metal_server_model_json).__dict__
- bare_metal_server_model2 = BareMetalServer(**bare_metal_server_model_dict)
-
- # Verify the model instances are equivalent
- assert bare_metal_server_model == bare_metal_server_model2
-
- # Convert model instance back to dict and verify no loss of data
- bare_metal_server_model_json2 = bare_metal_server_model.to_dict()
- assert bare_metal_server_model_json2 == bare_metal_server_model_json
-
-
-class TestModel_BareMetalServerCPU:
- """
- Test Class for BareMetalServerCPU
- """
-
- def test_bare_metal_server_cpu_serialization(self):
- """
- Test serialization/deserialization for BareMetalServerCPU
- """
-
- # Construct a json representation of a BareMetalServerCPU model
- bare_metal_server_cpu_model_json = {}
- bare_metal_server_cpu_model_json['architecture'] = 'amd64'
- bare_metal_server_cpu_model_json['core_count'] = 80
- bare_metal_server_cpu_model_json['socket_count'] = 4
- bare_metal_server_cpu_model_json['threads_per_core'] = 2
-
- # Construct a model instance of BareMetalServerCPU by calling from_dict on the json representation
- bare_metal_server_cpu_model = BareMetalServerCPU.from_dict(bare_metal_server_cpu_model_json)
- assert bare_metal_server_cpu_model != False
-
- # Construct a model instance of BareMetalServerCPU by calling from_dict on the json representation
- bare_metal_server_cpu_model_dict = BareMetalServerCPU.from_dict(bare_metal_server_cpu_model_json).__dict__
- bare_metal_server_cpu_model2 = BareMetalServerCPU(**bare_metal_server_cpu_model_dict)
-
- # Verify the model instances are equivalent
- assert bare_metal_server_cpu_model == bare_metal_server_cpu_model2
-
- # Convert model instance back to dict and verify no loss of data
- bare_metal_server_cpu_model_json2 = bare_metal_server_cpu_model.to_dict()
- assert bare_metal_server_cpu_model_json2 == bare_metal_server_cpu_model_json
-
-
-class TestModel_BareMetalServerCollection:
- """
- Test Class for BareMetalServerCollection
- """
-
- def test_bare_metal_server_collection_serialization(self):
- """
- Test serialization/deserialization for BareMetalServerCollection
- """
-
- # Construct dict forms of any model objects needed in order to build this model.
-
- deleted_model = {} # Deleted
- deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
-
- bare_metal_server_boot_target_model = {} # BareMetalServerBootTargetBareMetalServerDiskReference
- bare_metal_server_boot_target_model['deleted'] = deleted_model
- bare_metal_server_boot_target_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
- bare_metal_server_boot_target_model['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
- bare_metal_server_boot_target_model['name'] = 'my-bare-metal-server-disk'
- bare_metal_server_boot_target_model['resource_type'] = 'bare_metal_server_disk'
-
- bare_metal_server_cpu_model = {} # BareMetalServerCPU
- bare_metal_server_cpu_model['architecture'] = 'amd64'
- bare_metal_server_cpu_model['core_count'] = 96
- bare_metal_server_cpu_model['socket_count'] = 4
- bare_metal_server_cpu_model['threads_per_core'] = 2
-
- bare_metal_server_disk_model = {} # BareMetalServerDisk
- bare_metal_server_disk_model['created_at'] = '2024-10-23T06:09:15Z'
- bare_metal_server_disk_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
- bare_metal_server_disk_model['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
- bare_metal_server_disk_model['interface_type'] = 'sata'
- bare_metal_server_disk_model['name'] = 'my-bare-metal-server-disk'
- bare_metal_server_disk_model['resource_type'] = 'bare_metal_server_disk'
- bare_metal_server_disk_model['size'] = 960
-
- bare_metal_server_firmware_model = {} # BareMetalServerFirmware
- bare_metal_server_firmware_model['update'] = 'none'
-
- bare_metal_server_health_reason_model = {} # BareMetalServerHealthReason
- bare_metal_server_health_reason_model['code'] = 'reservation_expired'
- bare_metal_server_health_reason_model['message'] = 'The reservation cannot be used because it has expired.'
- bare_metal_server_health_reason_model['more_info'] = 'https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons'
-
- bare_metal_server_lifecycle_reason_model = {} # BareMetalServerLifecycleReason
- bare_metal_server_lifecycle_reason_model['code'] = 'resource_suspended_by_provider'
- bare_metal_server_lifecycle_reason_model['message'] = 'The resource has been suspended. Contact IBM support with the CRN for next steps.'
- bare_metal_server_lifecycle_reason_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#resource-suspension'
+ bare_metal_server_metadata_service_model = {} # BareMetalServerMetadataService
+ bare_metal_server_metadata_service_model['enabled'] = True
+ bare_metal_server_metadata_service_model['protocol'] = 'https'
reserved_ip_reference_model = {} # ReservedIPReference
reserved_ip_reference_model['address'] = '10.0.1.5'
@@ -56535,6 +57602,7 @@ def test_bare_metal_server_collection_serialization(self):
bare_metal_server_model['lifecycle_reasons'] = [bare_metal_server_lifecycle_reason_model]
bare_metal_server_model['lifecycle_state'] = 'stable'
bare_metal_server_model['memory'] = 768
+ bare_metal_server_model['metadata_service'] = bare_metal_server_metadata_service_model
bare_metal_server_model['name'] = 'my-bare-metal-server'
bare_metal_server_model['network_attachments'] = [bare_metal_server_network_attachment_reference_model]
bare_metal_server_model['network_interfaces'] = [network_interface_bare_metal_server_context_reference_model]
@@ -56623,8 +57691,15 @@ def test_bare_metal_server_disk_serialization(self):
Test serialization/deserialization for BareMetalServerDisk
"""
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ bare_metal_server_disk_allowed_use_model = {} # BareMetalServerDiskAllowedUse
+ bare_metal_server_disk_allowed_use_model['api_version'] = '2025-03-31'
+ bare_metal_server_disk_allowed_use_model['bare_metal_server'] = 'true'
+
# Construct a json representation of a BareMetalServerDisk model
bare_metal_server_disk_model_json = {}
+ bare_metal_server_disk_model_json['allowed_use'] = bare_metal_server_disk_allowed_use_model
bare_metal_server_disk_model_json['created_at'] = '2019-01-01T12:00:00Z'
bare_metal_server_disk_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
bare_metal_server_disk_model_json['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
@@ -56649,6 +57724,37 @@ def test_bare_metal_server_disk_serialization(self):
assert bare_metal_server_disk_model_json2 == bare_metal_server_disk_model_json
+class TestModel_BareMetalServerDiskAllowedUse:
+ """
+ Test Class for BareMetalServerDiskAllowedUse
+ """
+
+ def test_bare_metal_server_disk_allowed_use_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerDiskAllowedUse
+ """
+
+ # Construct a json representation of a BareMetalServerDiskAllowedUse model
+ bare_metal_server_disk_allowed_use_model_json = {}
+ bare_metal_server_disk_allowed_use_model_json['api_version'] = '2024-06-23'
+ bare_metal_server_disk_allowed_use_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+
+ # Construct a model instance of BareMetalServerDiskAllowedUse by calling from_dict on the json representation
+ bare_metal_server_disk_allowed_use_model = BareMetalServerDiskAllowedUse.from_dict(bare_metal_server_disk_allowed_use_model_json)
+ assert bare_metal_server_disk_allowed_use_model != False
+
+ # Construct a model instance of BareMetalServerDiskAllowedUse by calling from_dict on the json representation
+ bare_metal_server_disk_allowed_use_model_dict = BareMetalServerDiskAllowedUse.from_dict(bare_metal_server_disk_allowed_use_model_json).__dict__
+ bare_metal_server_disk_allowed_use_model2 = BareMetalServerDiskAllowedUse(**bare_metal_server_disk_allowed_use_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_disk_allowed_use_model == bare_metal_server_disk_allowed_use_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_disk_allowed_use_model_json2 = bare_metal_server_disk_allowed_use_model.to_dict()
+ assert bare_metal_server_disk_allowed_use_model_json2 == bare_metal_server_disk_allowed_use_model_json
+
+
class TestModel_BareMetalServerDiskCollection:
"""
Test Class for BareMetalServerDiskCollection
@@ -56661,7 +57767,12 @@ def test_bare_metal_server_disk_collection_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ bare_metal_server_disk_allowed_use_model = {} # BareMetalServerDiskAllowedUse
+ bare_metal_server_disk_allowed_use_model['api_version'] = '2025-03-31'
+ bare_metal_server_disk_allowed_use_model['bare_metal_server'] = 'true'
+
bare_metal_server_disk_model = {} # BareMetalServerDisk
+ bare_metal_server_disk_model['allowed_use'] = bare_metal_server_disk_allowed_use_model
bare_metal_server_disk_model['created_at'] = '2024-10-23T06:09:15Z'
bare_metal_server_disk_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96'
bare_metal_server_disk_model['id'] = '0717-3744f199-6ccc-4698-8772-bb3937348c96'
@@ -56794,6 +57905,15 @@ def test_bare_metal_server_initialization_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ trusted_profile_reference_model = {} # TrustedProfileReference
+ trusted_profile_reference_model['crn'] = 'crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+ trusted_profile_reference_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+ trusted_profile_reference_model['resource_type'] = 'trusted_profile'
+
+ bare_metal_server_initialization_default_trusted_profile_model = {} # BareMetalServerInitializationDefaultTrustedProfile
+ bare_metal_server_initialization_default_trusted_profile_model['auto_link'] = True
+ bare_metal_server_initialization_default_trusted_profile_model['target'] = trusted_profile_reference_model
+
deleted_model = {} # Deleted
deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
@@ -56834,6 +57954,7 @@ def test_bare_metal_server_initialization_serialization(self):
# Construct a json representation of a BareMetalServerInitialization model
bare_metal_server_initialization_model_json = {}
+ bare_metal_server_initialization_model_json['default_trusted_profile'] = bare_metal_server_initialization_default_trusted_profile_model
bare_metal_server_initialization_model_json['image'] = image_reference_model
bare_metal_server_initialization_model_json['keys'] = [key_reference_model]
bare_metal_server_initialization_model_json['user_accounts'] = [bare_metal_server_initialization_user_account_model]
@@ -56854,6 +57975,80 @@ def test_bare_metal_server_initialization_serialization(self):
assert bare_metal_server_initialization_model_json2 == bare_metal_server_initialization_model_json
+class TestModel_BareMetalServerInitializationDefaultTrustedProfile:
+ """
+ Test Class for BareMetalServerInitializationDefaultTrustedProfile
+ """
+
+ def test_bare_metal_server_initialization_default_trusted_profile_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerInitializationDefaultTrustedProfile
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ trusted_profile_reference_model = {} # TrustedProfileReference
+ trusted_profile_reference_model['crn'] = 'crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+ trusted_profile_reference_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+ trusted_profile_reference_model['resource_type'] = 'trusted_profile'
+
+ # Construct a json representation of a BareMetalServerInitializationDefaultTrustedProfile model
+ bare_metal_server_initialization_default_trusted_profile_model_json = {}
+ bare_metal_server_initialization_default_trusted_profile_model_json['auto_link'] = True
+ bare_metal_server_initialization_default_trusted_profile_model_json['target'] = trusted_profile_reference_model
+
+ # Construct a model instance of BareMetalServerInitializationDefaultTrustedProfile by calling from_dict on the json representation
+ bare_metal_server_initialization_default_trusted_profile_model = BareMetalServerInitializationDefaultTrustedProfile.from_dict(bare_metal_server_initialization_default_trusted_profile_model_json)
+ assert bare_metal_server_initialization_default_trusted_profile_model != False
+
+ # Construct a model instance of BareMetalServerInitializationDefaultTrustedProfile by calling from_dict on the json representation
+ bare_metal_server_initialization_default_trusted_profile_model_dict = BareMetalServerInitializationDefaultTrustedProfile.from_dict(bare_metal_server_initialization_default_trusted_profile_model_json).__dict__
+ bare_metal_server_initialization_default_trusted_profile_model2 = BareMetalServerInitializationDefaultTrustedProfile(**bare_metal_server_initialization_default_trusted_profile_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_initialization_default_trusted_profile_model == bare_metal_server_initialization_default_trusted_profile_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_initialization_default_trusted_profile_model_json2 = bare_metal_server_initialization_default_trusted_profile_model.to_dict()
+ assert bare_metal_server_initialization_default_trusted_profile_model_json2 == bare_metal_server_initialization_default_trusted_profile_model_json
+
+
+class TestModel_BareMetalServerInitializationDefaultTrustedProfilePrototype:
+ """
+ Test Class for BareMetalServerInitializationDefaultTrustedProfilePrototype
+ """
+
+ def test_bare_metal_server_initialization_default_trusted_profile_prototype_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerInitializationDefaultTrustedProfilePrototype
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ trusted_profile_identity_model = {} # TrustedProfileIdentityById
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ # Construct a json representation of a BareMetalServerInitializationDefaultTrustedProfilePrototype model
+ bare_metal_server_initialization_default_trusted_profile_prototype_model_json = {}
+ bare_metal_server_initialization_default_trusted_profile_prototype_model_json['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model_json['target'] = trusted_profile_identity_model
+
+ # Construct a model instance of BareMetalServerInitializationDefaultTrustedProfilePrototype by calling from_dict on the json representation
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = BareMetalServerInitializationDefaultTrustedProfilePrototype.from_dict(bare_metal_server_initialization_default_trusted_profile_prototype_model_json)
+ assert bare_metal_server_initialization_default_trusted_profile_prototype_model != False
+
+ # Construct a model instance of BareMetalServerInitializationDefaultTrustedProfilePrototype by calling from_dict on the json representation
+ bare_metal_server_initialization_default_trusted_profile_prototype_model_dict = BareMetalServerInitializationDefaultTrustedProfilePrototype.from_dict(bare_metal_server_initialization_default_trusted_profile_prototype_model_json).__dict__
+ bare_metal_server_initialization_default_trusted_profile_prototype_model2 = BareMetalServerInitializationDefaultTrustedProfilePrototype(**bare_metal_server_initialization_default_trusted_profile_prototype_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_initialization_default_trusted_profile_prototype_model == bare_metal_server_initialization_default_trusted_profile_prototype_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_initialization_default_trusted_profile_prototype_model_json2 = bare_metal_server_initialization_default_trusted_profile_prototype_model.to_dict()
+ assert bare_metal_server_initialization_default_trusted_profile_prototype_model_json2 == bare_metal_server_initialization_default_trusted_profile_prototype_model_json
+
+
class TestModel_BareMetalServerInitializationPrototype:
"""
Test Class for BareMetalServerInitializationPrototype
@@ -56866,6 +58061,13 @@ def test_bare_metal_server_initialization_prototype_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ trusted_profile_identity_model = {} # TrustedProfileIdentityById
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {} # BareMetalServerInitializationDefaultTrustedProfilePrototype
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+
image_identity_model = {} # ImageIdentityById
image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
@@ -56874,6 +58076,7 @@ def test_bare_metal_server_initialization_prototype_serialization(self):
# Construct a json representation of a BareMetalServerInitializationPrototype model
bare_metal_server_initialization_prototype_model_json = {}
+ bare_metal_server_initialization_prototype_model_json['default_trusted_profile'] = bare_metal_server_initialization_default_trusted_profile_prototype_model
bare_metal_server_initialization_prototype_model_json['image'] = image_identity_model
bare_metal_server_initialization_prototype_model_json['keys'] = [key_identity_model]
bare_metal_server_initialization_prototype_model_json['user_data'] = 'testString'
@@ -56926,6 +58129,99 @@ def test_bare_metal_server_lifecycle_reason_serialization(self):
assert bare_metal_server_lifecycle_reason_model_json2 == bare_metal_server_lifecycle_reason_model_json
+class TestModel_BareMetalServerMetadataService:
+ """
+ Test Class for BareMetalServerMetadataService
+ """
+
+ def test_bare_metal_server_metadata_service_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerMetadataService
+ """
+
+ # Construct a json representation of a BareMetalServerMetadataService model
+ bare_metal_server_metadata_service_model_json = {}
+ bare_metal_server_metadata_service_model_json['enabled'] = True
+ bare_metal_server_metadata_service_model_json['protocol'] = 'http'
+
+ # Construct a model instance of BareMetalServerMetadataService by calling from_dict on the json representation
+ bare_metal_server_metadata_service_model = BareMetalServerMetadataService.from_dict(bare_metal_server_metadata_service_model_json)
+ assert bare_metal_server_metadata_service_model != False
+
+ # Construct a model instance of BareMetalServerMetadataService by calling from_dict on the json representation
+ bare_metal_server_metadata_service_model_dict = BareMetalServerMetadataService.from_dict(bare_metal_server_metadata_service_model_json).__dict__
+ bare_metal_server_metadata_service_model2 = BareMetalServerMetadataService(**bare_metal_server_metadata_service_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_metadata_service_model == bare_metal_server_metadata_service_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_metadata_service_model_json2 = bare_metal_server_metadata_service_model.to_dict()
+ assert bare_metal_server_metadata_service_model_json2 == bare_metal_server_metadata_service_model_json
+
+
+class TestModel_BareMetalServerMetadataServicePatch:
+ """
+ Test Class for BareMetalServerMetadataServicePatch
+ """
+
+ def test_bare_metal_server_metadata_service_patch_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerMetadataServicePatch
+ """
+
+ # Construct a json representation of a BareMetalServerMetadataServicePatch model
+ bare_metal_server_metadata_service_patch_model_json = {}
+ bare_metal_server_metadata_service_patch_model_json['enabled'] = True
+ bare_metal_server_metadata_service_patch_model_json['protocol'] = 'http'
+
+ # Construct a model instance of BareMetalServerMetadataServicePatch by calling from_dict on the json representation
+ bare_metal_server_metadata_service_patch_model = BareMetalServerMetadataServicePatch.from_dict(bare_metal_server_metadata_service_patch_model_json)
+ assert bare_metal_server_metadata_service_patch_model != False
+
+ # Construct a model instance of BareMetalServerMetadataServicePatch by calling from_dict on the json representation
+ bare_metal_server_metadata_service_patch_model_dict = BareMetalServerMetadataServicePatch.from_dict(bare_metal_server_metadata_service_patch_model_json).__dict__
+ bare_metal_server_metadata_service_patch_model2 = BareMetalServerMetadataServicePatch(**bare_metal_server_metadata_service_patch_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_metadata_service_patch_model == bare_metal_server_metadata_service_patch_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_metadata_service_patch_model_json2 = bare_metal_server_metadata_service_patch_model.to_dict()
+ assert bare_metal_server_metadata_service_patch_model_json2 == bare_metal_server_metadata_service_patch_model_json
+
+
+class TestModel_BareMetalServerMetadataServicePrototype:
+ """
+ Test Class for BareMetalServerMetadataServicePrototype
+ """
+
+ def test_bare_metal_server_metadata_service_prototype_serialization(self):
+ """
+ Test serialization/deserialization for BareMetalServerMetadataServicePrototype
+ """
+
+ # Construct a json representation of a BareMetalServerMetadataServicePrototype model
+ bare_metal_server_metadata_service_prototype_model_json = {}
+ bare_metal_server_metadata_service_prototype_model_json['enabled'] = True
+ bare_metal_server_metadata_service_prototype_model_json['protocol'] = 'https'
+
+ # Construct a model instance of BareMetalServerMetadataServicePrototype by calling from_dict on the json representation
+ bare_metal_server_metadata_service_prototype_model = BareMetalServerMetadataServicePrototype.from_dict(bare_metal_server_metadata_service_prototype_model_json)
+ assert bare_metal_server_metadata_service_prototype_model != False
+
+ # Construct a model instance of BareMetalServerMetadataServicePrototype by calling from_dict on the json representation
+ bare_metal_server_metadata_service_prototype_model_dict = BareMetalServerMetadataServicePrototype.from_dict(bare_metal_server_metadata_service_prototype_model_json).__dict__
+ bare_metal_server_metadata_service_prototype_model2 = BareMetalServerMetadataServicePrototype(**bare_metal_server_metadata_service_prototype_model_dict)
+
+ # Verify the model instances are equivalent
+ assert bare_metal_server_metadata_service_prototype_model == bare_metal_server_metadata_service_prototype_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ bare_metal_server_metadata_service_prototype_model_json2 = bare_metal_server_metadata_service_prototype_model.to_dict()
+ assert bare_metal_server_metadata_service_prototype_model_json2 == bare_metal_server_metadata_service_prototype_model_json
+
+
class TestModel_BareMetalServerNetworkAttachmentCollection:
"""
Test Class for BareMetalServerNetworkAttachmentCollection
@@ -57240,6 +58536,10 @@ def test_bare_metal_server_patch_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ bare_metal_server_metadata_service_patch_model = {} # BareMetalServerMetadataServicePatch
+ bare_metal_server_metadata_service_patch_model['enabled'] = True
+ bare_metal_server_metadata_service_patch_model['protocol'] = 'http'
+
reservation_identity_model = {} # ReservationIdentityById
reservation_identity_model['id'] = '0717-ba49df72-37b8-43ac-98da-f8e029de0e63'
@@ -57254,6 +58554,7 @@ def test_bare_metal_server_patch_serialization(self):
bare_metal_server_patch_model_json = {}
bare_metal_server_patch_model_json['bandwidth'] = 20000
bare_metal_server_patch_model_json['enable_secure_boot'] = False
+ bare_metal_server_patch_model_json['metadata_service'] = bare_metal_server_metadata_service_patch_model
bare_metal_server_patch_model_json['name'] = 'my-bare-metal-server'
bare_metal_server_patch_model_json['reservation_affinity'] = bare_metal_server_reservation_affinity_patch_model
bare_metal_server_patch_model_json['trusted_platform_module'] = bare_metal_server_trusted_platform_module_patch_model
@@ -62682,6 +63983,11 @@ def test_image_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ image_allowed_use_model = {} # ImageAllowedUse
+ image_allowed_use_model['api_version'] = '2025-03-31'
+ image_allowed_use_model['bare_metal_server'] = 'false'
+ image_allowed_use_model['instance'] = 'gpu.count > 0'
+
catalog_offering_version_reference_model = {} # CatalogOfferingVersionReference
catalog_offering_version_reference_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d'
@@ -62749,6 +64055,7 @@ def test_image_serialization(self):
# Construct a json representation of a Image model
image_model_json = {}
+ image_model_json['allowed_use'] = image_allowed_use_model
image_model_json['catalog_offering'] = image_catalog_offering_model
image_model_json['created_at'] = '2019-01-01T12:00:00Z'
image_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
@@ -62787,6 +64094,146 @@ def test_image_serialization(self):
assert image_model_json2 == image_model_json
+class TestModel_ImageAllowedUse:
+ """
+ Test Class for ImageAllowedUse
+ """
+
+ def test_image_allowed_use_serialization(self):
+ """
+ Test serialization/deserialization for ImageAllowedUse
+ """
+
+ # Construct a json representation of a ImageAllowedUse model
+ image_allowed_use_model_json = {}
+ image_allowed_use_model_json['api_version'] = '2024-06-23'
+ image_allowed_use_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of ImageAllowedUse by calling from_dict on the json representation
+ image_allowed_use_model = ImageAllowedUse.from_dict(image_allowed_use_model_json)
+ assert image_allowed_use_model != False
+
+ # Construct a model instance of ImageAllowedUse by calling from_dict on the json representation
+ image_allowed_use_model_dict = ImageAllowedUse.from_dict(image_allowed_use_model_json).__dict__
+ image_allowed_use_model2 = ImageAllowedUse(**image_allowed_use_model_dict)
+
+ # Verify the model instances are equivalent
+ assert image_allowed_use_model == image_allowed_use_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ image_allowed_use_model_json2 = image_allowed_use_model.to_dict()
+ assert image_allowed_use_model_json2 == image_allowed_use_model_json
+
+
+class TestModel_ImageAllowedUsePatch:
+ """
+ Test Class for ImageAllowedUsePatch
+ """
+
+ def test_image_allowed_use_patch_serialization(self):
+ """
+ Test serialization/deserialization for ImageAllowedUsePatch
+ """
+
+ # Construct a json representation of a ImageAllowedUsePatch model
+ image_allowed_use_patch_model_json = {}
+ image_allowed_use_patch_model_json['api_version'] = '2024-06-23'
+ image_allowed_use_patch_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_patch_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of ImageAllowedUsePatch by calling from_dict on the json representation
+ image_allowed_use_patch_model = ImageAllowedUsePatch.from_dict(image_allowed_use_patch_model_json)
+ assert image_allowed_use_patch_model != False
+
+ # Construct a model instance of ImageAllowedUsePatch by calling from_dict on the json representation
+ image_allowed_use_patch_model_dict = ImageAllowedUsePatch.from_dict(image_allowed_use_patch_model_json).__dict__
+ image_allowed_use_patch_model2 = ImageAllowedUsePatch(**image_allowed_use_patch_model_dict)
+
+ # Verify the model instances are equivalent
+ assert image_allowed_use_patch_model == image_allowed_use_patch_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ image_allowed_use_patch_model_json2 = image_allowed_use_patch_model.to_dict()
+ assert image_allowed_use_patch_model_json2 == image_allowed_use_patch_model_json
+
+
+class TestModel_ImageAllowedUsePrototype:
+ """
+ Test Class for ImageAllowedUsePrototype
+ """
+
+ def test_image_allowed_use_prototype_serialization(self):
+ """
+ Test serialization/deserialization for ImageAllowedUsePrototype
+ """
+
+ # Construct a json representation of a ImageAllowedUsePrototype model
+ image_allowed_use_prototype_model_json = {}
+ image_allowed_use_prototype_model_json['api_version'] = '2024-06-23'
+ image_allowed_use_prototype_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_prototype_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of ImageAllowedUsePrototype by calling from_dict on the json representation
+ image_allowed_use_prototype_model = ImageAllowedUsePrototype.from_dict(image_allowed_use_prototype_model_json)
+ assert image_allowed_use_prototype_model != False
+
+ # Construct a model instance of ImageAllowedUsePrototype by calling from_dict on the json representation
+ image_allowed_use_prototype_model_dict = ImageAllowedUsePrototype.from_dict(image_allowed_use_prototype_model_json).__dict__
+ image_allowed_use_prototype_model2 = ImageAllowedUsePrototype(**image_allowed_use_prototype_model_dict)
+
+ # Verify the model instances are equivalent
+ assert image_allowed_use_prototype_model == image_allowed_use_prototype_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ image_allowed_use_prototype_model_json2 = image_allowed_use_prototype_model.to_dict()
+ assert image_allowed_use_prototype_model_json2 == image_allowed_use_prototype_model_json
+
+
+class TestModel_ImageBareMetalServerProfileCollection:
+ """
+ Test Class for ImageBareMetalServerProfileCollection
+ """
+
+ def test_image_bare_metal_server_profile_collection_serialization(self):
+ """
+ Test serialization/deserialization for ImageBareMetalServerProfileCollection
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ bare_metal_server_profile_reference_model = {} # BareMetalServerProfileReference
+ bare_metal_server_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/bare_metal_server/profiles/bx2d-metal-192x768'
+ bare_metal_server_profile_reference_model['name'] = 'bx2d-metal-192x768'
+ bare_metal_server_profile_reference_model['resource_type'] = 'bare_metal_server_profile'
+
+ page_link_model = {} # PageLink
+ page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/images/{id}/bare_metal_server_profiles?limit=50'
+
+ # Construct a json representation of a ImageBareMetalServerProfileCollection model
+ image_bare_metal_server_profile_collection_model_json = {}
+ image_bare_metal_server_profile_collection_model_json['bare_metal_server_profiles'] = [bare_metal_server_profile_reference_model]
+ image_bare_metal_server_profile_collection_model_json['first'] = page_link_model
+ image_bare_metal_server_profile_collection_model_json['limit'] = 20
+ image_bare_metal_server_profile_collection_model_json['next'] = page_link_model
+ image_bare_metal_server_profile_collection_model_json['total_count'] = 132
+
+ # Construct a model instance of ImageBareMetalServerProfileCollection by calling from_dict on the json representation
+ image_bare_metal_server_profile_collection_model = ImageBareMetalServerProfileCollection.from_dict(image_bare_metal_server_profile_collection_model_json)
+ assert image_bare_metal_server_profile_collection_model != False
+
+ # Construct a model instance of ImageBareMetalServerProfileCollection by calling from_dict on the json representation
+ image_bare_metal_server_profile_collection_model_dict = ImageBareMetalServerProfileCollection.from_dict(image_bare_metal_server_profile_collection_model_json).__dict__
+ image_bare_metal_server_profile_collection_model2 = ImageBareMetalServerProfileCollection(**image_bare_metal_server_profile_collection_model_dict)
+
+ # Verify the model instances are equivalent
+ assert image_bare_metal_server_profile_collection_model == image_bare_metal_server_profile_collection_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ image_bare_metal_server_profile_collection_model_json2 = image_bare_metal_server_profile_collection_model.to_dict()
+ assert image_bare_metal_server_profile_collection_model_json2 == image_bare_metal_server_profile_collection_model_json
+
+
class TestModel_ImageCatalogOffering:
"""
Test Class for ImageCatalogOffering
@@ -62838,6 +64285,11 @@ def test_image_collection_serialization(self):
page_link_model = {} # PageLink
page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/images?limit=50'
+ image_allowed_use_model = {} # ImageAllowedUse
+ image_allowed_use_model['api_version'] = '2025-03-31'
+ image_allowed_use_model['bare_metal_server'] = 'false'
+ image_allowed_use_model['instance'] = 'gpu.count > 0'
+
catalog_offering_version_reference_model = {} # CatalogOfferingVersionReference
catalog_offering_version_reference_model['crn'] = 'crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d'
@@ -62904,6 +64356,7 @@ def test_image_collection_serialization(self):
image_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys'
image_model = {} # Image
+ image_model['allowed_use'] = image_allowed_use_model
image_model['catalog_offering'] = image_catalog_offering_model
image_model['created_at'] = '2024-09-13T09:06:26Z'
image_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
@@ -63225,6 +64678,50 @@ def test_image_file_prototype_serialization(self):
assert image_file_prototype_model_json2 == image_file_prototype_model_json
+class TestModel_ImageInstanceProfileCollection:
+ """
+ Test Class for ImageInstanceProfileCollection
+ """
+
+ def test_image_instance_profile_collection_serialization(self):
+ """
+ Test serialization/deserialization for ImageInstanceProfileCollection
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ page_link_model = {} # PageLink
+ page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/images/{id}/instance_profiles?limit=50'
+
+ instance_profile_reference_model = {} # InstanceProfileReference
+ instance_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-2x8'
+ instance_profile_reference_model['name'] = 'bx2-2x8'
+ instance_profile_reference_model['resource_type'] = 'instance_profile'
+
+ # Construct a json representation of a ImageInstanceProfileCollection model
+ image_instance_profile_collection_model_json = {}
+ image_instance_profile_collection_model_json['first'] = page_link_model
+ image_instance_profile_collection_model_json['instance_profiles'] = [instance_profile_reference_model]
+ image_instance_profile_collection_model_json['limit'] = 20
+ image_instance_profile_collection_model_json['next'] = page_link_model
+ image_instance_profile_collection_model_json['total_count'] = 132
+
+ # Construct a model instance of ImageInstanceProfileCollection by calling from_dict on the json representation
+ image_instance_profile_collection_model = ImageInstanceProfileCollection.from_dict(image_instance_profile_collection_model_json)
+ assert image_instance_profile_collection_model != False
+
+ # Construct a model instance of ImageInstanceProfileCollection by calling from_dict on the json representation
+ image_instance_profile_collection_model_dict = ImageInstanceProfileCollection.from_dict(image_instance_profile_collection_model_json).__dict__
+ image_instance_profile_collection_model2 = ImageInstanceProfileCollection(**image_instance_profile_collection_model_dict)
+
+ # Verify the model instances are equivalent
+ assert image_instance_profile_collection_model == image_instance_profile_collection_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ image_instance_profile_collection_model_json2 = image_instance_profile_collection_model.to_dict()
+ assert image_instance_profile_collection_model_json2 == image_instance_profile_collection_model_json
+
+
class TestModel_ImagePatch:
"""
Test Class for ImagePatch
@@ -63235,8 +64732,16 @@ def test_image_patch_serialization(self):
Test serialization/deserialization for ImagePatch
"""
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ image_allowed_use_patch_model = {} # ImageAllowedUsePatch
+ image_allowed_use_patch_model['api_version'] = '2024-06-23'
+ image_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
# Construct a json representation of a ImagePatch model
image_patch_model_json = {}
+ image_patch_model_json['allowed_use'] = image_allowed_use_patch_model
image_patch_model_json['deprecation_at'] = '2019-01-01T12:00:00Z'
image_patch_model_json['name'] = 'my-image'
image_patch_model_json['obsolescence_at'] = '2019-01-01T12:00:00Z'
@@ -67324,6 +68829,11 @@ def test_instance_template_collection_serialization(self):
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -67334,6 +68844,7 @@ def test_instance_template_collection_serialization(self):
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -70057,6 +71568,10 @@ def test_load_balancer_profile_serialization(self):
load_balancer_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/dynamic'
load_balancer_profile_reference_model['name'] = 'dynamic'
+ load_balancer_profile_targetable_resource_types_model = {} # LoadBalancerProfileTargetableResourceTypes
+ load_balancer_profile_targetable_resource_types_model['type'] = 'enum'
+ load_balancer_profile_targetable_resource_types_model['values'] = ['instance', 'load_balancer', 'subnet_reserved_ip', 'ip']
+
load_balancer_profile_udp_supported_model = {} # LoadBalancerProfileUDPSupportedFixed
load_balancer_profile_udp_supported_model['type'] = 'fixed'
load_balancer_profile_udp_supported_model['value'] = True
@@ -70075,6 +71590,7 @@ def test_load_balancer_profile_serialization(self):
load_balancer_profile_model_json['security_groups_supported'] = load_balancer_profile_security_groups_supported_model
load_balancer_profile_model_json['source_ip_session_persistence_supported'] = load_balancer_profile_source_ip_session_persistence_supported_model
load_balancer_profile_model_json['targetable_load_balancer_profiles'] = [load_balancer_profile_reference_model]
+ load_balancer_profile_model_json['targetable_resource_types'] = load_balancer_profile_targetable_resource_types_model
load_balancer_profile_model_json['udp_supported'] = load_balancer_profile_udp_supported_model
# Construct a model instance of LoadBalancerProfile by calling from_dict on the json representation
@@ -70177,6 +71693,10 @@ def test_load_balancer_profile_collection_serialization(self):
load_balancer_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed'
load_balancer_profile_reference_model['name'] = 'network-fixed'
+ load_balancer_profile_targetable_resource_types_model = {} # LoadBalancerProfileTargetableResourceTypes
+ load_balancer_profile_targetable_resource_types_model['type'] = 'enum'
+ load_balancer_profile_targetable_resource_types_model['values'] = ['instance']
+
load_balancer_profile_udp_supported_model = {} # LoadBalancerProfileUDPSupportedFixed
load_balancer_profile_udp_supported_model['type'] = 'fixed'
load_balancer_profile_udp_supported_model['value'] = True
@@ -70194,6 +71714,7 @@ def test_load_balancer_profile_collection_serialization(self):
load_balancer_profile_model['security_groups_supported'] = load_balancer_profile_security_groups_supported_model
load_balancer_profile_model['source_ip_session_persistence_supported'] = load_balancer_profile_source_ip_session_persistence_supported_model
load_balancer_profile_model['targetable_load_balancer_profiles'] = [load_balancer_profile_reference_model]
+ load_balancer_profile_model['targetable_resource_types'] = load_balancer_profile_targetable_resource_types_model
load_balancer_profile_model['udp_supported'] = load_balancer_profile_udp_supported_model
# Construct a json representation of a LoadBalancerProfileCollection model
@@ -70283,6 +71804,37 @@ def test_load_balancer_profile_reference_serialization(self):
assert load_balancer_profile_reference_model_json2 == load_balancer_profile_reference_model_json
+class TestModel_LoadBalancerProfileTargetableResourceTypes:
+ """
+ Test Class for LoadBalancerProfileTargetableResourceTypes
+ """
+
+ def test_load_balancer_profile_targetable_resource_types_serialization(self):
+ """
+ Test serialization/deserialization for LoadBalancerProfileTargetableResourceTypes
+ """
+
+ # Construct a json representation of a LoadBalancerProfileTargetableResourceTypes model
+ load_balancer_profile_targetable_resource_types_model_json = {}
+ load_balancer_profile_targetable_resource_types_model_json['type'] = 'enum'
+ load_balancer_profile_targetable_resource_types_model_json['values'] = ['instance']
+
+ # Construct a model instance of LoadBalancerProfileTargetableResourceTypes by calling from_dict on the json representation
+ load_balancer_profile_targetable_resource_types_model = LoadBalancerProfileTargetableResourceTypes.from_dict(load_balancer_profile_targetable_resource_types_model_json)
+ assert load_balancer_profile_targetable_resource_types_model != False
+
+ # Construct a model instance of LoadBalancerProfileTargetableResourceTypes by calling from_dict on the json representation
+ load_balancer_profile_targetable_resource_types_model_dict = LoadBalancerProfileTargetableResourceTypes.from_dict(load_balancer_profile_targetable_resource_types_model_json).__dict__
+ load_balancer_profile_targetable_resource_types_model2 = LoadBalancerProfileTargetableResourceTypes(**load_balancer_profile_targetable_resource_types_model_dict)
+
+ # Verify the model instances are equivalent
+ assert load_balancer_profile_targetable_resource_types_model == load_balancer_profile_targetable_resource_types_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ load_balancer_profile_targetable_resource_types_model_json2 = load_balancer_profile_targetable_resource_types_model.to_dict()
+ assert load_balancer_profile_targetable_resource_types_model_json2 == load_balancer_profile_targetable_resource_types_model_json
+
+
class TestModel_LoadBalancerReference:
"""
Test Class for LoadBalancerReference
@@ -74579,7 +76131,10 @@ def test_share_serialization(self):
share_model_json['access_control_mode'] = 'security_group'
share_model_json['accessor_binding_role'] = 'accessor'
share_model_json['accessor_bindings'] = [share_accessor_binding_reference_model]
- share_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_model_json['allowed_access_protocols'] = ['nfs4']
+ share_model_json['allowed_transit_encryption_modes'] = ['ipsec']
+ share_model_json['availability_mode'] = 'zonal'
+ share_model_json['bandwidth'] = 1
share_model_json['created_at'] = '2019-01-01T12:00:00Z'
share_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58'
share_model_json['encryption'] = 'provider_managed'
@@ -74608,6 +76163,7 @@ def test_share_serialization(self):
share_model_json['snapshot_size'] = 0
share_model_json['source_share'] = share_reference_model
share_model_json['source_snapshot'] = share_source_snapshot_model
+ share_model_json['storage_generation'] = 1
share_model_json['user_tags'] = ['testString']
share_model_json['zone'] = zone_reference_model
@@ -74900,7 +76456,10 @@ def test_share_collection_serialization(self):
share_model['access_control_mode'] = 'security_group'
share_model['accessor_binding_role'] = 'origin'
share_model['accessor_bindings'] = [share_accessor_binding_reference_model]
- share_model['allowed_transit_encryption_modes'] = ['none', 'user_managed']
+ share_model['allowed_access_protocols'] = ['nfs4']
+ share_model['allowed_transit_encryption_modes'] = ['none', 'ipsec']
+ share_model['availability_mode'] = 'zonal'
+ share_model['bandwidth'] = 100
share_model['created_at'] = '2025-01-06T22:58:49Z'
share_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58'
share_model['encryption'] = 'provider_managed'
@@ -74929,6 +76488,7 @@ def test_share_collection_serialization(self):
share_model['snapshot_size'] = 10
share_model['source_share'] = share_reference_model
share_model['source_snapshot'] = share_source_snapshot_model
+ share_model['storage_generation'] = 1
share_model['user_tags'] = []
share_model['zone'] = zone_reference_model
@@ -75171,6 +76731,7 @@ def test_share_mount_target_serialization(self):
# Construct a json representation of a ShareMountTarget model
share_mount_target_model_json = {}
share_mount_target_model_json['access_control_mode'] = 'security_group'
+ share_mount_target_model_json['access_protocol'] = 'nfs4'
share_mount_target_model_json['created_at'] = '2019-01-01T12:00:00Z'
share_mount_target_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1'
share_mount_target_model_json['id'] = 'r006-76083f29-e320-4c3f-a1ff-ec479f7249d1'
@@ -75251,6 +76812,7 @@ def test_share_mount_target_collection_serialization(self):
share_mount_target_model = {} # ShareMountTarget
share_mount_target_model['access_control_mode'] = 'security_group'
+ share_mount_target_model['access_protocol'] = 'nfs4'
share_mount_target_model['created_at'] = '2025-01-06T01:59:46Z'
share_mount_target_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/r006-76083f29-e320-4c3f-a1ff-ec479f7249d1'
share_mount_target_model['id'] = 'r006-76083f29-e320-4c3f-a1ff-ec479f7249d1'
@@ -75375,7 +76937,9 @@ def test_share_patch_serialization(self):
# Construct a json representation of a SharePatch model
share_patch_model_json = {}
share_patch_model_json['access_control_mode'] = 'security_group'
- share_patch_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_patch_model_json['allowed_access_protocols'] = ['nfs4']
+ share_patch_model_json['allowed_transit_encryption_modes'] = ['ipsec']
+ share_patch_model_json['bandwidth'] = 1
share_patch_model_json['iops'] = 100
share_patch_model_json['name'] = 'my-share'
share_patch_model_json['profile'] = share_profile_identity_model
@@ -75411,6 +76975,28 @@ def test_share_profile_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ share_profile_allowed_access_protocols_model = {} # ShareProfileAllowedAccessProtocolsSubset
+ share_profile_allowed_access_protocols_model['default'] = ['nfs4']
+ share_profile_allowed_access_protocols_model['type'] = 'subset'
+ share_profile_allowed_access_protocols_model['values'] = ['nfs4']
+
+ share_profile_allowed_transit_encryption_modes_model = {} # ShareProfileAllowedTransitEncryptionModesSubset
+ share_profile_allowed_transit_encryption_modes_model['default'] = ['ipsec', 'none', 'stunnel']
+ share_profile_allowed_transit_encryption_modes_model['type'] = 'subset'
+ share_profile_allowed_transit_encryption_modes_model['values'] = ['ipsec', 'none', 'stunnel']
+
+ share_profile_availability_modes_model = {} # ShareProfileAvailabilityModesFixed
+ share_profile_availability_modes_model['type'] = 'fixed'
+ share_profile_availability_modes_model['value'] = 'zonal'
+
+ share_profile_bandwidth_model = {} # ShareProfileBandwidthRange
+ share_profile_bandwidth_model['default'] = 100
+ share_profile_bandwidth_model['max'] = 1024
+ share_profile_bandwidth_model['min'] = 1
+ share_profile_bandwidth_model['step'] = 1
+ share_profile_bandwidth_model['type'] = 'fixed'
+ share_profile_bandwidth_model['value'] = 100
+
share_profile_capacity_model = {} # ShareProfileCapacityRange
share_profile_capacity_model['default'] = 1000
share_profile_capacity_model['max'] = 32000
@@ -75425,14 +77011,23 @@ def test_share_profile_serialization(self):
share_profile_iops_model['step'] = 1
share_profile_iops_model['type'] = 'dependent_range'
+ share_profile_storage_generation_model = {} # ShareProfileStorageGenerationFixed
+ share_profile_storage_generation_model['type'] = 'fixed'
+ share_profile_storage_generation_model['value'] = 1
+
# Construct a json representation of a ShareProfile model
share_profile_model_json = {}
+ share_profile_model_json['allowed_access_protocols'] = share_profile_allowed_access_protocols_model
+ share_profile_model_json['allowed_transit_encryption_modes'] = share_profile_allowed_transit_encryption_modes_model
+ share_profile_model_json['availability_modes'] = share_profile_availability_modes_model
+ share_profile_model_json['bandwidth'] = share_profile_bandwidth_model
share_profile_model_json['capacity'] = share_profile_capacity_model
share_profile_model_json['family'] = 'defined_performance'
share_profile_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops'
share_profile_model_json['iops'] = share_profile_iops_model
share_profile_model_json['name'] = 'tier-3iops'
share_profile_model_json['resource_type'] = 'share_profile'
+ share_profile_model_json['storage_generation'] = share_profile_storage_generation_model
# Construct a model instance of ShareProfile by calling from_dict on the json representation
share_profile_model = ShareProfile.from_dict(share_profile_model_json)
@@ -75465,6 +77060,28 @@ def test_share_profile_collection_serialization(self):
page_link_model = {} # PageLink
page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/share/profiles?limit=50'
+ share_profile_allowed_access_protocols_model = {} # ShareProfileAllowedAccessProtocolsSubset
+ share_profile_allowed_access_protocols_model['default'] = ['nfs4']
+ share_profile_allowed_access_protocols_model['type'] = 'subset'
+ share_profile_allowed_access_protocols_model['values'] = ['nfs4']
+
+ share_profile_allowed_transit_encryption_modes_model = {} # ShareProfileAllowedTransitEncryptionModesSubset
+ share_profile_allowed_transit_encryption_modes_model['default'] = ['ipsec', 'none', 'stunnel']
+ share_profile_allowed_transit_encryption_modes_model['type'] = 'subset'
+ share_profile_allowed_transit_encryption_modes_model['values'] = ['ipsec', 'none', 'stunnel']
+
+ share_profile_availability_modes_model = {} # ShareProfileAvailabilityModesFixed
+ share_profile_availability_modes_model['type'] = 'fixed'
+ share_profile_availability_modes_model['value'] = 'zonal'
+
+ share_profile_bandwidth_model = {} # ShareProfileBandwidthRange
+ share_profile_bandwidth_model['default'] = 100
+ share_profile_bandwidth_model['max'] = 1024
+ share_profile_bandwidth_model['min'] = 1
+ share_profile_bandwidth_model['step'] = 1
+ share_profile_bandwidth_model['type'] = 'fixed'
+ share_profile_bandwidth_model['value'] = 100
+
share_profile_capacity_model = {} # ShareProfileCapacityRange
share_profile_capacity_model['default'] = 1000
share_profile_capacity_model['max'] = 32000
@@ -75479,13 +77096,22 @@ def test_share_profile_collection_serialization(self):
share_profile_iops_model['step'] = 1
share_profile_iops_model['type'] = 'dependent_range'
+ share_profile_storage_generation_model = {} # ShareProfileStorageGenerationFixed
+ share_profile_storage_generation_model['type'] = 'fixed'
+ share_profile_storage_generation_model['value'] = 1
+
share_profile_model = {} # ShareProfile
+ share_profile_model['allowed_access_protocols'] = share_profile_allowed_access_protocols_model
+ share_profile_model['allowed_transit_encryption_modes'] = share_profile_allowed_transit_encryption_modes_model
+ share_profile_model['availability_modes'] = share_profile_availability_modes_model
+ share_profile_model['bandwidth'] = share_profile_bandwidth_model
share_profile_model['capacity'] = share_profile_capacity_model
share_profile_model['family'] = 'defined_performance'
share_profile_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/share/profiles/dp2'
share_profile_model['iops'] = share_profile_iops_model
share_profile_model['name'] = 'dp2'
share_profile_model['resource_type'] = 'share_profile'
+ share_profile_model['storage_generation'] = share_profile_storage_generation_model
# Construct a json representation of a ShareProfileCollection model
share_profile_collection_model_json = {}
@@ -75587,6 +77213,7 @@ def test_share_prototype_share_context_serialization(self):
share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
share_mount_target_prototype_model = {} # ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
share_mount_target_prototype_model['name'] = 'my-share-mount-target'
share_mount_target_prototype_model['transit_encryption'] = 'none'
share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
@@ -75599,7 +77226,7 @@ def test_share_prototype_share_context_serialization(self):
# Construct a json representation of a SharePrototypeShareContext model
share_prototype_share_context_model_json = {}
- share_prototype_share_context_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_context_model_json['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_context_model_json['iops'] = 100
share_prototype_share_context_model_json['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_context_model_json['name'] = 'my-share'
@@ -75975,6 +77602,7 @@ def test_share_snapshot_patch_serialization(self):
# Construct a json representation of a ShareSnapshotPatch model
share_snapshot_patch_model_json = {}
+ share_snapshot_patch_model_json['name'] = 'my-share-snapshot'
share_snapshot_patch_model_json['user_tags'] = ['testString']
# Construct a model instance of ShareSnapshotPatch by calling from_dict on the json representation
@@ -76037,6 +77665,11 @@ def test_snapshot_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ snapshot_allowed_use_model = {} # SnapshotAllowedUse
+ snapshot_allowed_use_model['api_version'] = '2025-03-31'
+ snapshot_allowed_use_model['bare_metal_server'] = 'false'
+ snapshot_allowed_use_model['instance'] = 'gpu.count > 0'
+
deleted_model = {} # Deleted
deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
@@ -76156,6 +77789,7 @@ def test_snapshot_serialization(self):
# Construct a json representation of a Snapshot model
snapshot_model_json = {}
+ snapshot_model_json['allowed_use'] = snapshot_allowed_use_model
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'
@@ -76201,6 +77835,102 @@ def test_snapshot_serialization(self):
assert snapshot_model_json2 == snapshot_model_json
+class TestModel_SnapshotAllowedUse:
+ """
+ Test Class for SnapshotAllowedUse
+ """
+
+ def test_snapshot_allowed_use_serialization(self):
+ """
+ Test serialization/deserialization for SnapshotAllowedUse
+ """
+
+ # Construct a json representation of a SnapshotAllowedUse model
+ snapshot_allowed_use_model_json = {}
+ snapshot_allowed_use_model_json['api_version'] = '2024-06-23'
+ snapshot_allowed_use_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of SnapshotAllowedUse by calling from_dict on the json representation
+ snapshot_allowed_use_model = SnapshotAllowedUse.from_dict(snapshot_allowed_use_model_json)
+ assert snapshot_allowed_use_model != False
+
+ # Construct a model instance of SnapshotAllowedUse by calling from_dict on the json representation
+ snapshot_allowed_use_model_dict = SnapshotAllowedUse.from_dict(snapshot_allowed_use_model_json).__dict__
+ snapshot_allowed_use_model2 = SnapshotAllowedUse(**snapshot_allowed_use_model_dict)
+
+ # Verify the model instances are equivalent
+ assert snapshot_allowed_use_model == snapshot_allowed_use_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ snapshot_allowed_use_model_json2 = snapshot_allowed_use_model.to_dict()
+ assert snapshot_allowed_use_model_json2 == snapshot_allowed_use_model_json
+
+
+class TestModel_SnapshotAllowedUsePatch:
+ """
+ Test Class for SnapshotAllowedUsePatch
+ """
+
+ def test_snapshot_allowed_use_patch_serialization(self):
+ """
+ Test serialization/deserialization for SnapshotAllowedUsePatch
+ """
+
+ # Construct a json representation of a SnapshotAllowedUsePatch model
+ snapshot_allowed_use_patch_model_json = {}
+ snapshot_allowed_use_patch_model_json['api_version'] = '2024-06-23'
+ snapshot_allowed_use_patch_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_patch_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of SnapshotAllowedUsePatch by calling from_dict on the json representation
+ snapshot_allowed_use_patch_model = SnapshotAllowedUsePatch.from_dict(snapshot_allowed_use_patch_model_json)
+ assert snapshot_allowed_use_patch_model != False
+
+ # Construct a model instance of SnapshotAllowedUsePatch by calling from_dict on the json representation
+ snapshot_allowed_use_patch_model_dict = SnapshotAllowedUsePatch.from_dict(snapshot_allowed_use_patch_model_json).__dict__
+ snapshot_allowed_use_patch_model2 = SnapshotAllowedUsePatch(**snapshot_allowed_use_patch_model_dict)
+
+ # Verify the model instances are equivalent
+ assert snapshot_allowed_use_patch_model == snapshot_allowed_use_patch_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ snapshot_allowed_use_patch_model_json2 = snapshot_allowed_use_patch_model.to_dict()
+ assert snapshot_allowed_use_patch_model_json2 == snapshot_allowed_use_patch_model_json
+
+
+class TestModel_SnapshotAllowedUsePrototype:
+ """
+ Test Class for SnapshotAllowedUsePrototype
+ """
+
+ def test_snapshot_allowed_use_prototype_serialization(self):
+ """
+ Test serialization/deserialization for SnapshotAllowedUsePrototype
+ """
+
+ # Construct a json representation of a SnapshotAllowedUsePrototype model
+ snapshot_allowed_use_prototype_model_json = {}
+ snapshot_allowed_use_prototype_model_json['api_version'] = '2024-06-23'
+ snapshot_allowed_use_prototype_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_prototype_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of SnapshotAllowedUsePrototype by calling from_dict on the json representation
+ snapshot_allowed_use_prototype_model = SnapshotAllowedUsePrototype.from_dict(snapshot_allowed_use_prototype_model_json)
+ assert snapshot_allowed_use_prototype_model != False
+
+ # Construct a model instance of SnapshotAllowedUsePrototype by calling from_dict on the json representation
+ snapshot_allowed_use_prototype_model_dict = SnapshotAllowedUsePrototype.from_dict(snapshot_allowed_use_prototype_model_json).__dict__
+ snapshot_allowed_use_prototype_model2 = SnapshotAllowedUsePrototype(**snapshot_allowed_use_prototype_model_dict)
+
+ # Verify the model instances are equivalent
+ assert snapshot_allowed_use_prototype_model == snapshot_allowed_use_prototype_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ snapshot_allowed_use_prototype_model_json2 = snapshot_allowed_use_prototype_model.to_dict()
+ assert snapshot_allowed_use_prototype_model_json2 == snapshot_allowed_use_prototype_model_json
+
+
class TestModel_SnapshotCatalogOffering:
"""
Test Class for SnapshotCatalogOffering
@@ -76373,6 +78103,11 @@ def test_snapshot_collection_serialization(self):
page_link_model = {} # PageLink
page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=50'
+ snapshot_allowed_use_model = {} # SnapshotAllowedUse
+ snapshot_allowed_use_model['api_version'] = '2025-03-31'
+ snapshot_allowed_use_model['bare_metal_server'] = 'false'
+ snapshot_allowed_use_model['instance'] = 'gpu.count > 0'
+
deleted_model = {} # Deleted
deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
@@ -76491,6 +78226,7 @@ def test_snapshot_collection_serialization(self):
volume_reference_model['resource_type'] = 'volume'
snapshot_model = {} # Snapshot
+ snapshot_model['allowed_use'] = snapshot_allowed_use_model
snapshot_model['backup_policy_plan'] = backup_policy_plan_reference_model
snapshot_model['bootable'] = True
snapshot_model['captured_at'] = '2025-01-28T13:44:51Z'
@@ -76844,6 +78580,50 @@ def test_snapshot_copies_item_serialization(self):
assert snapshot_copies_item_model_json2 == snapshot_copies_item_model_json
+class TestModel_SnapshotInstanceProfileCollection:
+ """
+ Test Class for SnapshotInstanceProfileCollection
+ """
+
+ def test_snapshot_instance_profile_collection_serialization(self):
+ """
+ Test serialization/deserialization for SnapshotInstanceProfileCollection
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ page_link_model = {} # PageLink
+ page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/snapshots/{id}/instance_profiles?limit=50'
+
+ instance_profile_reference_model = {} # InstanceProfileReference
+ instance_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-2x8'
+ instance_profile_reference_model['name'] = 'bx2-2x8'
+ instance_profile_reference_model['resource_type'] = 'instance_profile'
+
+ # Construct a json representation of a SnapshotInstanceProfileCollection model
+ snapshot_instance_profile_collection_model_json = {}
+ snapshot_instance_profile_collection_model_json['first'] = page_link_model
+ snapshot_instance_profile_collection_model_json['instance_profiles'] = [instance_profile_reference_model]
+ snapshot_instance_profile_collection_model_json['limit'] = 20
+ snapshot_instance_profile_collection_model_json['next'] = page_link_model
+ snapshot_instance_profile_collection_model_json['total_count'] = 132
+
+ # Construct a model instance of SnapshotInstanceProfileCollection by calling from_dict on the json representation
+ snapshot_instance_profile_collection_model = SnapshotInstanceProfileCollection.from_dict(snapshot_instance_profile_collection_model_json)
+ assert snapshot_instance_profile_collection_model != False
+
+ # Construct a model instance of SnapshotInstanceProfileCollection by calling from_dict on the json representation
+ snapshot_instance_profile_collection_model_dict = SnapshotInstanceProfileCollection.from_dict(snapshot_instance_profile_collection_model_json).__dict__
+ snapshot_instance_profile_collection_model2 = SnapshotInstanceProfileCollection(**snapshot_instance_profile_collection_model_dict)
+
+ # Verify the model instances are equivalent
+ assert snapshot_instance_profile_collection_model == snapshot_instance_profile_collection_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ snapshot_instance_profile_collection_model_json2 = snapshot_instance_profile_collection_model.to_dict()
+ assert snapshot_instance_profile_collection_model_json2 == snapshot_instance_profile_collection_model_json
+
+
class TestModel_SnapshotPatch:
"""
Test Class for SnapshotPatch
@@ -76854,8 +78634,16 @@ def test_snapshot_patch_serialization(self):
Test serialization/deserialization for SnapshotPatch
"""
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ snapshot_allowed_use_patch_model = {} # SnapshotAllowedUsePatch
+ snapshot_allowed_use_patch_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
# Construct a json representation of a SnapshotPatch model
snapshot_patch_model_json = {}
+ snapshot_patch_model_json['allowed_use'] = snapshot_allowed_use_patch_model
snapshot_patch_model_json['name'] = 'my-snapshot'
snapshot_patch_model_json['user_tags'] = ['testString']
@@ -77585,25 +79373,25 @@ def test_vpc_collection_serialization(self):
deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
network_acl_reference_model = {} # NetworkACLReference
- network_acl_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-699c2624-29f3-4edf-b29c-4193ce52cfad'
+ network_acl_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
network_acl_reference_model['deleted'] = deleted_model
- network_acl_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-699c2624-29f3-4edf-b29c-4193ce52cfad'
- network_acl_reference_model['id'] = 'r006-699c2624-29f3-4edf-b29c-4193ce52cfad'
+ network_acl_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
+ network_acl_reference_model['id'] = 'r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf'
network_acl_reference_model['name'] = 'my-network-acl'
routing_table_reference_model = {} # RoutingTableReference
routing_table_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
routing_table_reference_model['deleted'] = deleted_model
- routing_table_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-5ea1da83-7b29-4fd2-912a-501a1b508b7c/routing_tables/r006-cdc00ecf-0886-4ae0-82ef-b64c06a4856b'
- routing_table_reference_model['id'] = 'r006-cdc00ecf-0886-4ae0-82ef-b64c06a4856b'
+ routing_table_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
+ routing_table_reference_model['id'] = 'r006-6885e83f-03b2-4603-8a86-db2a0f55c840'
routing_table_reference_model['name'] = 'my-routing-table'
routing_table_reference_model['resource_type'] = 'routing_table'
security_group_reference_model = {} # SecurityGroupReference
- security_group_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-35e4a234-12d5-4446-a8f9-96eb8cb763bb'
+ security_group_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
security_group_reference_model['deleted'] = deleted_model
- security_group_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-35e4a234-12d5-4446-a8f9-96eb8cb763bb'
- security_group_reference_model['id'] = 'r006-35e4a234-12d5-4446-a8f9-96eb8cb763bb'
+ security_group_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ security_group_reference_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
security_group_reference_model['name'] = 'my-security-group'
dns_server_model = {} # DNSServer
@@ -77640,8 +79428,8 @@ def test_vpc_collection_serialization(self):
vpc_model = {} # VPC
vpc_model['classic_access'] = False
- vpc_model['created_at'] = '2019-01-27T15:40:41Z'
- vpc_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-5ea1da83-7b29-4fd2-912a-501a1b508b7c'
+ vpc_model['created_at'] = '2019-01-27T14:39:40Z'
+ vpc_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
vpc_model['cse_source_ips'] = [vpccse_source_ip_model]
vpc_model['default_network_acl'] = network_acl_reference_model
vpc_model['default_routing_table'] = routing_table_reference_model
@@ -77649,9 +79437,9 @@ def test_vpc_collection_serialization(self):
vpc_model['dns'] = vpcdns_model
vpc_model['health_reasons'] = [vpc_health_reason_model]
vpc_model['health_state'] = 'ok'
- vpc_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-5ea1da83-7b29-4fd2-912a-501a1b508b7c'
- vpc_model['id'] = 'r006-5ea1da83-7b29-4fd2-912a-501a1b508b7c'
- vpc_model['name'] = 'my-vpc-2'
+ vpc_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ vpc_model['name'] = 'my-vpc'
vpc_model['public_address_ranges'] = [public_address_range_reference_model]
vpc_model['resource_group'] = resource_group_reference_model
vpc_model['resource_type'] = 'vpc'
@@ -80270,6 +82058,11 @@ def test_volume_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ volume_allowed_use_model = {} # VolumeAllowedUse
+ volume_allowed_use_model['api_version'] = '2024-06-23'
+ volume_allowed_use_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
deleted_model = {} # Deleted
deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
@@ -80381,6 +82174,7 @@ def test_volume_serialization(self):
volume_model_json['active'] = True
volume_model_json['adjustable_capacity_states'] = ['attached', 'unattached']
volume_model_json['adjustable_iops_states'] = ['attached', 'unattached']
+ volume_model_json['allowed_use'] = volume_allowed_use_model
volume_model_json['attachment_state'] = 'attached'
volume_model_json['bandwidth'] = 100
volume_model_json['busy'] = True
@@ -80425,6 +82219,102 @@ def test_volume_serialization(self):
assert volume_model_json2 == volume_model_json
+class TestModel_VolumeAllowedUse:
+ """
+ Test Class for VolumeAllowedUse
+ """
+
+ def test_volume_allowed_use_serialization(self):
+ """
+ Test serialization/deserialization for VolumeAllowedUse
+ """
+
+ # Construct a json representation of a VolumeAllowedUse model
+ volume_allowed_use_model_json = {}
+ volume_allowed_use_model_json['api_version'] = '2024-06-23'
+ volume_allowed_use_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of VolumeAllowedUse by calling from_dict on the json representation
+ volume_allowed_use_model = VolumeAllowedUse.from_dict(volume_allowed_use_model_json)
+ assert volume_allowed_use_model != False
+
+ # Construct a model instance of VolumeAllowedUse by calling from_dict on the json representation
+ volume_allowed_use_model_dict = VolumeAllowedUse.from_dict(volume_allowed_use_model_json).__dict__
+ volume_allowed_use_model2 = VolumeAllowedUse(**volume_allowed_use_model_dict)
+
+ # Verify the model instances are equivalent
+ assert volume_allowed_use_model == volume_allowed_use_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ volume_allowed_use_model_json2 = volume_allowed_use_model.to_dict()
+ assert volume_allowed_use_model_json2 == volume_allowed_use_model_json
+
+
+class TestModel_VolumeAllowedUsePatch:
+ """
+ Test Class for VolumeAllowedUsePatch
+ """
+
+ def test_volume_allowed_use_patch_serialization(self):
+ """
+ Test serialization/deserialization for VolumeAllowedUsePatch
+ """
+
+ # Construct a json representation of a VolumeAllowedUsePatch model
+ volume_allowed_use_patch_model_json = {}
+ volume_allowed_use_patch_model_json['api_version'] = '2024-06-23'
+ volume_allowed_use_patch_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_patch_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of VolumeAllowedUsePatch by calling from_dict on the json representation
+ volume_allowed_use_patch_model = VolumeAllowedUsePatch.from_dict(volume_allowed_use_patch_model_json)
+ assert volume_allowed_use_patch_model != False
+
+ # Construct a model instance of VolumeAllowedUsePatch by calling from_dict on the json representation
+ volume_allowed_use_patch_model_dict = VolumeAllowedUsePatch.from_dict(volume_allowed_use_patch_model_json).__dict__
+ volume_allowed_use_patch_model2 = VolumeAllowedUsePatch(**volume_allowed_use_patch_model_dict)
+
+ # Verify the model instances are equivalent
+ assert volume_allowed_use_patch_model == volume_allowed_use_patch_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ volume_allowed_use_patch_model_json2 = volume_allowed_use_patch_model.to_dict()
+ assert volume_allowed_use_patch_model_json2 == volume_allowed_use_patch_model_json
+
+
+class TestModel_VolumeAllowedUsePrototype:
+ """
+ Test Class for VolumeAllowedUsePrototype
+ """
+
+ def test_volume_allowed_use_prototype_serialization(self):
+ """
+ Test serialization/deserialization for VolumeAllowedUsePrototype
+ """
+
+ # Construct a json representation of a VolumeAllowedUsePrototype model
+ volume_allowed_use_prototype_model_json = {}
+ volume_allowed_use_prototype_model_json['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model_json['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model_json['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
+ # Construct a model instance of VolumeAllowedUsePrototype by calling from_dict on the json representation
+ volume_allowed_use_prototype_model = VolumeAllowedUsePrototype.from_dict(volume_allowed_use_prototype_model_json)
+ assert volume_allowed_use_prototype_model != False
+
+ # Construct a model instance of VolumeAllowedUsePrototype by calling from_dict on the json representation
+ volume_allowed_use_prototype_model_dict = VolumeAllowedUsePrototype.from_dict(volume_allowed_use_prototype_model_json).__dict__
+ volume_allowed_use_prototype_model2 = VolumeAllowedUsePrototype(**volume_allowed_use_prototype_model_dict)
+
+ # Verify the model instances are equivalent
+ assert volume_allowed_use_prototype_model == volume_allowed_use_prototype_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ volume_allowed_use_prototype_model_json2 = volume_allowed_use_prototype_model.to_dict()
+ assert volume_allowed_use_prototype_model_json2 == volume_allowed_use_prototype_model_json
+
+
class TestModel_VolumeAttachment:
"""
Test Class for VolumeAttachment
@@ -80664,6 +82554,11 @@ def test_volume_attachment_prototype_instance_by_image_context_serialization(sel
# Construct dict forms of any model objects needed in order to build this model.
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -80674,6 +82569,7 @@ def test_volume_attachment_prototype_instance_by_image_context_serialization(sel
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -80717,6 +82613,11 @@ def test_volume_attachment_prototype_instance_by_source_snapshot_context_seriali
# Construct dict forms of any model objects needed in order to build this model.
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -80730,6 +82631,7 @@ def test_volume_attachment_prototype_instance_by_source_snapshot_context_seriali
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -80960,6 +82862,11 @@ def test_volume_collection_serialization(self):
page_link_model = {} # PageLink
page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=50'
+ volume_allowed_use_model = {} # VolumeAllowedUse
+ volume_allowed_use_model['api_version'] = '2024-06-23'
+ volume_allowed_use_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
deleted_model = {} # Deleted
deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
@@ -81070,6 +82977,7 @@ def test_volume_collection_serialization(self):
volume_model['active'] = False
volume_model['adjustable_capacity_states'] = ['attached']
volume_model['adjustable_iops_states'] = ['attached']
+ volume_model['allowed_use'] = volume_allowed_use_model
volume_model['attachment_state'] = 'attached'
volume_model['bandwidth'] = 1000
volume_model['busy'] = False
@@ -81154,6 +83062,50 @@ def test_volume_health_reason_serialization(self):
assert volume_health_reason_model_json2 == volume_health_reason_model_json
+class TestModel_VolumeInstanceProfileCollection:
+ """
+ Test Class for VolumeInstanceProfileCollection
+ """
+
+ def test_volume_instance_profile_collection_serialization(self):
+ """
+ Test serialization/deserialization for VolumeInstanceProfileCollection
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ page_link_model = {} # PageLink
+ page_link_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/volumes/{id}/instance_profiles?limit=50'
+
+ instance_profile_reference_model = {} # InstanceProfileReference
+ instance_profile_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-2x8'
+ instance_profile_reference_model['name'] = 'bx2-2x8'
+ instance_profile_reference_model['resource_type'] = 'instance_profile'
+
+ # Construct a json representation of a VolumeInstanceProfileCollection model
+ volume_instance_profile_collection_model_json = {}
+ volume_instance_profile_collection_model_json['first'] = page_link_model
+ volume_instance_profile_collection_model_json['instance_profiles'] = [instance_profile_reference_model]
+ volume_instance_profile_collection_model_json['limit'] = 20
+ volume_instance_profile_collection_model_json['next'] = page_link_model
+ volume_instance_profile_collection_model_json['total_count'] = 132
+
+ # Construct a model instance of VolumeInstanceProfileCollection by calling from_dict on the json representation
+ volume_instance_profile_collection_model = VolumeInstanceProfileCollection.from_dict(volume_instance_profile_collection_model_json)
+ assert volume_instance_profile_collection_model != False
+
+ # Construct a model instance of VolumeInstanceProfileCollection by calling from_dict on the json representation
+ volume_instance_profile_collection_model_dict = VolumeInstanceProfileCollection.from_dict(volume_instance_profile_collection_model_json).__dict__
+ volume_instance_profile_collection_model2 = VolumeInstanceProfileCollection(**volume_instance_profile_collection_model_dict)
+
+ # Verify the model instances are equivalent
+ assert volume_instance_profile_collection_model == volume_instance_profile_collection_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ volume_instance_profile_collection_model_json2 = volume_instance_profile_collection_model.to_dict()
+ assert volume_instance_profile_collection_model_json2 == volume_instance_profile_collection_model_json
+
+
class TestModel_VolumePatch:
"""
Test Class for VolumePatch
@@ -81166,11 +83118,17 @@ def test_volume_patch_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ volume_allowed_use_patch_model = {} # VolumeAllowedUsePatch
+ volume_allowed_use_patch_model['api_version'] = '2024-06-23'
+ volume_allowed_use_patch_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_patch_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
volume_profile_identity_model = {} # VolumeProfileIdentityByName
volume_profile_identity_model['name'] = 'general-purpose'
# Construct a json representation of a VolumePatch model
volume_patch_model_json = {}
+ volume_patch_model_json['allowed_use'] = volume_allowed_use_patch_model
volume_patch_model_json['bandwidth'] = 1000
volume_patch_model_json['capacity'] = 100
volume_patch_model_json['iops'] = 10000
@@ -81502,6 +83460,11 @@ def test_volume_prototype_instance_by_image_context_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -81513,6 +83476,7 @@ def test_volume_prototype_instance_by_image_context_serialization(self):
# Construct a json representation of a VolumePrototypeInstanceByImageContext model
volume_prototype_instance_by_image_context_model_json = {}
+ volume_prototype_instance_by_image_context_model_json['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model_json['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model_json['capacity'] = 100
volume_prototype_instance_by_image_context_model_json['encryption_key'] = encryption_key_identity_model
@@ -81550,6 +83514,11 @@ def test_volume_prototype_instance_by_source_snapshot_context_serialization(self
# Construct dict forms of any model objects needed in order to build this model.
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -81564,6 +83533,7 @@ def test_volume_prototype_instance_by_source_snapshot_context_serialization(self
# Construct a json representation of a VolumePrototypeInstanceBySourceSnapshotContext model
volume_prototype_instance_by_source_snapshot_context_model_json = {}
+ volume_prototype_instance_by_source_snapshot_context_model_json['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model_json['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model_json['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model_json['encryption_key'] = encryption_key_identity_model
@@ -84491,6 +86461,13 @@ def test_bare_metal_server_prototype_bare_metal_server_by_network_attachment_ser
# Construct dict forms of any model objects needed in order to build this model.
+ trusted_profile_identity_model = {} # TrustedProfileIdentityById
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {} # BareMetalServerInitializationDefaultTrustedProfilePrototype
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+
image_identity_model = {} # ImageIdentityById
image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
@@ -84498,10 +86475,15 @@ def test_bare_metal_server_prototype_bare_metal_server_by_network_attachment_ser
key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
bare_metal_server_initialization_prototype_model = {} # BareMetalServerInitializationPrototype
+ bare_metal_server_initialization_prototype_model['default_trusted_profile'] = bare_metal_server_initialization_default_trusted_profile_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'
+ bare_metal_server_metadata_service_prototype_model = {} # BareMetalServerMetadataServicePrototype
+ bare_metal_server_metadata_service_prototype_model['enabled'] = True
+ bare_metal_server_metadata_service_prototype_model['protocol'] = 'https'
+
bare_metal_server_profile_identity_model = {} # BareMetalServerProfileIdentityByName
bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768'
@@ -84569,6 +86551,7 @@ def test_bare_metal_server_prototype_bare_metal_server_by_network_attachment_ser
bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['bandwidth'] = 20000
bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['enable_secure_boot'] = False
bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['initialization'] = bare_metal_server_initialization_prototype_model
+ bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['metadata_service'] = bare_metal_server_metadata_service_prototype_model
bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['name'] = 'my-bare-metal-server'
bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['profile'] = bare_metal_server_profile_identity_model
bare_metal_server_prototype_bare_metal_server_by_network_attachment_model_json['reservation_affinity'] = bare_metal_server_reservation_affinity_prototype_model
@@ -84607,6 +86590,13 @@ def test_bare_metal_server_prototype_bare_metal_server_by_network_interface_seri
# Construct dict forms of any model objects needed in order to build this model.
+ trusted_profile_identity_model = {} # TrustedProfileIdentityById
+ trusted_profile_identity_model['id'] = 'Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5'
+
+ bare_metal_server_initialization_default_trusted_profile_prototype_model = {} # BareMetalServerInitializationDefaultTrustedProfilePrototype
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['auto_link'] = False
+ bare_metal_server_initialization_default_trusted_profile_prototype_model['target'] = trusted_profile_identity_model
+
image_identity_model = {} # ImageIdentityById
image_identity_model['id'] = 'r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8'
@@ -84614,10 +86604,15 @@ def test_bare_metal_server_prototype_bare_metal_server_by_network_interface_seri
key_identity_model['id'] = 'r006-82679077-ac3b-4c10-be16-63e9c21f0f45'
bare_metal_server_initialization_prototype_model = {} # BareMetalServerInitializationPrototype
+ bare_metal_server_initialization_prototype_model['default_trusted_profile'] = bare_metal_server_initialization_default_trusted_profile_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'
+ bare_metal_server_metadata_service_prototype_model = {} # BareMetalServerMetadataServicePrototype
+ bare_metal_server_metadata_service_prototype_model['enabled'] = True
+ bare_metal_server_metadata_service_prototype_model['protocol'] = 'https'
+
bare_metal_server_profile_identity_model = {} # BareMetalServerProfileIdentityByName
bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768'
@@ -84675,6 +86670,7 @@ def test_bare_metal_server_prototype_bare_metal_server_by_network_interface_seri
bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['bandwidth'] = 20000
bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['enable_secure_boot'] = False
bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['initialization'] = bare_metal_server_initialization_prototype_model
+ bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['metadata_service'] = bare_metal_server_metadata_service_prototype_model
bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['name'] = 'my-bare-metal-server'
bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['profile'] = bare_metal_server_profile_identity_model
bare_metal_server_prototype_bare_metal_server_by_network_interface_model_json['reservation_affinity'] = bare_metal_server_reservation_affinity_prototype_model
@@ -86764,6 +88760,11 @@ def test_image_prototype_image_by_file_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ image_allowed_use_prototype_model = {} # ImageAllowedUsePrototype
+ image_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ image_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
resource_group_identity_model = {} # ResourceGroupIdentityById
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
@@ -86778,6 +88779,7 @@ def test_image_prototype_image_by_file_serialization(self):
# Construct a json representation of a ImagePrototypeImageByFile model
image_prototype_image_by_file_model_json = {}
+ image_prototype_image_by_file_model_json['allowed_use'] = image_allowed_use_prototype_model
image_prototype_image_by_file_model_json['deprecation_at'] = '2019-01-01T12:00:00Z'
image_prototype_image_by_file_model_json['name'] = 'my-image'
image_prototype_image_by_file_model_json['obsolescence_at'] = '2019-01-01T12:00:00Z'
@@ -86815,6 +88817,11 @@ def test_image_prototype_image_by_source_volume_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ image_allowed_use_prototype_model = {} # ImageAllowedUsePrototype
+ image_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ image_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ image_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
resource_group_identity_model = {} # ResourceGroupIdentityById
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
@@ -86826,6 +88833,7 @@ def test_image_prototype_image_by_source_volume_serialization(self):
# Construct a json representation of a ImagePrototypeImageBySourceVolume model
image_prototype_image_by_source_volume_model_json = {}
+ image_prototype_image_by_source_volume_model_json['allowed_use'] = image_allowed_use_prototype_model
image_prototype_image_by_source_volume_model_json['deprecation_at'] = '2019-01-01T12:00:00Z'
image_prototype_image_by_source_volume_model_json['name'] = 'my-image'
image_prototype_image_by_source_volume_model_json['obsolescence_at'] = '2019-01-01T12:00:00Z'
@@ -89102,6 +91110,11 @@ def test_instance_prototype_instance_by_source_template_serialization(self):
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -89109,6 +91122,7 @@ def test_instance_prototype_instance_by_source_template_serialization(self):
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -89395,6 +91409,11 @@ def test_instance_template_prototype_instance_template_by_source_template_serial
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -89402,6 +91421,7 @@ def test_instance_template_prototype_instance_template_by_source_template_serial
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -90425,6 +92445,46 @@ def test_load_balancer_pool_identity_load_balancer_pool_identity_by_id_serializa
assert load_balancer_pool_identity_load_balancer_pool_identity_by_id_model_json2 == load_balancer_pool_identity_load_balancer_pool_identity_by_id_model_json
+class TestModel_LoadBalancerPoolMemberTargetByReservedIp:
+ """
+ Test Class for LoadBalancerPoolMemberTargetByReservedIp
+ """
+
+ def test_load_balancer_pool_member_target_by_reserved_ip_serialization(self):
+ """
+ Test serialization/deserialization for LoadBalancerPoolMemberTargetByReservedIp
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ deleted_model = {} # Deleted
+ deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources'
+
+ # Construct a json representation of a LoadBalancerPoolMemberTargetByReservedIp model
+ load_balancer_pool_member_target_by_reserved_ip_model_json = {}
+ load_balancer_pool_member_target_by_reserved_ip_model_json['address'] = '192.168.3.4'
+ load_balancer_pool_member_target_by_reserved_ip_model_json['deleted'] = deleted_model
+ load_balancer_pool_member_target_by_reserved_ip_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+ load_balancer_pool_member_target_by_reserved_ip_model_json['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+ load_balancer_pool_member_target_by_reserved_ip_model_json['name'] = 'my-reserved-ip'
+ load_balancer_pool_member_target_by_reserved_ip_model_json['resource_type'] = 'subnet_reserved_ip'
+
+ # Construct a model instance of LoadBalancerPoolMemberTargetByReservedIp by calling from_dict on the json representation
+ load_balancer_pool_member_target_by_reserved_ip_model = LoadBalancerPoolMemberTargetByReservedIp.from_dict(load_balancer_pool_member_target_by_reserved_ip_model_json)
+ assert load_balancer_pool_member_target_by_reserved_ip_model != False
+
+ # Construct a model instance of LoadBalancerPoolMemberTargetByReservedIp by calling from_dict on the json representation
+ load_balancer_pool_member_target_by_reserved_ip_model_dict = LoadBalancerPoolMemberTargetByReservedIp.from_dict(load_balancer_pool_member_target_by_reserved_ip_model_json).__dict__
+ load_balancer_pool_member_target_by_reserved_ip_model2 = LoadBalancerPoolMemberTargetByReservedIp(**load_balancer_pool_member_target_by_reserved_ip_model_dict)
+
+ # Verify the model instances are equivalent
+ assert load_balancer_pool_member_target_by_reserved_ip_model == load_balancer_pool_member_target_by_reserved_ip_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ load_balancer_pool_member_target_by_reserved_ip_model_json2 = load_balancer_pool_member_target_by_reserved_ip_model.to_dict()
+ assert load_balancer_pool_member_target_by_reserved_ip_model_json2 == load_balancer_pool_member_target_by_reserved_ip_model_json
+
+
class TestModel_LoadBalancerPoolMemberTargetPrototypeIP:
"""
Test Class for LoadBalancerPoolMemberTargetPrototypeIP
@@ -90455,34 +92515,34 @@ def test_load_balancer_pool_member_target_prototype_ip_serialization(self):
assert load_balancer_pool_member_target_prototype_ip_model_json2 == load_balancer_pool_member_target_prototype_ip_model_json
-class TestModel_LoadBalancerPoolMemberTargetIP:
+class TestModel_LoadBalancerPoolMemberTargetIPNotReservedIP:
"""
- Test Class for LoadBalancerPoolMemberTargetIP
+ Test Class for LoadBalancerPoolMemberTargetIPNotReservedIP
"""
- def test_load_balancer_pool_member_target_ip_serialization(self):
+ def test_load_balancer_pool_member_target_ip_not_reserved_ip_serialization(self):
"""
- Test serialization/deserialization for LoadBalancerPoolMemberTargetIP
+ Test serialization/deserialization for LoadBalancerPoolMemberTargetIPNotReservedIP
"""
- # Construct a json representation of a LoadBalancerPoolMemberTargetIP model
- load_balancer_pool_member_target_ip_model_json = {}
- load_balancer_pool_member_target_ip_model_json['address'] = '192.168.3.4'
+ # Construct a json representation of a LoadBalancerPoolMemberTargetIPNotReservedIP model
+ load_balancer_pool_member_target_ip_not_reserved_ip_model_json = {}
+ load_balancer_pool_member_target_ip_not_reserved_ip_model_json['address'] = '192.168.3.4'
- # Construct a model instance of LoadBalancerPoolMemberTargetIP by calling from_dict on the json representation
- load_balancer_pool_member_target_ip_model = LoadBalancerPoolMemberTargetIP.from_dict(load_balancer_pool_member_target_ip_model_json)
- assert load_balancer_pool_member_target_ip_model != False
+ # Construct a model instance of LoadBalancerPoolMemberTargetIPNotReservedIP by calling from_dict on the json representation
+ load_balancer_pool_member_target_ip_not_reserved_ip_model = LoadBalancerPoolMemberTargetIPNotReservedIP.from_dict(load_balancer_pool_member_target_ip_not_reserved_ip_model_json)
+ assert load_balancer_pool_member_target_ip_not_reserved_ip_model != False
- # Construct a model instance of LoadBalancerPoolMemberTargetIP by calling from_dict on the json representation
- load_balancer_pool_member_target_ip_model_dict = LoadBalancerPoolMemberTargetIP.from_dict(load_balancer_pool_member_target_ip_model_json).__dict__
- load_balancer_pool_member_target_ip_model2 = LoadBalancerPoolMemberTargetIP(**load_balancer_pool_member_target_ip_model_dict)
+ # Construct a model instance of LoadBalancerPoolMemberTargetIPNotReservedIP by calling from_dict on the json representation
+ load_balancer_pool_member_target_ip_not_reserved_ip_model_dict = LoadBalancerPoolMemberTargetIPNotReservedIP.from_dict(load_balancer_pool_member_target_ip_not_reserved_ip_model_json).__dict__
+ load_balancer_pool_member_target_ip_not_reserved_ip_model2 = LoadBalancerPoolMemberTargetIPNotReservedIP(**load_balancer_pool_member_target_ip_not_reserved_ip_model_dict)
# Verify the model instances are equivalent
- assert load_balancer_pool_member_target_ip_model == load_balancer_pool_member_target_ip_model2
+ assert load_balancer_pool_member_target_ip_not_reserved_ip_model == load_balancer_pool_member_target_ip_not_reserved_ip_model2
# Convert model instance back to dict and verify no loss of data
- load_balancer_pool_member_target_ip_model_json2 = load_balancer_pool_member_target_ip_model.to_dict()
- assert load_balancer_pool_member_target_ip_model_json2 == load_balancer_pool_member_target_ip_model_json
+ load_balancer_pool_member_target_ip_not_reserved_ip_model_json2 = load_balancer_pool_member_target_ip_not_reserved_ip_model.to_dict()
+ assert load_balancer_pool_member_target_ip_not_reserved_ip_model_json2 == load_balancer_pool_member_target_ip_not_reserved_ip_model_json
class TestModel_LoadBalancerPoolMemberTargetInstanceReference:
@@ -94146,135 +96206,425 @@ def test_share_mount_target_prototype_share_mount_target_by_access_control_mode_
subnet_identity_model = {} # SubnetIdentityById
subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- share_mount_target_virtual_network_interface_prototype_model = {} # ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
- share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
- share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
- share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
- share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
- share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
- share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
- share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
- share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
- share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+ share_mount_target_virtual_network_interface_prototype_model = {} # ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
+ share_mount_target_virtual_network_interface_prototype_model['allow_ip_spoofing'] = True
+ share_mount_target_virtual_network_interface_prototype_model['auto_delete'] = False
+ share_mount_target_virtual_network_interface_prototype_model['enable_infrastructure_nat'] = True
+ share_mount_target_virtual_network_interface_prototype_model['ips'] = [virtual_network_interface_ip_prototype_model]
+ share_mount_target_virtual_network_interface_prototype_model['name'] = 'my-virtual-network-interface'
+ share_mount_target_virtual_network_interface_prototype_model['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ share_mount_target_virtual_network_interface_prototype_model['protocol_state_filtering_mode'] = 'auto'
+ share_mount_target_virtual_network_interface_prototype_model['resource_group'] = resource_group_identity_model
+ share_mount_target_virtual_network_interface_prototype_model['security_groups'] = [security_group_identity_model]
+ share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
+
+ # Construct a json representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json = {}
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['access_protocol'] = 'nfs4'
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['name'] = 'my-share-mount-target'
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['transit_encryption'] = 'none'
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
+
+ # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup by calling from_dict on the json representation
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model = ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json)
+ assert share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model != False
+
+ # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup by calling from_dict on the json representation
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_dict = ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json).__dict__
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model2 = ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(**share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model == share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json2 = share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model.to_dict()
+ assert share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json2 == share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json
+
+
+class TestModel_ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC:
+ """
+ Test Class for ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC
+ """
+
+ def test_share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_serialization(self):
+ """
+ Test serialization/deserialization for ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ vpc_identity_model = {} # VPCIdentityById
+ vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+
+ # Construct a json representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC model
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json = {}
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['access_protocol'] = 'nfs4'
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['name'] = 'my-share-mount-target'
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['transit_encryption'] = 'none'
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['vpc'] = vpc_identity_model
+
+ # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC by calling from_dict on the json representation
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model = ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json)
+ assert share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model != False
+
+ # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC by calling from_dict on the json representation
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_dict = ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json).__dict__
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model2 = ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(**share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model == share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json2 = share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model.to_dict()
+ assert share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json2 == share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json
+
+
+class TestModel_ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext:
+ """
+ Test Class for ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
+ """
+
+ def test_share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_serialization(self):
+ """
+ Test serialization/deserialization for ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
+ """
+
+ # Construct dict forms of any model objects needed in order to build this model.
+
+ virtual_network_interface_ip_prototype_model = {} # VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext
+ virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ virtual_network_interface_primary_ip_prototype_model = {} # VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext
+ virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
+ virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
+ virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+
+ resource_group_identity_model = {} # ResourceGroupIdentityById
+ resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+
+ security_group_identity_model = {} # SecurityGroupIdentityById
+ security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+
+ subnet_identity_model = {} # SubnetIdentityById
+ subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
+
+ # Construct a json representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json = {}
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['allow_ip_spoofing'] = True
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['auto_delete'] = False
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['enable_infrastructure_nat'] = True
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['ips'] = [virtual_network_interface_ip_prototype_model]
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['name'] = 'my-virtual-network-interface'
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['protocol_state_filtering_mode'] = 'auto'
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['resource_group'] = resource_group_identity_model
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['security_groups'] = [security_group_identity_model]
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['subnet'] = subnet_identity_model
- # Construct a json representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json = {}
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['name'] = 'my-share-mount-target'
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['transit_encryption'] = 'none'
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
+ # Construct a model instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext by calling from_dict on the json representation
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model = ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext.from_dict(share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json)
+ assert share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model != False
- # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup by calling from_dict on the json representation
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model = ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json)
- assert share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model != False
+ # Construct a model instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext by calling from_dict on the json representation
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_dict = ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext.from_dict(share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json).__dict__
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model2 = ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(**share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_dict)
- # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup by calling from_dict on the json representation
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_dict = ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json).__dict__
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model2 = ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(**share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_dict)
+ # Verify the model instances are equivalent
+ assert share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model == share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json2 = share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model.to_dict()
+ assert share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json2 == share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json
+
+
+class TestModel_ShareProfileAllowedAccessProtocolsSubset:
+ """
+ Test Class for ShareProfileAllowedAccessProtocolsSubset
+ """
+
+ def test_share_profile_allowed_access_protocols_subset_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileAllowedAccessProtocolsSubset
+ """
+
+ # Construct a json representation of a ShareProfileAllowedAccessProtocolsSubset model
+ share_profile_allowed_access_protocols_subset_model_json = {}
+ share_profile_allowed_access_protocols_subset_model_json['default'] = ['nfs4']
+ share_profile_allowed_access_protocols_subset_model_json['type'] = 'subset'
+ share_profile_allowed_access_protocols_subset_model_json['values'] = ['nfs4']
+
+ # Construct a model instance of ShareProfileAllowedAccessProtocolsSubset by calling from_dict on the json representation
+ share_profile_allowed_access_protocols_subset_model = ShareProfileAllowedAccessProtocolsSubset.from_dict(share_profile_allowed_access_protocols_subset_model_json)
+ assert share_profile_allowed_access_protocols_subset_model != False
+
+ # Construct a model instance of ShareProfileAllowedAccessProtocolsSubset by calling from_dict on the json representation
+ share_profile_allowed_access_protocols_subset_model_dict = ShareProfileAllowedAccessProtocolsSubset.from_dict(share_profile_allowed_access_protocols_subset_model_json).__dict__
+ share_profile_allowed_access_protocols_subset_model2 = ShareProfileAllowedAccessProtocolsSubset(**share_profile_allowed_access_protocols_subset_model_dict)
# Verify the model instances are equivalent
- assert share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model == share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model2
+ assert share_profile_allowed_access_protocols_subset_model == share_profile_allowed_access_protocols_subset_model2
# Convert model instance back to dict and verify no loss of data
- share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json2 = share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model.to_dict()
- assert share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json2 == share_mount_target_prototype_share_mount_target_by_access_control_mode_security_group_model_json
+ share_profile_allowed_access_protocols_subset_model_json2 = share_profile_allowed_access_protocols_subset_model.to_dict()
+ assert share_profile_allowed_access_protocols_subset_model_json2 == share_profile_allowed_access_protocols_subset_model_json
-class TestModel_ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC:
+class TestModel_ShareProfileAllowedTransitEncryptionModesSubset:
"""
- Test Class for ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC
+ Test Class for ShareProfileAllowedTransitEncryptionModesSubset
"""
- def test_share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_serialization(self):
+ def test_share_profile_allowed_transit_encryption_modes_subset_serialization(self):
"""
- Test serialization/deserialization for ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC
+ Test serialization/deserialization for ShareProfileAllowedTransitEncryptionModesSubset
"""
- # Construct dict forms of any model objects needed in order to build this model.
+ # Construct a json representation of a ShareProfileAllowedTransitEncryptionModesSubset model
+ share_profile_allowed_transit_encryption_modes_subset_model_json = {}
+ share_profile_allowed_transit_encryption_modes_subset_model_json['default'] = ['ipsec']
+ share_profile_allowed_transit_encryption_modes_subset_model_json['type'] = 'subset'
+ share_profile_allowed_transit_encryption_modes_subset_model_json['values'] = ['ipsec']
- vpc_identity_model = {} # VPCIdentityById
- vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ # Construct a model instance of ShareProfileAllowedTransitEncryptionModesSubset by calling from_dict on the json representation
+ share_profile_allowed_transit_encryption_modes_subset_model = ShareProfileAllowedTransitEncryptionModesSubset.from_dict(share_profile_allowed_transit_encryption_modes_subset_model_json)
+ assert share_profile_allowed_transit_encryption_modes_subset_model != False
- # Construct a json representation of a ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC model
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json = {}
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['name'] = 'my-share-mount-target'
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['transit_encryption'] = 'none'
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json['vpc'] = vpc_identity_model
+ # Construct a model instance of ShareProfileAllowedTransitEncryptionModesSubset by calling from_dict on the json representation
+ share_profile_allowed_transit_encryption_modes_subset_model_dict = ShareProfileAllowedTransitEncryptionModesSubset.from_dict(share_profile_allowed_transit_encryption_modes_subset_model_json).__dict__
+ share_profile_allowed_transit_encryption_modes_subset_model2 = ShareProfileAllowedTransitEncryptionModesSubset(**share_profile_allowed_transit_encryption_modes_subset_model_dict)
- # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC by calling from_dict on the json representation
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model = ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json)
- assert share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model != False
+ # Verify the model instances are equivalent
+ assert share_profile_allowed_transit_encryption_modes_subset_model == share_profile_allowed_transit_encryption_modes_subset_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_allowed_transit_encryption_modes_subset_model_json2 = share_profile_allowed_transit_encryption_modes_subset_model.to_dict()
+ assert share_profile_allowed_transit_encryption_modes_subset_model_json2 == share_profile_allowed_transit_encryption_modes_subset_model_json
- # Construct a model instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC by calling from_dict on the json representation
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_dict = ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.from_dict(share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json).__dict__
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model2 = ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(**share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_dict)
+
+class TestModel_ShareProfileAvailabilityModesEnum:
+ """
+ Test Class for ShareProfileAvailabilityModesEnum
+ """
+
+ def test_share_profile_availability_modes_enum_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileAvailabilityModesEnum
+ """
+
+ # Construct a json representation of a ShareProfileAvailabilityModesEnum model
+ share_profile_availability_modes_enum_model_json = {}
+ share_profile_availability_modes_enum_model_json['default'] = 'zonal'
+ share_profile_availability_modes_enum_model_json['type'] = 'enum'
+ share_profile_availability_modes_enum_model_json['values'] = ['zonal']
+
+ # Construct a model instance of ShareProfileAvailabilityModesEnum by calling from_dict on the json representation
+ share_profile_availability_modes_enum_model = ShareProfileAvailabilityModesEnum.from_dict(share_profile_availability_modes_enum_model_json)
+ assert share_profile_availability_modes_enum_model != False
+
+ # Construct a model instance of ShareProfileAvailabilityModesEnum by calling from_dict on the json representation
+ share_profile_availability_modes_enum_model_dict = ShareProfileAvailabilityModesEnum.from_dict(share_profile_availability_modes_enum_model_json).__dict__
+ share_profile_availability_modes_enum_model2 = ShareProfileAvailabilityModesEnum(**share_profile_availability_modes_enum_model_dict)
# Verify the model instances are equivalent
- assert share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model == share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model2
+ assert share_profile_availability_modes_enum_model == share_profile_availability_modes_enum_model2
# Convert model instance back to dict and verify no loss of data
- share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json2 = share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model.to_dict()
- assert share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json2 == share_mount_target_prototype_share_mount_target_by_access_control_mode_vpc_model_json
+ share_profile_availability_modes_enum_model_json2 = share_profile_availability_modes_enum_model.to_dict()
+ assert share_profile_availability_modes_enum_model_json2 == share_profile_availability_modes_enum_model_json
-class TestModel_ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext:
+class TestModel_ShareProfileAvailabilityModesFixed:
"""
- Test Class for ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
+ Test Class for ShareProfileAvailabilityModesFixed
"""
- def test_share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_serialization(self):
+ def test_share_profile_availability_modes_fixed_serialization(self):
"""
- Test serialization/deserialization for ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
+ Test serialization/deserialization for ShareProfileAvailabilityModesFixed
"""
- # Construct dict forms of any model objects needed in order to build this model.
+ # Construct a json representation of a ShareProfileAvailabilityModesFixed model
+ share_profile_availability_modes_fixed_model_json = {}
+ share_profile_availability_modes_fixed_model_json['type'] = 'fixed'
+ share_profile_availability_modes_fixed_model_json['value'] = 'zonal'
- virtual_network_interface_ip_prototype_model = {} # VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext
- virtual_network_interface_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a model instance of ShareProfileAvailabilityModesFixed by calling from_dict on the json representation
+ share_profile_availability_modes_fixed_model = ShareProfileAvailabilityModesFixed.from_dict(share_profile_availability_modes_fixed_model_json)
+ assert share_profile_availability_modes_fixed_model != False
- virtual_network_interface_primary_ip_prototype_model = {} # VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext
- virtual_network_interface_primary_ip_prototype_model['address'] = '10.0.0.5'
- virtual_network_interface_primary_ip_prototype_model['auto_delete'] = False
- virtual_network_interface_primary_ip_prototype_model['name'] = 'my-reserved-ip'
+ # Construct a model instance of ShareProfileAvailabilityModesFixed by calling from_dict on the json representation
+ share_profile_availability_modes_fixed_model_dict = ShareProfileAvailabilityModesFixed.from_dict(share_profile_availability_modes_fixed_model_json).__dict__
+ share_profile_availability_modes_fixed_model2 = ShareProfileAvailabilityModesFixed(**share_profile_availability_modes_fixed_model_dict)
- resource_group_identity_model = {} # ResourceGroupIdentityById
- resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ # Verify the model instances are equivalent
+ assert share_profile_availability_modes_fixed_model == share_profile_availability_modes_fixed_model2
- security_group_identity_model = {} # SecurityGroupIdentityById
- security_group_identity_model['id'] = 'r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271'
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_availability_modes_fixed_model_json2 = share_profile_availability_modes_fixed_model.to_dict()
+ assert share_profile_availability_modes_fixed_model_json2 == share_profile_availability_modes_fixed_model_json
- subnet_identity_model = {} # SubnetIdentityById
- subnet_identity_model['id'] = '0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e'
- # Construct a json representation of a ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json = {}
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['allow_ip_spoofing'] = True
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['auto_delete'] = False
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['enable_infrastructure_nat'] = True
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['ips'] = [virtual_network_interface_ip_prototype_model]
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['name'] = 'my-virtual-network-interface'
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['primary_ip'] = virtual_network_interface_primary_ip_prototype_model
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['protocol_state_filtering_mode'] = 'auto'
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['resource_group'] = resource_group_identity_model
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['security_groups'] = [security_group_identity_model]
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json['subnet'] = subnet_identity_model
+class TestModel_ShareProfileBandwidthDependent:
+ """
+ Test Class for ShareProfileBandwidthDependent
+ """
- # Construct a model instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext by calling from_dict on the json representation
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model = ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext.from_dict(share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json)
- assert share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model != False
+ def test_share_profile_bandwidth_dependent_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileBandwidthDependent
+ """
- # Construct a model instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext by calling from_dict on the json representation
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_dict = ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext.from_dict(share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json).__dict__
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model2 = ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(**share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_dict)
+ # Construct a json representation of a ShareProfileBandwidthDependent model
+ share_profile_bandwidth_dependent_model_json = {}
+ share_profile_bandwidth_dependent_model_json['type'] = 'dependent'
+
+ # Construct a model instance of ShareProfileBandwidthDependent by calling from_dict on the json representation
+ share_profile_bandwidth_dependent_model = ShareProfileBandwidthDependent.from_dict(share_profile_bandwidth_dependent_model_json)
+ assert share_profile_bandwidth_dependent_model != False
+
+ # Construct a model instance of ShareProfileBandwidthDependent by calling from_dict on the json representation
+ share_profile_bandwidth_dependent_model_dict = ShareProfileBandwidthDependent.from_dict(share_profile_bandwidth_dependent_model_json).__dict__
+ share_profile_bandwidth_dependent_model2 = ShareProfileBandwidthDependent(**share_profile_bandwidth_dependent_model_dict)
# Verify the model instances are equivalent
- assert share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model == share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model2
+ assert share_profile_bandwidth_dependent_model == share_profile_bandwidth_dependent_model2
# Convert model instance back to dict and verify no loss of data
- share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json2 = share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model.to_dict()
- assert share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json2 == share_mount_target_virtual_network_interface_prototype_virtual_network_interface_prototype_share_mount_target_context_model_json
+ share_profile_bandwidth_dependent_model_json2 = share_profile_bandwidth_dependent_model.to_dict()
+ assert share_profile_bandwidth_dependent_model_json2 == share_profile_bandwidth_dependent_model_json
+
+
+class TestModel_ShareProfileBandwidthDependentRange:
+ """
+ Test Class for ShareProfileBandwidthDependentRange
+ """
+
+ def test_share_profile_bandwidth_dependent_range_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileBandwidthDependentRange
+ """
+
+ # Construct a json representation of a ShareProfileBandwidthDependentRange model
+ share_profile_bandwidth_dependent_range_model_json = {}
+ share_profile_bandwidth_dependent_range_model_json['max'] = 400
+ share_profile_bandwidth_dependent_range_model_json['min'] = 100
+ share_profile_bandwidth_dependent_range_model_json['step'] = 1
+ share_profile_bandwidth_dependent_range_model_json['type'] = 'dependent_range'
+
+ # Construct a model instance of ShareProfileBandwidthDependentRange by calling from_dict on the json representation
+ share_profile_bandwidth_dependent_range_model = ShareProfileBandwidthDependentRange.from_dict(share_profile_bandwidth_dependent_range_model_json)
+ assert share_profile_bandwidth_dependent_range_model != False
+
+ # Construct a model instance of ShareProfileBandwidthDependentRange by calling from_dict on the json representation
+ share_profile_bandwidth_dependent_range_model_dict = ShareProfileBandwidthDependentRange.from_dict(share_profile_bandwidth_dependent_range_model_json).__dict__
+ share_profile_bandwidth_dependent_range_model2 = ShareProfileBandwidthDependentRange(**share_profile_bandwidth_dependent_range_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_profile_bandwidth_dependent_range_model == share_profile_bandwidth_dependent_range_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_bandwidth_dependent_range_model_json2 = share_profile_bandwidth_dependent_range_model.to_dict()
+ assert share_profile_bandwidth_dependent_range_model_json2 == share_profile_bandwidth_dependent_range_model_json
+
+
+class TestModel_ShareProfileBandwidthEnum:
+ """
+ Test Class for ShareProfileBandwidthEnum
+ """
+
+ def test_share_profile_bandwidth_enum_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileBandwidthEnum
+ """
+
+ # Construct a json representation of a ShareProfileBandwidthEnum model
+ share_profile_bandwidth_enum_model_json = {}
+ share_profile_bandwidth_enum_model_json['default'] = 38
+ share_profile_bandwidth_enum_model_json['type'] = 'enum'
+ share_profile_bandwidth_enum_model_json['values'] = [100, 200, 400]
+
+ # Construct a model instance of ShareProfileBandwidthEnum by calling from_dict on the json representation
+ share_profile_bandwidth_enum_model = ShareProfileBandwidthEnum.from_dict(share_profile_bandwidth_enum_model_json)
+ assert share_profile_bandwidth_enum_model != False
+
+ # Construct a model instance of ShareProfileBandwidthEnum by calling from_dict on the json representation
+ share_profile_bandwidth_enum_model_dict = ShareProfileBandwidthEnum.from_dict(share_profile_bandwidth_enum_model_json).__dict__
+ share_profile_bandwidth_enum_model2 = ShareProfileBandwidthEnum(**share_profile_bandwidth_enum_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_profile_bandwidth_enum_model == share_profile_bandwidth_enum_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_bandwidth_enum_model_json2 = share_profile_bandwidth_enum_model.to_dict()
+ assert share_profile_bandwidth_enum_model_json2 == share_profile_bandwidth_enum_model_json
+
+
+class TestModel_ShareProfileBandwidthFixed:
+ """
+ Test Class for ShareProfileBandwidthFixed
+ """
+
+ def test_share_profile_bandwidth_fixed_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileBandwidthFixed
+ """
+
+ # Construct a json representation of a ShareProfileBandwidthFixed model
+ share_profile_bandwidth_fixed_model_json = {}
+ share_profile_bandwidth_fixed_model_json['type'] = 'fixed'
+ share_profile_bandwidth_fixed_model_json['value'] = 100
+
+ # Construct a model instance of ShareProfileBandwidthFixed by calling from_dict on the json representation
+ share_profile_bandwidth_fixed_model = ShareProfileBandwidthFixed.from_dict(share_profile_bandwidth_fixed_model_json)
+ assert share_profile_bandwidth_fixed_model != False
+
+ # Construct a model instance of ShareProfileBandwidthFixed by calling from_dict on the json representation
+ share_profile_bandwidth_fixed_model_dict = ShareProfileBandwidthFixed.from_dict(share_profile_bandwidth_fixed_model_json).__dict__
+ share_profile_bandwidth_fixed_model2 = ShareProfileBandwidthFixed(**share_profile_bandwidth_fixed_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_profile_bandwidth_fixed_model == share_profile_bandwidth_fixed_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_bandwidth_fixed_model_json2 = share_profile_bandwidth_fixed_model.to_dict()
+ assert share_profile_bandwidth_fixed_model_json2 == share_profile_bandwidth_fixed_model_json
+
+
+class TestModel_ShareProfileBandwidthRange:
+ """
+ Test Class for ShareProfileBandwidthRange
+ """
+
+ def test_share_profile_bandwidth_range_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileBandwidthRange
+ """
+
+ # Construct a json representation of a ShareProfileBandwidthRange model
+ share_profile_bandwidth_range_model_json = {}
+ share_profile_bandwidth_range_model_json['default'] = 100
+ share_profile_bandwidth_range_model_json['max'] = 1024
+ share_profile_bandwidth_range_model_json['min'] = 1
+ share_profile_bandwidth_range_model_json['step'] = 1
+ share_profile_bandwidth_range_model_json['type'] = 'range'
+ share_profile_bandwidth_range_model_json['value'] = 38
+
+ # Construct a model instance of ShareProfileBandwidthRange by calling from_dict on the json representation
+ share_profile_bandwidth_range_model = ShareProfileBandwidthRange.from_dict(share_profile_bandwidth_range_model_json)
+ assert share_profile_bandwidth_range_model != False
+
+ # Construct a model instance of ShareProfileBandwidthRange by calling from_dict on the json representation
+ share_profile_bandwidth_range_model_dict = ShareProfileBandwidthRange.from_dict(share_profile_bandwidth_range_model_json).__dict__
+ share_profile_bandwidth_range_model2 = ShareProfileBandwidthRange(**share_profile_bandwidth_range_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_profile_bandwidth_range_model == share_profile_bandwidth_range_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_bandwidth_range_model_json2 = share_profile_bandwidth_range_model.to_dict()
+ assert share_profile_bandwidth_range_model_json2 == share_profile_bandwidth_range_model_json
class TestModel_ShareProfileCapacityDependentRange:
@@ -94626,6 +96976,37 @@ def test_share_profile_identity_by_name_serialization(self):
assert share_profile_identity_by_name_model_json2 == share_profile_identity_by_name_model_json
+class TestModel_ShareProfileStorageGenerationFixed:
+ """
+ Test Class for ShareProfileStorageGenerationFixed
+ """
+
+ def test_share_profile_storage_generation_fixed_serialization(self):
+ """
+ Test serialization/deserialization for ShareProfileStorageGenerationFixed
+ """
+
+ # Construct a json representation of a ShareProfileStorageGenerationFixed model
+ share_profile_storage_generation_fixed_model_json = {}
+ share_profile_storage_generation_fixed_model_json['type'] = 'fixed'
+ share_profile_storage_generation_fixed_model_json['value'] = 1
+
+ # Construct a model instance of ShareProfileStorageGenerationFixed by calling from_dict on the json representation
+ share_profile_storage_generation_fixed_model = ShareProfileStorageGenerationFixed.from_dict(share_profile_storage_generation_fixed_model_json)
+ assert share_profile_storage_generation_fixed_model != False
+
+ # Construct a model instance of ShareProfileStorageGenerationFixed by calling from_dict on the json representation
+ share_profile_storage_generation_fixed_model_dict = ShareProfileStorageGenerationFixed.from_dict(share_profile_storage_generation_fixed_model_json).__dict__
+ share_profile_storage_generation_fixed_model2 = ShareProfileStorageGenerationFixed(**share_profile_storage_generation_fixed_model_dict)
+
+ # Verify the model instances are equivalent
+ assert share_profile_storage_generation_fixed_model == share_profile_storage_generation_fixed_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ share_profile_storage_generation_fixed_model_json2 = share_profile_storage_generation_fixed_model.to_dict()
+ assert share_profile_storage_generation_fixed_model_json2 == share_profile_storage_generation_fixed_model_json
+
+
class TestModel_SharePrototypeShareByOriginShare:
"""
Test Class for SharePrototypeShareByOriginShare
@@ -94670,6 +97051,7 @@ def test_share_prototype_share_by_origin_share_serialization(self):
share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
share_mount_target_prototype_model = {} # ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
share_mount_target_prototype_model['name'] = 'my-share-mount-target'
share_mount_target_prototype_model['transit_encryption'] = 'none'
share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
@@ -94681,7 +97063,7 @@ def test_share_prototype_share_by_origin_share_serialization(self):
zone_identity_model['name'] = 'us-south-1'
share_prototype_share_context_model = {} # SharePrototypeShareContext
- share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_context_model['iops'] = 100
share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_context_model['name'] = 'my-share'
@@ -94696,12 +97078,13 @@ def test_share_prototype_share_by_origin_share_serialization(self):
# Construct a json representation of a SharePrototypeShareByOriginShare model
share_prototype_share_by_origin_share_model_json = {}
- share_prototype_share_by_origin_share_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_by_origin_share_model_json['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_by_origin_share_model_json['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_by_origin_share_model_json['name'] = 'my-share'
share_prototype_share_by_origin_share_model_json['replica_share'] = share_prototype_share_context_model
share_prototype_share_by_origin_share_model_json['user_tags'] = []
share_prototype_share_by_origin_share_model_json['origin_share'] = share_identity_model
+ share_prototype_share_by_origin_share_model_json['resource_group'] = resource_group_identity_model
# Construct a model instance of SharePrototypeShareByOriginShare by calling from_dict on the json representation
share_prototype_share_by_origin_share_model = SharePrototypeShareByOriginShare.from_dict(share_prototype_share_by_origin_share_model_json)
@@ -94763,6 +97146,7 @@ def test_share_prototype_share_by_size_serialization(self):
share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
share_mount_target_prototype_model = {} # ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
share_mount_target_prototype_model['name'] = 'my-share-mount-target'
share_mount_target_prototype_model['transit_encryption'] = 'none'
share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
@@ -94774,7 +97158,7 @@ def test_share_prototype_share_by_size_serialization(self):
zone_identity_model['name'] = 'us-south-1'
share_prototype_share_context_model = {} # SharePrototypeShareContext
- share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_context_model['iops'] = 100
share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_context_model['name'] = 'my-share'
@@ -94793,12 +97177,14 @@ def test_share_prototype_share_by_size_serialization(self):
# Construct a json representation of a SharePrototypeShareBySize model
share_prototype_share_by_size_model_json = {}
- share_prototype_share_by_size_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_by_size_model_json['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_by_size_model_json['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_by_size_model_json['name'] = 'my-share'
share_prototype_share_by_size_model_json['replica_share'] = share_prototype_share_context_model
share_prototype_share_by_size_model_json['user_tags'] = []
share_prototype_share_by_size_model_json['access_control_mode'] = 'security_group'
+ share_prototype_share_by_size_model_json['allowed_access_protocols'] = ['nfs4']
+ share_prototype_share_by_size_model_json['bandwidth'] = 100
share_prototype_share_by_size_model_json['encryption_key'] = encryption_key_identity_model
share_prototype_share_by_size_model_json['initial_owner'] = share_initial_owner_model
share_prototype_share_by_size_model_json['iops'] = 100
@@ -94867,6 +97253,7 @@ def test_share_prototype_share_by_source_share_serialization(self):
share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
share_mount_target_prototype_model = {} # ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
share_mount_target_prototype_model['name'] = 'my-share-mount-target'
share_mount_target_prototype_model['transit_encryption'] = 'none'
share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
@@ -94878,7 +97265,7 @@ def test_share_prototype_share_by_source_share_serialization(self):
zone_identity_model['name'] = 'us-south-1'
share_prototype_share_context_model = {} # SharePrototypeShareContext
- share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_context_model['iops'] = 100
share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_context_model['name'] = 'my-share'
@@ -94896,7 +97283,7 @@ def test_share_prototype_share_by_source_share_serialization(self):
# Construct a json representation of a SharePrototypeShareBySourceShare model
share_prototype_share_by_source_share_model_json = {}
- share_prototype_share_by_source_share_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_by_source_share_model_json['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_by_source_share_model_json['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_by_source_share_model_json['name'] = 'my-share'
share_prototype_share_by_source_share_model_json['replica_share'] = share_prototype_share_context_model
@@ -94969,6 +97356,7 @@ def test_share_prototype_share_by_source_snapshot_serialization(self):
share_mount_target_virtual_network_interface_prototype_model['subnet'] = subnet_identity_model
share_mount_target_prototype_model = {} # ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup
+ share_mount_target_prototype_model['access_protocol'] = 'nfs4'
share_mount_target_prototype_model['name'] = 'my-share-mount-target'
share_mount_target_prototype_model['transit_encryption'] = 'none'
share_mount_target_prototype_model['virtual_network_interface'] = share_mount_target_virtual_network_interface_prototype_model
@@ -94980,7 +97368,7 @@ def test_share_prototype_share_by_source_snapshot_serialization(self):
zone_identity_model['name'] = 'us-south-1'
share_prototype_share_context_model = {} # SharePrototypeShareContext
- share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_context_model['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_context_model['iops'] = 100
share_prototype_share_context_model['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_context_model['name'] = 'my-share'
@@ -95002,11 +97390,13 @@ def test_share_prototype_share_by_source_snapshot_serialization(self):
# Construct a json representation of a SharePrototypeShareBySourceSnapshot model
share_prototype_share_by_source_snapshot_model_json = {}
- share_prototype_share_by_source_snapshot_model_json['allowed_transit_encryption_modes'] = ['none']
+ share_prototype_share_by_source_snapshot_model_json['allowed_transit_encryption_modes'] = ['ipsec']
share_prototype_share_by_source_snapshot_model_json['mount_targets'] = [share_mount_target_prototype_model]
share_prototype_share_by_source_snapshot_model_json['name'] = 'my-share'
share_prototype_share_by_source_snapshot_model_json['replica_share'] = share_prototype_share_context_model
share_prototype_share_by_source_snapshot_model_json['user_tags'] = []
+ share_prototype_share_by_source_snapshot_model_json['allowed_access_protocols'] = ['nfs4']
+ share_prototype_share_by_source_snapshot_model_json['bandwidth'] = 100
share_prototype_share_by_source_snapshot_model_json['encryption_key'] = encryption_key_identity_model
share_prototype_share_by_source_snapshot_model_json['initial_owner'] = share_initial_owner_model
share_prototype_share_by_source_snapshot_model_json['iops'] = 100
@@ -95219,6 +97609,11 @@ def test_snapshot_prototype_snapshot_by_source_snapshot_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ snapshot_allowed_use_prototype_model = {} # SnapshotAllowedUsePrototype
+ snapshot_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
zone_identity_model = {} # ZoneIdentityByName
zone_identity_model['name'] = 'us-south-1'
@@ -95236,6 +97631,7 @@ def test_snapshot_prototype_snapshot_by_source_snapshot_serialization(self):
# Construct a json representation of a SnapshotPrototypeSnapshotBySourceSnapshot model
snapshot_prototype_snapshot_by_source_snapshot_model_json = {}
+ snapshot_prototype_snapshot_by_source_snapshot_model_json['allowed_use'] = snapshot_allowed_use_prototype_model
snapshot_prototype_snapshot_by_source_snapshot_model_json['clones'] = [snapshot_clone_prototype_model]
snapshot_prototype_snapshot_by_source_snapshot_model_json['name'] = 'my-snapshot'
snapshot_prototype_snapshot_by_source_snapshot_model_json['resource_group'] = resource_group_identity_model
@@ -95271,6 +97667,11 @@ def test_snapshot_prototype_snapshot_by_source_volume_serialization(self):
# Construct dict forms of any model objects needed in order to build this model.
+ snapshot_allowed_use_prototype_model = {} # SnapshotAllowedUsePrototype
+ snapshot_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ snapshot_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ snapshot_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
zone_identity_model = {} # ZoneIdentityByName
zone_identity_model['name'] = 'us-south-1'
@@ -95285,6 +97686,7 @@ def test_snapshot_prototype_snapshot_by_source_volume_serialization(self):
# Construct a json representation of a SnapshotPrototypeSnapshotBySourceVolume model
snapshot_prototype_snapshot_by_source_volume_model_json = {}
+ snapshot_prototype_snapshot_by_source_volume_model_json['allowed_use'] = snapshot_allowed_use_prototype_model
snapshot_prototype_snapshot_by_source_volume_model_json['clones'] = [snapshot_clone_prototype_model]
snapshot_prototype_snapshot_by_source_volume_model_json['name'] = 'my-snapshot'
snapshot_prototype_snapshot_by_source_volume_model_json['resource_group'] = resource_group_identity_model
@@ -98508,6 +100910,11 @@ def test_volume_prototype_volume_by_source_snapshot_serialization(self):
zone_identity_model = {} # ZoneIdentityByName
zone_identity_model['name'] = 'us-south-1'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -98523,6 +100930,7 @@ def test_volume_prototype_volume_by_source_snapshot_serialization(self):
volume_prototype_volume_by_source_snapshot_model_json['resource_group'] = resource_group_identity_model
volume_prototype_volume_by_source_snapshot_model_json['user_tags'] = []
volume_prototype_volume_by_source_snapshot_model_json['zone'] = zone_identity_model
+ volume_prototype_volume_by_source_snapshot_model_json['allowed_use'] = volume_allowed_use_prototype_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
@@ -100586,6 +102994,11 @@ def test_instance_prototype_instance_by_catalog_offering_instance_by_catalog_off
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -100593,6 +103006,7 @@ def test_instance_prototype_instance_by_catalog_offering_instance_by_catalog_off
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -100767,6 +103181,11 @@ def test_instance_prototype_instance_by_catalog_offering_instance_by_catalog_off
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -100774,6 +103193,7 @@ def test_instance_prototype_instance_by_catalog_offering_instance_by_catalog_off
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -100934,6 +103354,11 @@ def test_instance_prototype_instance_by_image_instance_by_image_instance_by_netw
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -100941,6 +103366,7 @@ def test_instance_prototype_instance_by_image_instance_by_image_instance_by_netw
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -101108,6 +103534,11 @@ def test_instance_prototype_instance_by_image_instance_by_image_instance_by_netw
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -101115,6 +103546,7 @@ def test_instance_prototype_instance_by_image_instance_by_image_instance_by_netw
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -101268,6 +103700,11 @@ def test_instance_prototype_instance_by_source_snapshot_instance_by_source_snaps
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -101278,6 +103715,7 @@ def test_instance_prototype_instance_by_source_snapshot_instance_by_source_snaps
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -101442,6 +103880,11 @@ def test_instance_prototype_instance_by_source_snapshot_instance_by_source_snaps
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -101452,6 +103895,7 @@ def test_instance_prototype_instance_by_source_snapshot_instance_by_source_snaps
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -101902,6 +104346,11 @@ def test_instance_template_prototype_instance_template_by_catalog_offering_insta
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -101909,6 +104358,7 @@ def test_instance_template_prototype_instance_template_by_catalog_offering_insta
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -102083,6 +104533,11 @@ def test_instance_template_prototype_instance_template_by_catalog_offering_insta
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -102090,6 +104545,7 @@ def test_instance_template_prototype_instance_template_by_catalog_offering_insta
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -102250,6 +104706,11 @@ def test_instance_template_prototype_instance_template_by_image_instance_templat
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -102257,6 +104718,7 @@ def test_instance_template_prototype_instance_template_by_image_instance_templat
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -102424,6 +104886,11 @@ def test_instance_template_prototype_instance_template_by_image_instance_templat
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -102431,6 +104898,7 @@ def test_instance_template_prototype_instance_template_by_image_instance_templat
volume_profile_identity_model['name'] = 'general-purpose'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -102584,6 +105052,11 @@ def test_instance_template_prototype_instance_template_by_source_snapshot_instan
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -102594,6 +105067,7 @@ def test_instance_template_prototype_instance_template_by_source_snapshot_instan
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -102758,6 +105232,11 @@ def test_instance_template_prototype_instance_template_by_source_snapshot_instan
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -102768,6 +105247,7 @@ def test_instance_template_prototype_instance_template_by_source_snapshot_instan
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -102920,6 +105400,11 @@ def test_instance_template_instance_by_catalog_offering_instance_template_contex
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -102930,6 +105415,7 @@ def test_instance_template_instance_by_catalog_offering_instance_template_contex
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -103110,6 +105596,11 @@ def test_instance_template_instance_by_catalog_offering_instance_template_contex
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -103120,6 +105611,7 @@ def test_instance_template_instance_by_catalog_offering_instance_template_contex
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -103286,6 +105778,11 @@ def test_instance_template_instance_by_image_instance_template_context_instance_
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -103296,6 +105793,7 @@ def test_instance_template_instance_by_image_instance_template_context_instance_
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -103469,6 +105967,11 @@ def test_instance_template_instance_by_image_instance_template_context_instance_
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -103479,6 +105982,7 @@ def test_instance_template_instance_by_image_instance_template_context_instance_
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
volume_prototype_instance_by_image_context_model = {} # VolumePrototypeInstanceByImageContext
+ volume_prototype_instance_by_image_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_image_context_model['bandwidth'] = 1000
volume_prototype_instance_by_image_context_model['capacity'] = 100
volume_prototype_instance_by_image_context_model['encryption_key'] = encryption_key_identity_model
@@ -103638,6 +106142,11 @@ def test_instance_template_instance_by_source_snapshot_instance_template_context
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -103651,6 +106160,7 @@ def test_instance_template_instance_by_source_snapshot_instance_template_context
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -103834,6 +106344,11 @@ def test_instance_template_instance_by_source_snapshot_instance_template_context
vpc_identity_model = {} # VPCIdentityById
vpc_identity_model['id'] = 'r006-4727d842-f94f-4a2d-824a-9bc9b02c523b'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -103847,6 +106362,7 @@ def test_instance_template_instance_by_source_snapshot_instance_template_context
snapshot_identity_model['id'] = 'r006-f6bfa329-0e36-433f-a3bb-0df632e79263'
volume_prototype_instance_by_source_snapshot_context_model = {} # VolumePrototypeInstanceBySourceSnapshotContext
+ volume_prototype_instance_by_source_snapshot_context_model['allowed_use'] = volume_allowed_use_prototype_model
volume_prototype_instance_by_source_snapshot_context_model['bandwidth'] = 1000
volume_prototype_instance_by_source_snapshot_context_model['capacity'] = 100
volume_prototype_instance_by_source_snapshot_context_model['encryption_key'] = encryption_key_identity_model
@@ -104374,6 +106890,66 @@ def test_load_balancer_pool_member_target_prototype_load_balancer_identity_load_
assert load_balancer_pool_member_target_prototype_load_balancer_identity_load_balancer_identity_by_id_model_json2 == load_balancer_pool_member_target_prototype_load_balancer_identity_load_balancer_identity_by_id_model_json
+class TestModel_LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref:
+ """
+ Test Class for LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref
+ """
+
+ def test_load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_serialization(self):
+ """
+ Test serialization/deserialization for LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref
+ """
+
+ # Construct a json representation of a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref model
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json = {}
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+
+ # Construct a model instance of LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref by calling from_dict on the json representation
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model = LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref.from_dict(load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json)
+ assert load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model != False
+
+ # Construct a model instance of LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref by calling from_dict on the json representation
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_dict = LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref.from_dict(load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json).__dict__
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model2 = LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityByHref(**load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_dict)
+
+ # Verify the model instances are equivalent
+ assert load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model == load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json2 = load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model.to_dict()
+ assert load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json2 == load_balancer_pool_member_target_prototype_reserved_ip_identity_by_href_model_json
+
+
+class TestModel_LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById:
+ """
+ Test Class for LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById
+ """
+
+ def test_load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_serialization(self):
+ """
+ Test serialization/deserialization for LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById
+ """
+
+ # Construct a json representation of a LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById model
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json = {}
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json['id'] = '0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb'
+
+ # Construct a model instance of LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById by calling from_dict on the json representation
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model = LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById.from_dict(load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json)
+ assert load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model != False
+
+ # Construct a model instance of LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById by calling from_dict on the json representation
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_dict = LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById.from_dict(load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json).__dict__
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model2 = LoadBalancerPoolMemberTargetPrototypeReservedIPIdentityById(**load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_dict)
+
+ # Verify the model instances are equivalent
+ assert load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model == load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model2
+
+ # Convert model instance back to dict and verify no loss of data
+ load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json2 = load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model.to_dict()
+ assert load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json2 == load_balancer_pool_member_target_prototype_reserved_ip_identity_by_id_model_json
+
+
class TestModel_NetworkInterfaceIPPrototypeReservedIPIdentityByHref:
"""
Test Class for NetworkInterfaceIPPrototypeReservedIPIdentityByHref
@@ -105833,6 +108409,11 @@ def test_volume_attachment_prototype_volume_volume_prototype_instance_context_vo
resource_group_identity_model = {} # ResourceGroupIdentityById
resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345'
+ volume_allowed_use_prototype_model = {} # VolumeAllowedUsePrototype
+ volume_allowed_use_prototype_model['api_version'] = '2024-06-23'
+ volume_allowed_use_prototype_model['bare_metal_server'] = 'enable_secure_boot == true'
+ volume_allowed_use_prototype_model['instance'] = 'gpu.count > 0 && enable_secure_boot == true'
+
encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN
encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179'
@@ -105847,6 +108428,7 @@ def test_volume_attachment_prototype_volume_volume_prototype_instance_context_vo
volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['profile'] = volume_profile_identity_model
volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['resource_group'] = resource_group_identity_model
volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['user_tags'] = []
+ volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['allowed_use'] = volume_allowed_use_prototype_model
volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['capacity'] = 100
volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['encryption_key'] = encryption_key_identity_model
volume_attachment_prototype_volume_volume_prototype_instance_context_volume_prototype_instance_context_volume_by_source_snapshot_model_json['source_snapshot'] = snapshot_identity_model